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); }
public static void Start(FBPPConfig config) { _config = config; _latestData = GetSaveFile(); }
public static void OverwriteLocalSaveFile(string data) { WriteToSaveFile(data); _latestData = null; _latestData = GetSaveFile(); }
public static void DeleteAll() { WriteToSaveFile(JsonUtility.ToJson(new FBPPFileModel())); _latestData = new FBPPFileModel(); }