Beispiel #1
0
 public StateModule()
 {
     PersistState.Load();
     PersistState.Instance.LastStartupTime     = DateTime.Now;
     PersistState.Instance.LastApplicationPath = CoreParams.GameFolderPath;
     PersistState.Save();
 }
Beispiel #2
0
 /// <summary>
 /// Loads persistent state from the default file
 /// </summary>
 public static void Load()
 {
     Instance = CoreUtils.LoadExternalJson <PersistState>(Path);
     if (Instance == null)
     {
         Instance = new PersistState();
     }
 }
Beispiel #3
0
 //our first "migration": sets LastMigratedVersion if not already set
 private static void MigrateLastMigratedVersion(PersistState ps)
 {
     if (ps.LastMigratedVersion == null)
     {
         ps.LastMigratedVersion = CoreParams.GetCurrentVersion();
         Debug.Log($"[PersistState] Migrated to {ps.LastMigratedVersion} ({nameof(MigrateLastMigratedVersion)})");
     }
 }
Beispiel #4
0
 /// <summary>
 /// Loads persistent state from the default file
 /// </summary>
 public static void Load()
 {
     Instance = CoreUtils.LoadExternalJson <PersistState>(Path);
     if (Instance == null)
     {
         Instance = new PersistState();
     }
     else
     {
         Instance.IsFirstRun = false;
     }
 }
Beispiel #5
0
 public override void Dispose()
 {
     PersistState.Instance.LastExitTime = DateTime.Now;
     PersistState.Save();
 }
Beispiel #6
0
 public override void Dispose()
 {
     PersistState.Save();
 }
Beispiel #7
0
 public StateModule()
 {
     PersistState.Load();
     PersistState.Save();
 }
Beispiel #8
0
 /// <summary>
 /// Purges the current persistent state and commits this to the default file
 /// </summary>
 public static void Reset()
 {
     Instance = new PersistState();
     Save();
 }