Пример #1
0
 private static FBPPFileModel GetSaveFile()
 {
     CheckForInit();
     CheckSaveFileExists();
     if (_latestData == null)
     {
         var saveFileText = File.ReadAllText(GetSaveFilePath());
         if (_config.ScrambleSaveData)
         {
             saveFileText = DataScrambler(saveFileText);
         }
         try
         {
             _latestData = JsonUtility.FromJson <FBPPFileModel>(saveFileText);
         }
         catch (ArgumentException e)
         {
             Debug.LogException(new Exception("FBPP Error loading save file: " + e.Message));
             if (_config.OnLoadError != null)
             {
                 _config.OnLoadError.Invoke();
             }
             else
             {
                 DeleteAll();
             }
         }
     }
     return(_latestData);
 }
Пример #2
0
 public static void Start(FBPPConfig config)
 {
     _config     = config;
     _latestData = GetSaveFile();
 }
Пример #3
0
 public static void OverwriteLocalSaveFile(string data)
 {
     WriteToSaveFile(data);
     _latestData = null;
     _latestData = GetSaveFile();
 }
Пример #4
0
 public static void DeleteAll()
 {
     WriteToSaveFile(JsonUtility.ToJson(new FBPPFileModel()));
     _latestData = new FBPPFileModel();
 }