2using System.Collections.Generic;
63 public void Init(
bool _backup,
string _pathBackup =
"",
string _idDest =
"")
70 for (
int i = 0; i < 2; i++)
72 Vector2 anchoredPosition =
windows[i].Rect().anchoredPosition;
73 windows[i].Rect().anchoredPosition =
new Vector2(anchoredPosition.x + 40f, anchoredPosition.y - 30f);
76 if (!
backup && Application.isEditor)
78 FileInfo[] files =
new DirectoryInfo(
"D:\\Download").GetFiles();
79 foreach (FileInfo fileInfo
in files)
81 if (fileInfo.Name.StartsWith(
"world") && fileInfo.Name.EndsWith(
".zip"))
83 string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileInfo.Name);
84 string path = CorePath.RootSave + fileNameWithoutExtension;
85 if (!Directory.Exists(path))
87 Directory.CreateDirectory(path);
88 new StreamWriter(
new MemoryStream());
89 ReadOptions options =
new ReadOptions();
90 ZipFile.Read(fileInfo.FullName, options).ExtractAll(path);
98 windows[0].ClearBottomButtons();
99 windows[0].AddBottomButton(
"toggleCloud", delegate
112 windows[0].SetCaption(
"saveList".lang() + (
cloud ? (
" " +
"isCloud".lang()) :
""));
117 goInfo.SetActive(value:
false);
125 string s = a.Title + ((ELayer.core.IsGameStarted && a.id ==
Game.
id) ?
"currentSave".lang() :
"") + Environment.NewLine;
163 goInfo.SetActive(value:
true);
196 ColorUtility.TryParseHtmlString(
"#" + i.
color, out color);
221 if (!cancel && !text.IsEmpty())
225 if (Directory.Exists(CorePath.RootSave + text))
227 throw new Exception(text +
" already exists.");
229 Directory.Move(CorePath.RootSave + i.id, CorePath.RootSave + text);
230 if (Directory.Exists(CorePath.PathBackup + i.id))
232 if (Directory.Exists(CorePath.PathBackup + text))
234 throw new Exception(
"Backup/" + text +
" already exists.");
236 Directory.Move(CorePath.PathBackup + i.id, CorePath.PathBackup + text);
240 catch (Exception ex2)
255 bool flag2 = Directory.Exists(text3);
256 if (Directory.Exists(text2) || Directory.Exists(text4))
259 ELayer.ui.Say(
"cloud_conflict");
268 Debug.Log(
"Converting Backup files:");
269 Directory.Move(text3, text4);
270 foreach (GameIndex game in GameIO.GetGameList(((!cloud) ? CorePath.PathBackupCloud : CorePath.PathBackup) + i.id +
"/"))
272 Debug.Log(
"Processing:" + game.id +
": " + game.path);
275 GameIO.PrepareSteamCloud(game.id, game.path);
279 Debug.Log(
"Converting Current World:");
280 Directory.Move(sourceDirName, text2);
283 GameIO.UpdateGameIndex(i);
286 GameIO.PrepareSteamCloud(i.id);
297 buttonLoad.onClick.RemoveAllListeners();
298 buttonDelete.onClick.RemoveAllListeners();
299 buttonLoad.SetOnClick(delegate
331 buttonDelete.SetOnClick(delegate
341 buttonListBackup.SetOnClick(delegate
345 buttonBackup.SetOnClick(delegate
349 ELayer.game.backupTime = 0.0;
358 buttonOpen.SetOnClick(delegate
362 buttonLoad.SetActive(flag);
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
static string RootSaveCloud
static string PathBackupCloud
static Dialog YesNo(string langDetail, Action actionYes, Action actionNo=null, string langYes="yes", string langNo="no")
static Dialog InputName(string langDetail, string text, Action< bool, string > onClose, InputType inputType=InputType.Default)
static SourceManager sources
static void DeleteGame(string id, bool cloud, bool deleteBackup=true)
static void UpdateGameIndex(GameIndex i)
static List< GameIndex > GetGameList(string path, bool sortByName=false, bool includeEmptyFolder=false)
static void MakeBackup(GameIndex index, string suffix="")
static void Load(string id, bool cloud)
static bool TryLoad(string id, bool cloud, Action onLoad)
bool Save(bool isAutoSave=false, bool silent=false)
static void CopyDir(string sourceDirectory, string targetDirectory, Func< string, bool > funcExclude=null)
void RefreshInfo(GameIndex i)
void Init(bool _backup, string _pathBackup="", string _idDest="")
UIButton buttonListBackup
void RefreshList(string id=null)
void SetPortrait(string id, Color colorOverlay=default(Color), bool applyColorMod=true)
void Select(int index=0, bool invoke=false)
override void Add(object item)
virtual void Refresh(bool highlightLast=false)
UIItem AddTopic(string id, string text, string value=null)
UIItem AddText(string text, FontColor color=FontColor.DontChange)
void Space(int sizeY=0, int sizeX=1)
static void ShowExplorer(string itemPath, bool selectFirstFile=false)
bool IsSaveCompatible(Version v)