Ejemplo n.º 1
0
        /// <summary>
        /// <see cref="AdvancedGameStatsManager"/>.DoMidgameSave() is only used for hooks. Use <see cref="GameManager"/>.DoMidgameSave() instead
        /// </summary>
        public static void DoMidgameSave()
        {
            string midGameSaveGuid      = Guid.NewGuid().ToString();
            AdvancedMidGameSaveData obj = new AdvancedMidGameSaveData(midGameSaveGuid);

            SaveManager.Save(obj, DaveAPIManager.AdvancedMidGameSave, GameStatsManager.Instance.PlaytimeMin, 0u, null);
            Instance.midGameSaveGuid = midGameSaveGuid;
            Save();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Revalidates the current <see cref="AdvancedMidGameSaveData"/>
        /// </summary>
        /// <param name="saveStats">If true, it will also save <see cref="AdvancedGameStats"/></param>
        public static void RevalidateMidgameSave(bool saveStats)
        {
            AdvancedMidGameSaveData midGameSaveData = null;

            if (VerifyAndLoadMidgameSave(out midGameSaveData, false))
            {
                midGameSaveData.Revalidate();
                SaveManager.Save(midGameSaveData, DaveAPIManager.AdvancedMidGameSave, GameStatsManager.Instance.PlaytimeMin, 0u, null);
                GameStatsManager.Instance.midGameSaveGuid = midGameSaveData.midGameSaveGuid;
                if (saveStats)
                {
                    GameStatsManager.Save();
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Verifies and loads the current <see cref="AdvancedMidGameSaveData"/>
 /// </summary>
 /// <param name="midgameSave">The loaded midgame save</param>
 /// <param name="checkValidity">If <see langword="true"/>, it will not load invalid <see cref="AdvancedMidGameSaveData"/>s</param>
 /// <returns><see langword="true"/> if it succeeded, <see langword="false"/> if not</returns>
 public static bool VerifyAndLoadMidgameSave(out AdvancedMidGameSaveData midgameSave, bool checkValidity = true)
 {
     if (!SaveManager.Load(DaveAPIManager.AdvancedGameSave, out midgameSave, true, 0u, null, null))
     {
         Debug.LogError("No mid game save found");
         return(false);
     }
     if (midgameSave == null)
     {
         Debug.LogError("Failed to load mid game save (0)");
         return(false);
     }
     if (checkValidity && !midgameSave.IsValid())
     {
         return(false);
     }
     if (GameStatsManager.Instance.midGameSaveGuid == null || GameStatsManager.Instance.midGameSaveGuid != midgameSave.midGameSaveGuid)
     {
         Debug.LogError("Failed to load mid game save (1)");
         return(false);
     }
     return(true);
 }