示例#1
0
 private static FilePrefsData GetSaveFile()
 {
     CheckSaveFileExists();
     if (latestData == null)
     {
         var saveFileText = File.ReadAllText(GetSaveFilePath());
         if (scrambleData)
         {
             saveFileText = DataScrambler(saveFileText);
         }
         try
         {
             latestData = JsonUtility.FromJson <FilePrefsData>(saveFileText);
         }
         catch (ArgumentException e)
         {
             Debug.LogException(new Exception("SAVE FILE IN WRONG FORMAT, CREATING NEW SAVE FILE : " + e.Message));
             DeleteAll();
         }
     }
     return(latestData);
 }
示例#2
0
 public static void OverwriteLocalSaveFile(string data)
 {
     WriteToSaveFile(data);
     latestData = null;
 }
示例#3
0
 public static void DeleteAll()
 {
     WriteToSaveFile(JsonUtility.ToJson(new FilePrefsData()));
     latestData = new FilePrefsData();
 }