/// <summary>Synchronises this ES3File with a file in storage.</summary> /// <param name="settings">The settings we want to use to override the default settings.</param> public void Sync(ES3Settings settings = null) { if (settings == null) { settings = new ES3Settings(); } ES3.DeleteFile(settings); if (cache.Count == 0) { return; } using (var baseWriter = ES3Writer.Create(settings, true, !syncWithFile, false)) { foreach (var kvp in cache) { // If we change the name of a type, the type may be null. // In this case, use System.Object as the type. Type type; if (kvp.Value.type == null) { type = typeof(System.Object); } else { type = kvp.Value.type.type; } baseWriter.Write(kvp.Key, type, kvp.Value.bytes); } baseWriter.Save(!syncWithFile); } }
public static void DeleteSlotData(Slots slot) { string saveFileName; // Set the current slot switch (slot) { case Slots.Slot1: saveFileName = Slots.Slot1 + SAVE_FILE_EXTENSION; break; case Slots.Slot2: saveFileName = Slots.Slot2 + SAVE_FILE_EXTENSION; break; case Slots.Slot3: saveFileName = Slots.Slot3 + SAVE_FILE_EXTENSION; break; case Slots.None: saveFileName = Slots.None.ToString(); break; default: throw new ArgumentOutOfRangeException(nameof(slot), slot, null); } // Check slot if it exists and delete it if (ES3.FileExists(saveFileName)) { ES3.DeleteFile(saveFileName); } }
public static void DeleteSlotData(Slots _slot) { string saveFileName; // Set the current slot switch (_slot) { case Slots.Slot1: saveFileName = Slots.Slot1.ToString() + ".sls"; break; case Slots.Slot2: saveFileName = Slots.Slot2.ToString() + ".sls"; break; case Slots.Slot3: saveFileName = Slots.Slot3.ToString() + ".sls"; break; default: saveFileName = Slots.None.ToString(); break; } // Check slot if it exists and delete it if (ES3.FileExists(saveFileName)) { ES3.DeleteFile(saveFileName); } }
private void Awake() { if (deleteSaveFile) { ES3.DeleteFile("SaveFile.es3"); } }
public static void LoadAll() { MegaMeshManager.ClearReferences(); BehaviorManager.AllowedToUpdate = false; // don't let circuitry updates f**k us up while we're loading the game BehaviorManager.ClearAllLists(); // remove all existing stuff in the world before loading the new stuff ObjectInfo[] saveobjects = UnityEngine.Object.FindObjectsOfType <ObjectInfo>(); // all active instances of SaveObject foreach (ObjectInfo save in saveobjects) { UnityEngine.Object.Destroy(save.gameObject); } List <SavedObjectV2> TopLevelObjects = (List <SavedObjectV2>)FileUtilities.LoadFromFile(RegionsPath, "world.tung"); if (TopLevelObjects != null) { foreach (SavedObjectV2 save in TopLevelObjects) { SavedObjectUtilities.LoadSavedObject(save); } } RecalculateAllClustersEverywhereWithDelay(); try { LoadPlayerPosition(); } catch { ES3.DeleteFile(PlayersPath + "/player"); } GameplayUIManager.UIState = UIState.None; }
public override void activate() { if (ES3.FileExists("merky.txt")) { ES3.DeleteFile("merky.txt"); } Managers.Game.resetGame(false); }
public override void DeleteSavedGameData(int slotNumber) { if (useSeparateFiles) { ES3.DeleteFile(GetFilename(slotNumber)); } else { ES3.DeleteKey(GetKey(slotNumber), GetFilename(slotNumber)); } }
/// <summary> /// ���ر������� /// </summary> //public void LoadLocalData() //{ // //ES3.Save<List<int>>("test", new List<int>() { 0,1} ); // //Debug.Log("ssss" + ES3.FileExists(new ES3Settings())); // if(isCleanCache) // ES3.DeleteFile(new ES3Settings()); // //Debug.Log("ssss" + ES3.FileExists(new ES3Settings())); // if(ES3.FileExists(new ES3Settings())) // NetDataManager.Instance.LoadData(); // // List<int> test = ES3.Load<List<int>>("test"); // //NetDataManager.Instance.LoadData(); // //Debug.Log("test" + test[0]); // //Debug.Log("test" + test[1]); // // LocalSaveManager.LoadData(); //} public void LoadLocalData(bool refresh) { if (refresh) { ES3.DeleteFile(new ES3Settings()); } if (ES3.FileExists(new ES3Settings())) { NetDataManager.Instance.LoadLocalData(); } }
private void CheckHappiness() { float happinessPerCitizen = 0; if (allCitizens.Count > 0) { happinessPerCitizen = 100 / allCitizens.Count; } currentHappinessAmount = 0; for (int i = 0; i < allCitizens.Count; i++) { if (allCitizens[i].IsHappy()) { currentHappinessAmount += happinessPerCitizen; } } if (currentHappinessAmount <= 5) { if (allCitizens.Count > 0) { int citizensToLeave = Random.Range(3, allCitizens.Count / 100 * 50); if (citizensToLeave > allCitizens.Count) { citizensToLeave = allCitizens.Count; } DeleteCitizen(citizensToLeave); MessageLog.AddNewMessage("Your people are unhappy! " + citizensToLeave.ToString() + " left your city!"); } else if (currentEmployedAmount > 0) { int citizensToLeave = Random.Range(3, currentEmployedAmount / 100 * 50); if (citizensToLeave > currentEmployedAmount) { citizensToLeave = currentEmployedAmount; } currentEmployedAmount -= citizensToLeave; MessageLog.AddNewMessage("Your people are unhappy! " + citizensToLeave.ToString() + " left your city!"); } int allCitizensLeft = allCitizens.Count + currentEmployedAmount; if (allCitizensLeft <= 0) { Time.timeScale = 0; ES3.DeleteFile(ES3.Load <string>("CurrentSaveName") + ".es3"); ES3.DeleteFile(ES3.Load <string>("CurrentSaveName") + ".png"); loseMenu.SetActive(true); } citizensText.text = allCitizensLeft.ToString(); } happinessText.text = Mathf.RoundToInt(currentHappinessAmount).ToString() + "%"; }
public static void SaveMiscData() { try { ES3.Save <int>("SaveFormatVersion", 2, InfoPath); ES3.Save <string>("WorldType", "Legacy", InfoPath); } catch { ES3.DeleteFile(InfoPath); } }
// Play action void PlayAction() { Debug.Log("PLAY ACTION"); // Hide menu, blend cameras GetComponent <Canvas>().enabled = false; FirstCamera.gameObject.SetActive(false); PlayCamera.gameObject.SetActive(true); ES3.DeleteFile(); // Lauch scene loading transitionScene.LoadScene(5000); }
public void SaveUnitStats(CharacterStatsSystem stats) { string uniquePathName = filePath + "\\" + stats.name + "\\ stats"; Debug.Log("Saving Stats of : " + stats.name + " To Directory : " + uniquePathName); if (ES3.KeyExists(stats.name)) { ES3.DeleteFile(stats.name); } if (ES3.KeyExists(stats.name, uniquePathName)) { ES3.DeleteFile(uniquePathName); } ES3.Save <CharacterStatsSystem>(stats.name, stats, uniquePathName); }
void Start() { //TEST ES3.DeleteFile(); if (!ES3.FileExists()) { ES3.Save <bool>("Test", true); //좌표 나침반 고정 ES3.Save <int>("Alarm", AlarmCheackKeys.Off); ES3.Save <int>("Unit", UnitCheackKeys.Kn); ES3.Save <int>("Language", LanguageKeys.Korean); } StartCoroutine(SceneChangeA()); }
public static void DeleteSaveData(SaveDataAvatar avatar) { if (!avatar) { return; } Debug.Log("Deleting save data for " + avatar.name); if (!AvatarIsUsedBySaveFile(avatar)) { Debug.Log("Avatar doesn't have any save data."); return; } OnSaveFileAccessed(); ES3.DeleteFile(saveFilesDirectory + avatar.name + ".es3"); }
public void DeleteSaveData() { SRDebug.Instance.HideDebugPanel(); var popup = PopupManager.RequestSimplePopup().Initialize("本当に削除しますか?", "OK", "Cancel"); popup.DecideButton.OnClickAsObservable() .Subscribe(_ => { ES3.DeleteFile(); SceneManager.LoadScene("Game"); }) .AddTo(popup); popup.CancelButton.OnClickAsObservable() .Subscribe(_ => { popup.Close(); }) .AddTo(popup); popup.Open(); }
private void Awake() { GameplayUIManager.UIState = UIState.MainMenu; Instance = this; MegaMeshManager.ClearReferences(); BehaviorManager.ClearAllLists(); ShowMainMenu(); string CurrentVersion = "0.2.0"; string LastLoadedVersion = Settings.Get("LastLoadedVersion", CurrentVersion); if (LastLoadedVersion != CurrentVersion) { ES3.DeleteFile("settings.txt"); } // some settings are obsolete and must be reset EverythingHider.UnHideEverything(); }
public void Save() { Debug.Log("Start Save"); m_Count = SaveTargets.Count; foreach (SaveTarget obj in SaveTargets) { obj.SelfSaving(CountDown); LoadTargets.Remove(obj); LoadTargets.Add(obj); } SaveTargets.Clear(); ES3.DeleteFile("MetaData.csv"); var sheet = new ES3Spreadsheet(); // Add data to cells in the spreadsheet. for (int row = 0; row < LoadTargets.Count; row++) { sheet.SetCell <string>(0, row, LoadTargets[row].name); } sheet.Save("MetaData.csv"); }
/// <summary> /// Loads the game from the save file /// It assumes the file already exists /// </summary> public void loadFromFile() { string filename = getFileName(false); try { //Load file settings List <SettingObject> settings = ES3.Load <List <SettingObject> >("settings", filename); foreach (ISetting setting in FindObjectsOfType <MonoBehaviour>().OfType <ISetting>()) { if (setting.Scope == SettingScope.SAVE_FILE) { string id = setting.ID; foreach (SettingObject setObj in settings) { if (id == setObj.id) { setting.Setting = setObj; break; } } } } //Delegate onFileLoad?.Invoke(filename); } catch (System.Exception e) { if (ES3.FileExists(filename)) { ES3.DeleteFile(filename); } Debug.LogError("Error loading file: " + filename + "; error: " + e); Managers.Game.resetGame(false); } }
private void InvokeDeleteSaveData() { ES3.DeleteFile(); SceneManager.LoadScene("Game"); }
public override void Enter() { ES3.DeleteFile(filePath.Value, GetSettings()); }
public static void DeleteFile(string file) { ES3.DeleteFile(file + "info.9n"); ES3.DeleteFile(file + "lib.9n"); ES3.DeleteFile(file + "game.9n"); }
public void DeleteActiveSave() { ES3.DeleteFile(saveName); }
public void ClearData() { Debug.Log("Cleared SaveData"); ES3.DeleteFile("SaveData"); }
public void ClearDatas() { ES3.DeleteFile(new ES3Settings()); }
public void Delete(string saveFile) { ES3.DeleteFile(saveFile); }
private void DeleteData() { Debug.Log("clear data"); ES3.DeleteFile(); PlayerPrefs.DeleteAll(); }
public void DeleteCurrentSave() { ES3.DeleteFile(_autoSaveFile); }
public void DeleteAllSaveData() { ES3.DeleteFile("SaveFile.es3"); ES3.DeleteFile("SquadData.es3"); }
void ResetBase() { ES3.DeleteFile("Base"); Save(); }