示例#1
0
 public StateModule()
 {
     PersistState.Load();
     PersistState.Instance.LastStartupTime     = DateTime.Now;
     PersistState.Instance.LastApplicationPath = CoreParams.GameFolderPath;
     PersistState.Save();
 }
示例#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();
     }
 }
示例#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)})");
     }
 }
示例#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;
     }
 }
示例#5
0
 public override void Dispose()
 {
     PersistState.Instance.LastExitTime = DateTime.Now;
     PersistState.Save();
 }
示例#6
0
 public override void Dispose()
 {
     PersistState.Save();
 }
示例#7
0
 public StateModule()
 {
     PersistState.Load();
     PersistState.Save();
 }
示例#8
0
 /// <summary>
 /// Purges the current persistent state and commits this to the default file
 /// </summary>
 public static void Reset()
 {
     Instance = new PersistState();
     Save();
 }