コード例 #1
0
 public static void CheckVersionAndLoadGame(string saveFileName)
 {
     PreLoadUtility.CheckVersionAndLoad(GenFilePaths.FilePathForSavedGame(saveFileName), ScribeMetaHeaderUtility.ScribeHeaderMode.Map, delegate
     {
         GameDataSaveLoader.LoadGame(saveFileName);
     });
 }
コード例 #2
0
        public static void LoadGameFromSaveFile(string fileName)
        {
            string str = GenText.ToCommaList(from mod in LoadedModManager.RunningMods
                                             select mod.ToString(), true);

            Log.Message("Loading game from file " + fileName + " with mods " + str);
            DeepProfiler.Start("Loading game from file " + fileName);
            Current.Game = new Game();
            DeepProfiler.Start("InitLoading (read file)");
            Scribe.loader.InitLoading(GenFilePaths.FilePathForSavedGame(fileName));
            DeepProfiler.End();
            ScribeMetaHeaderUtility.LoadGameDataHeader(ScribeMetaHeaderUtility.ScribeHeaderMode.Map, true);
            if (Scribe.EnterNode("game"))
            {
                Current.Game = new Game();
                Current.Game.LoadGame();
                PermadeathModeUtility.CheckUpdatePermadeathModeUniqueNameOnGameLoad(fileName);
                DeepProfiler.End();
            }
            else
            {
                Log.Error("Could not find game XML node.");
                Scribe.ForceStop();
            }
        }
コード例 #3
0
        public static void LoadGameFromSaveFileNow(string fileName)
        {
            string str = (from mod in LoadedModManager.RunningMods
                          select mod.ToString()).ToCommaList();

            Log.Message("Loading game from file " + fileName + " with mods " + str);
            DeepProfiler.Start("Loading game from file " + fileName);
            Current.Game = new Game();
            DeepProfiler.Start("InitLoading (read file)");
            Scribe.loader.InitLoading(GenFilePaths.FilePathForSavedGame(fileName));
            DeepProfiler.End();
            try
            {
                ScribeMetaHeaderUtility.LoadGameDataHeader(ScribeMetaHeaderUtility.ScribeHeaderMode.Map, logVersionConflictWarning: true);
                if (!Scribe.EnterNode("game"))
                {
                    Log.Error("Could not find game XML node.");
                    Scribe.ForceStop();
                    return;
                }
                Current.Game = new Game();
                Current.Game.LoadGame();
            }
            catch (Exception)
            {
                Scribe.ForceStop();
                throw;
            }
            PermadeathModeUtility.CheckUpdatePermadeathModeUniqueNameOnGameLoad(fileName);
            DeepProfiler.End();
        }
コード例 #4
0
 public static void SaveGame(string fileName)
 {
     try
     {
         SafeSaver.Save(GenFilePaths.FilePathForSavedGame(fileName), "savegame", delegate
         {
             ScribeMetaHeaderUtility.WriteMetaHeader();
             Game target = Current.Game;
             Scribe_Deep.Look(ref target, "game");
         }, Find.GameInfo.permadeathMode);
         lastSaveTick = Find.TickManager.TicksGame;
     }
     catch (Exception arg)
     {
         Log.Error("Exception while saving game: " + arg);
     }
 }
コード例 #5
0
 public static void SaveGame(string fileName)
 {
     try
     {
         string path = GenFilePaths.FilePathForSavedGame(fileName);
         SafeSaver.Save(path, "savegame", delegate
         {
             ScribeMetaHeaderUtility.WriteMetaHeader();
             Game game = Current.Game;
             Scribe_Deep.Look <Game>(ref game, "game", new object[0]);
         }, Find.GameInfo.permadeathMode);
         GameDataSaveLoader.lastSaveTick = Find.TickManager.TicksGame;
     }
     catch (Exception arg)
     {
         Log.Error("Exception while saving game: " + arg, false);
     }
 }