private static void PerformSaveCheckPoint(string name, bool urgent) { var newGame = CreateSaveEntry(name, urgent); FilePrefs.SetString(PlayerName + "__RESUME__", Convert.ToBase64String(UnitySerializer.Serialize(newGame))); FilePrefs.Save(); }
private static void PerformSave(string name, bool urgent) { var newGame = CreateSaveEntry(name, urgent); SavedGames[PlayerName].Insert(0, newGame); while (SavedGames[PlayerName].Count > MaxGames) { SavedGames[PlayerName].RemoveAt(SavedGames.Count - 1); } SaveDataToFilePrefs(); FilePrefs.SetString(PlayerName + "__RESUME__", Convert.ToBase64String(UnitySerializer.Serialize(newGame))); FilePrefs.Save(); GameSaved(); }
/// <summary> /// Suspends the serialization. Must resume as many times as you suspend /// </summary> public static void SuspendSerialization() { if (_suspensionCount == 0) { SuspendingSerialization(); if (SerializationMode == SerializationModes.CacheSerialization) { _cachedState = CreateSaveEntry("resume", true); if (SaveResumeInformation) { FilePrefs.SetString(PlayerName + "__RESUME__", Convert.ToBase64String(UnitySerializer.Serialize(_cachedState))); FilePrefs.Save(); } } } _suspensionCount++; }
/// <summary> /// Saves the stored game data to player prefs. /// </summary> public static void SaveDataToFilePrefs() { FilePrefs.SetString("_Save_Game_Data_", Convert.ToBase64String(UnitySerializer.Serialize(SavedGames))); FilePrefs.Save(); }
private void OnApplicationQuit() { FilePrefs.Save(); }