Пример #1
0
        public static string UnusedDefaultFileName(string factionLabel)
        {
            string text = string.Empty;
            int    num  = 1;

            do
            {
                text = factionLabel + num.ToString();
                num++;
            }while (SaveGameFilesUtility.SavedGameNamedExists(text));
            return(text);
        }
        public static string UnusedDefaultFileName(string factionLabel)
        {
            string empty = string.Empty;
            int    num   = 1;

            while (true)
            {
                empty = factionLabel + num.ToString();
                num++;
                if (!SaveGameFilesUtility.SavedGameNamedExists(empty))
                {
                    break;
                }
            }
            return(empty);
        }
Пример #3
0
        private static string NewPermadeathSaveNameWithAppendedNumberIfNecessary(string name, string acceptedNameEvenIfTaken = null)
        {
            int    num = 0;
            string text;

            do
            {
                num++;
                text = name;
                if (num != 1)
                {
                    text += num;
                }
                text = PermadeathModeUtility.AppendedPermadeathModeSuffix(text);
            }while (SaveGameFilesUtility.SavedGameNamedExists(text) && text != acceptedNameEvenIfTaken);
            return(text);
        }
Пример #4
0
 public override void Start()
 {
     Log.ResetMessageCount();
     base.Start();
     try
     {
         musicManagerPlay = new MusicManagerPlay();
         FileInfo autostart = Root.checkedAutostartSaveFile ? null : SaveGameFilesUtility.GetAutostartSaveFile();
         Root.checkedAutostartSaveFile = true;
         if (autostart != null)
         {
             LongEventHandler.QueueLongEvent(delegate
             {
                 SavedGameLoaderNow.LoadGameFromSaveFileNow(Path.GetFileNameWithoutExtension(autostart.Name));
             }, "LoadingLongEvent", doAsynchronously: true, GameAndMapInitExceptionHandlers.ErrorWhileLoadingGame);
         }
         else if (Find.GameInitData != null && !Find.GameInitData.gameToLoad.NullOrEmpty())
         {
             LongEventHandler.QueueLongEvent(delegate
             {
                 SavedGameLoaderNow.LoadGameFromSaveFileNow(Find.GameInitData.gameToLoad);
             }, "LoadingLongEvent", doAsynchronously: true, GameAndMapInitExceptionHandlers.ErrorWhileLoadingGame);
         }
         else
         {
             LongEventHandler.QueueLongEvent(delegate
             {
                 if (Current.Game == null)
                 {
                     SetupForQuickTestPlay();
                 }
                 Current.Game.InitNewGame();
             }, "GeneratingMap", doAsynchronously: true, GameAndMapInitExceptionHandlers.ErrorWhileGeneratingMap);
         }
         LongEventHandler.QueueLongEvent(delegate
         {
             ScreenFader.SetColor(Color.black);
             ScreenFader.StartFade(Color.clear, 0.5f);
         }, null, doAsynchronously: false, null);
     }
     catch (Exception arg)
     {
         Log.Error("Critical error in root Start(): " + arg);
     }
 }
        public static string GeneratePermadeathSaveName()
        {
            string text = NameGenerator.GenerateName(Faction.OfPlayer.def.factionNameMakerPlayer, null, false, null);
            int    num  = 0;
            string text2;

            do
            {
                num++;
                text2 = text;
                if (num != 1)
                {
                    text2 += num;
                }
                text2 = PermadeathModeUtility.AppendPermadeathModeSuffix(text2);
            }while (SaveGameFilesUtility.SavedGameNamedExists(text2));
            return(text2);
        }
Пример #6
0
 public override void Start()
 {
     base.Start();
     try
     {
         Current.Game      = null;
         musicManagerEntry = new MusicManagerEntry();
         FileInfo fileInfo = Root.checkedAutostartSaveFile ? null : SaveGameFilesUtility.GetAutostartSaveFile();
         Root.checkedAutostartSaveFile = true;
         if (fileInfo != null)
         {
             GameDataSaveLoader.LoadGame(fileInfo);
         }
     }
     catch (Exception arg)
     {
         Log.Error("Critical error in root Start(): " + arg);
     }
 }
        public static string GeneratePermadeathSaveName()
        {
            string text = NameGenerator.GenerateName(Faction.OfPlayer.def.factionNameMakerPlayer, (Predicate <string>)null, false, (string)null);
            int    num  = 0;
            string text2;

            while (true)
            {
                num++;
                text2 = text;
                if (num != 1)
                {
                    text2 += num;
                }
                text2 = PermadeathModeUtility.AppendPermadeathModeSuffix(text2);
                if (!SaveGameFilesUtility.SavedGameNamedExists(text2))
                {
                    break;
                }
            }
            return(text2);
        }
Пример #8
0
 public override void Start()
 {
     Log.ResetMessageCount();
     base.Start();
     try
     {
         this.musicManagerPlay = new MusicManagerPlay();
         FileInfo autostart = (!Root.checkedAutostartSaveFile) ? SaveGameFilesUtility.GetAutostartSaveFile() : null;
         Root.checkedAutostartSaveFile = true;
         if (autostart != null)
         {
             Action action = delegate()
             {
                 SavedGameLoaderNow.LoadGameFromSaveFileNow(Path.GetFileNameWithoutExtension(autostart.Name));
             };
             string textKey          = "LoadingLongEvent";
             bool   doAsynchronously = true;
             if (Root_Play.< > f__mg$cache0 == null)
             {
                 Root_Play.< > f__mg$cache0 = new Action <Exception>(GameAndMapInitExceptionHandlers.ErrorWhileLoadingGame);
             }
             LongEventHandler.QueueLongEvent(action, textKey, doAsynchronously, Root_Play.< > f__mg$cache0);
         }
         else if (Find.GameInitData != null && !Find.GameInitData.gameToLoad.NullOrEmpty())
         {
             Action action2 = delegate()
             {
                 SavedGameLoaderNow.LoadGameFromSaveFileNow(Find.GameInitData.gameToLoad);
             };
             string textKey2          = "LoadingLongEvent";
             bool   doAsynchronously2 = true;
             if (Root_Play.< > f__mg$cache1 == null)
             {
                 Root_Play.< > f__mg$cache1 = new Action <Exception>(GameAndMapInitExceptionHandlers.ErrorWhileLoadingGame);
             }
             LongEventHandler.QueueLongEvent(action2, textKey2, doAsynchronously2, Root_Play.< > f__mg$cache1);
         }
         else
         {
             Action action3 = delegate()
             {
                 if (Current.Game == null)
                 {
                     Root_Play.SetupForQuickTestPlay();
                 }
                 Current.Game.InitNewGame();
             };
             string textKey3          = "GeneratingMap";
             bool   doAsynchronously3 = true;
             if (Root_Play.< > f__mg$cache2 == null)
             {
                 Root_Play.< > f__mg$cache2 = new Action <Exception>(GameAndMapInitExceptionHandlers.ErrorWhileGeneratingMap);
             }
             LongEventHandler.QueueLongEvent(action3, textKey3, doAsynchronously3, Root_Play.< > f__mg$cache2);
         }
         LongEventHandler.QueueLongEvent(delegate()
         {
             ScreenFader.SetColor(Color.black);
             ScreenFader.StartFade(Color.clear, 0.5f);
         }, null, false, null);
     }
     catch (Exception arg)
     {
         Log.Error("Critical error in root Start(): " + arg, false);
     }
 }