public static void DeleteData(RoomObject roomToDelete) { if (SaveGame.Exists(roomToDelete.name, SaveGamePath.RoomDataPath)) { SaveGame.Delete(roomToDelete.name, SaveGamePath.RoomDataPath); } }
/// <summary> /// Load saved game /// </summary> /// <returns></returns> public bool Load() { try { if (SaveGame.Exists("money")) { isSaveLoad = true; SaveGame.SavePath = SaveGamePath.PersistentDataPath; money = SaveGame.Load <float>("money"); population = SaveGame.Load <int>("population"); taxes = SaveGame.Load <float>("taxes"); indices = SaveGame.Load <int[]>("ids"); indicesPrefabs = SaveGame.Load <int[]>("indexPrefabs"); pos = SaveGame.Load <Vector3[]>("pos"); return(true); } return(false); } catch { return(false); } }
/// <summary> /// Loads local saves. /// </summary> /// <returns></returns> private Dictionary <string, string> LoadLocal() { if (!SaveGame.Exists(SaveId)) { Logger.Log("No saves found"); return(new Dictionary <string, string>()); } Dictionary <string, string> saves = null; Logger.Log("Loading save"); saves = SaveGame.Load(SaveId, Saves, Encode, EncodePassword, SaveGame.Serializer, SaveGame.Encoder, Encoding, SavePath); var saveMessageBuilder = new StringBuilder($"Loaded values: {Environment.NewLine}"); foreach (KeyValuePair <string, string> save in saves) { saveMessageBuilder.Append($"{save.Key}: {save.Value}"); } Logger.Log(saveMessageBuilder.ToString()); return(saves); }
void Start() { if (SaveGame.Exists("highScore")) { m_GameHighScore = SaveGame.Load <int>("highScore"); } }
void Start() { background_music_game.Stop(); UC = GameObject.Find("Upgrade_UI").GetComponent <UpgradeController>(); // SaveGame.Clear(); if (SaveGame.Exists("ship_fire_rate")) { ship_fire_rate = SaveGame.Load <float>("ship_fire_rate"); } else { ship_fire_rate = 0.0075f; } if (SaveGame.Exists("ship_fire_power")) { ship_fire_power = SaveGame.Load <float>("ship_fire_power"); } else { ship_fire_power = 200.00f; } coins_multiplier = UC.Load_int("_coin_multiplier"); coins_daily = UC.Load_int("_coin_daily"); currentLevel = UC.Load_int("currentLevel"); coins = UC.Load_int("coins"); }
public void LoadSave() { // SaveGame.Clear(); if (SaveGame.Exists("PlayerData")) { state = SaveGame.Load <PlayerData>("PlayerData"); // Debug.Log("Staty: " + state.ToString()); } else { state = new PlayerData(); } // Screen.sleepTimeout = SleepTimeout.NeverSleep; // Init score list while (state.score.Count < state.levelReached) { state.score.Add(0); } currentLevel = 0; scenesInBuild = new List <string>(); for (int i = 3; i < SceneManager.sceneCountInBuildSettings; i++) { string scenePath = SceneUtility.GetScenePathByBuildIndex(i); int lastSlash = scenePath.LastIndexOf("/"); scenesInBuild.Add(scenePath.Substring(lastSlash + 1, scenePath.LastIndexOf(".") - lastSlash - 1)); } }
public void resetLeaderboardData() { if (SaveGame.Exists(this.scoreKey)) { SaveGame.Clear(); } }
void loadWeapon() { GameObject player_ui; string selected_weapon = ""; if (SaveGame.Exists("selectedWeapon")) { selected_weapon = SaveGame.Load <string>("selectedWeapon"); foreach (var item in extra_weapons) { if (item.name == selected_weapon) { weapon_equiped = item; break; } } } else { weapon_equiped = extra_weapons[0]; } player_ui = GameObject.Find("Player"); GameObject instantiated_weapon_equiped = Instantiate(weapon_equiped, player_ui.transform); instantiated_weapon_equiped.transform.SetParent(player_ui.transform); }
private void LoadData() { if (SaveGame.Exists(IDENTIFIER)) { _playerData = SaveGame.Load(IDENTIFIER, new PlayerData(), true); } }
public static void Init() { if (ins != null) { #if TEST Debug.LogError("Đã Init DataManager rồi"); #endif return; } // --- Clear Data --- // // QuickSaveRoot.Delete (MyConstant.rootSaveName); // ------------------ // if (SaveGame.Exists(MyConstant.rootSaveName)) { #if TEST Debug.Log(">>> Load DataManager <<<"); #endif LoadData(); } else { #if TEST Debug.Log(">>> Create New DataManager <<<"); #endif SaveData(); } }
public void LoadTests() { // Null identifier Assert.Catch(() => { SaveGame.Load <string> (null, ""); }); // Empty identifier Assert.Catch(() => { SaveGame.Load <string> ("", ""); }); // Simple save/load SaveGame.Save <string> ("test/load", "saved"); Assert.IsTrue(SaveGame.Exists("test/load")); Assert.AreEqual(SaveGame.Load <string> ("test/load", "not saved"), "saved"); // Reset to default Assert.IsFalse(SaveGame.Exists("test/load2")); Assert.AreEqual(SaveGame.Load <string> ("test/load2", "not saved"), "not saved"); // Clear at end SaveGame.Clear(); }
private void LoadData() { if (SaveGame.Exists(_saveDataIdentifier)) { _isPushNotificationsEnable = SaveGame.Load(_saveDataIdentifier, false); } }
public CurrencyData GetCurrencyData() { if (!SaveGame.Exists("currency")) { return(new CurrencyData()); } return(SaveGame.Load <CurrencyData>("currency")); }
void OnSceneLoaded(UnityEngine.SceneManagement.Scene scene, UnityEngine.SceneManagement.LoadSceneMode mode) { if (!SaveGame.Exists("saved") && SceneManager.GetActiveScene().buildIndex - 1 == 0) { startpoint = GameObject.FindGameObjectWithTag("StartPoint"); transform.position = startpoint.transform.position; } }
// Start is called before the first frame update void Start() { if (SaveGame.Exists("transform")) { NewGameBtn.SetActive(false); ContinueBtn.SetActive(true); } }
public ItemContainer LoadInventory() { if (!SaveGame.Exists("inventory")) { return(new ItemContainer()); } return(SaveGame.Load <ItemContainer>("inventory")); }
public void ClearTests() { // Clear all SaveGame.Save <string> ("test/clear", "saved"); SaveGame.Clear(); Assert.IsFalse(SaveGame.Exists("test/clear")); Assert.AreEqual(SaveGame.Load <string> ("test/clear", "not saved"), "not saved"); }
// Use this for initialization void Start() { if (SaveGame.Exists(questcomplete)) { Load(); } pc = FindObjectOfType <PlayerController> (); }
void OnSceneLoaded(UnityEngine.SceneManagement.Scene scene, UnityEngine.SceneManagement.LoadSceneMode mode) { if (!SaveGame.Exists("currenthp")) { playerCurrentHealth = 50; playerMaxHealth = 50; } }
public void DebugFTUE_DATA() { if (SaveGame.Exists("FTUE")) { FTUE ftue_tmp = SaveGame.Load <FTUE>("FTUE"); Debug.Log("FTUE 1: " + ftue_tmp.FTUE_1_done + " / FTUE 2: " + ftue_tmp.FTUE_2_done + " / FTUE 3: " + ftue_tmp.FTUE_3_done); } }
public void SaveLevel(int _levelNo, float _time, int _star, int _items, int _jumped, int _restarted, int _score) { var chapter = MainMenuManager.Instance.chapter.ToString("0"); var levelString = chapter + levelNo.ToString("00"); if (int.TryParse(levelString, out _levelNo)) { if (SaveGame.Exists("Level" + _levelNo)) { time = CheckBest( SaveGame.Load <float>("Level" + levelNo + "/Time", t), _time); star = (int)CheckBest( SaveGame.Load <int>("Level" + levelNo + "/Star", s), _star); items = (int)CheckBest( SaveGame.Load <int>("Level" + levelNo + "/Items", i), _items); jumped = (int)CheckBest( SaveGame.Load <int>("Level" + levelNo + "/Jumped", j), _jumped); restarted = (int)CheckBest( SaveGame.Load <int>("Level" + levelNo + "/Restarted", r), _restarted); score = (int)CheckBest( SaveGame.Load <int>("Level" + levelNo + "/Score", sc), _score); SaveLevelStats(time, star, items, jumped, restarted, score); } else { PlayerLevelStats playerLevelStats = new PlayerLevelStats { time = _time, star = _star, items = _items, jumped = _jumped, restarted = _restarted, score = _score }; } } print("2b. Saved levelStats. Level: " + _levelNo + ", Time: " + _time + ", star: " + _star + ", items: " + _items + ", jumped: " + _jumped + ", restarted: " + _restarted + ", score: " + _score); SaveGame.Save("Level" + _levelNo + "/Time", _time); SaveGame.Save("Level" + _levelNo + "/Star", _star); SaveGame.Save("Level" + _levelNo + "/Items", _items); SaveGame.Save("Level" + _levelNo + "/Jumped", _jumped); SaveGame.Save("Level" + _levelNo + "/Restarted", _restarted); SaveGame.Save("Level" + _levelNo + "/Score", _score); }
void Awake() { if (m_Singleton != null) { Destroy(gameObject); return; } SaveGame.Serializer = new SaveGameBinarySerializer(); m_Singleton = this; m_Score = 0f; if (SaveGame.Exists("coin")) { m_Coin.Value = SaveGame.Load <int>("coin"); } else { m_Coin.Value = 0; } if (SaveGame.Exists("audioEnabled")) { SetAudioEnabled(SaveGame.Load <bool>("audioEnabled")); } else { SetAudioEnabled(true); } if (SaveGame.Exists("lastScore")) { m_LastScore = SaveGame.Load <float>("lastScore"); } else { m_LastScore = 0f; } if (SaveGame.Exists("highScore")) { m_HighScore = SaveGame.Load <float>("highScore"); } else { m_HighScore = 0f; } RedCharacter.LocalPlayerSpawned += () => { RedCharacter.Local.IsDead.AddEventAndFire(UpdateDeathEvent, this); m_CameraController?.Follow(RedCharacter.Local.transform); RespawnMainCharacter(); }; RedCharacter.OnTargetChanged += () => { StartCoroutine("UpdateTracking"); }; }
public void Load_weapon_data() { if (SaveGame.Exists(w_name + "_power")) { power = SaveGame.Load <float>(w_name + "_power"); } else { power = 200; } if (SaveGame.Exists(w_name + "_rate")) { rate = SaveGame.Load <float>(w_name + "_rate"); } else { rate = 1; } if (SaveGame.Exists(w_name + "_power_cost")) { power_cost = SaveGame.Load <int>(w_name + "_power_cost"); } else { power_cost = 1000; } if (SaveGame.Exists(w_name + "_rate_cost")) { rate_cost = SaveGame.Load <int>(w_name + "_rate_cost"); } else { rate_cost = 1000; } if (SaveGame.Exists(w_name + "_power_level")) { power_level = SaveGame.Load <int>(w_name + "_power_level"); } else { power_level = 1; } if (SaveGame.Exists(w_name + "_rate_level")) { rate_level = SaveGame.Load <int>(w_name + "_rate_level"); } else { rate_level = 1; } }
public CharacterData LoadCharacters() { if (!SaveGame.Exists("characters")) { return(new CharacterData()); } var data = SaveGame.Load <CharacterData>("characters"); return(data); }
void Start() { DontDestroyOnLoad(gameObject); if (SaveGame.Exists("scene")) { if (SaveGame.Load <string> ("scene") != "UnityRPG") { SceneManager.LoadScene(SaveGame.Load <string> ("scene")); } } }
void OnSceneLoaded(UnityEngine.SceneManagement.Scene scene, UnityEngine.SceneManagement.LoadSceneMode mode) { if (!SaveGame.Exists("lvl")) { currentHP = HPLevels [1]; currentAttack = attackLevels [1]; currentDefense = defenseLevels [1]; currentLevel = 1; currentExp = 0; } }
//public GameObject player; // Use this for initialization void Start() { if (SaveGame.Exists("lvl") && load != null) { load.interactable = true; } else if (load != null) { load.interactable = false; } }
public int Load_int(string data) { if (SaveGame.Exists(data)) { return(SaveGame.Load <int>(data)); } else { return(1); } }
public void resetFTUE_DATA() { if (SaveGame.Exists("FTUE")) { FTUE ftue_tmp = SaveGame.Load <FTUE>("FTUE"); ftue_tmp.FTUE_1_done = false; ftue_tmp.FTUE_2_done = false; ftue_tmp.FTUE_3_done = false; SaveGame.Save <FTUE>("FTUE", ftue_tmp); } }
public float Load_float(string data) { if (SaveGame.Exists(data)) { return(SaveGame.Load <float>(data)); } else { return(1); } }