コード例 #1
0
    private static void PerformSaveCheckPoint(string name, bool urgent)
    {
        var newGame = CreateSaveEntry(name, urgent);

        FilePrefs.SetString(PlayerName + "__RESUME__", Convert.ToBase64String(UnitySerializer.Serialize(newGame)));
        FilePrefs.Save();
    }
コード例 #2
0
    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();
    }
コード例 #3
0
 /// <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++;
 }
コード例 #4
0
 /// <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();
 }
コード例 #5
0
 private void OnApplicationQuit()
 {
     FilePrefs.Save();
 }