Example #1
0
 public virtual void UIRootOnGUI()
 {
     UnityGUIBugsFixer.OnGUI();
     Text.StartOfOnGUI();
     CheckOpenLogWindow();
     DelayedErrorWindowRequest.DelayedErrorWindowRequestOnGUI();
     DebugInputLogger.InputLogOnGUI();
     if (!screenshotMode.FiltersCurrentEvent)
     {
         debugWindowOpener.DevToolStarterOnGUI();
     }
     windows.HandleEventsHighPriority();
     screenshotMode.ScreenshotModesOnGUI();
     if (!screenshotMode.FiltersCurrentEvent)
     {
         TooltipHandler.DoTooltipGUI();
         feedbackFloaters.FeedbackOnGUI();
         DragSliderManager.DragSlidersOnGUI();
         Messages.MessagesDoGUI();
     }
     shortcutKeys.ShortcutKeysOnGUI();
     NoiseDebugUI.NoiseDebugOnGUI();
     Debug.developerConsoleVisible = false;
     if (Current.Game != null)
     {
         GameComponentUtility.GameComponentOnGUI();
     }
 }
Example #2
0
 public void UpdatePlay()
 {
     Profiler.BeginSample("tickManager.TickManagerUpdate()");
     this.tickManager.TickManagerUpdate();
     Profiler.EndSample();
     Profiler.BeginSample("letterStack.LetterStackUpdate()");
     this.letterStack.LetterStackUpdate();
     Profiler.EndSample();
     Profiler.BeginSample("World.WorldUpdate()");
     this.World.WorldUpdate();
     Profiler.EndSample();
     Profiler.BeginSample("Map.MapUpdate()");
     for (int i = 0; i < this.maps.Count; i++)
     {
         Profiler.BeginSample("Map " + i);
         this.maps[i].MapUpdate();
         Profiler.EndSample();
     }
     Profiler.EndSample();
     Profiler.BeginSample("GameInfoUpdate()");
     this.Info.GameInfoUpdate();
     Profiler.EndSample();
     Profiler.BeginSample("GameComponentUpdate()");
     GameComponentUtility.GameComponentUpdate();
     Profiler.EndSample();
 }
Example #3
0
 public void FinalizeInit()
 {
     LogSimple.FlushToFileAndOpen();
     this.researchManager.ReapplyAllMods();
     MessagesRepeatAvoider.Reset();
     GameComponentUtility.FinalizeInit();
     Current.ProgramState = ProgramState.Playing;
 }
Example #4
0
 public void UpdatePlay()
 {
     this.tickManager.TickManagerUpdate();
     this.letterStack.LetterStackUpdate();
     this.World.WorldUpdate();
     for (int i = 0; i < this.maps.Count; i++)
     {
         this.maps[i].MapUpdate();
     }
     this.Info.GameInfoUpdate();
     GameComponentUtility.GameComponentUpdate();
 }
Example #5
0
 public void UpdatePlay()
 {
     tickManager.TickManagerUpdate();
     letterStack.LetterStackUpdate();
     World.WorldUpdate();
     for (int i = 0; i < maps.Count; i++)
     {
         maps[i].MapUpdate();
     }
     Info.GameInfoUpdate();
     GameComponentUtility.GameComponentUpdate();
     signalManager.SignalManagerUpdate();
 }
Example #6
0
        public void DoSingleTick()
        {
            List <Map> maps = Find.Maps;

            for (int i = 0; i < maps.Count; i++)
            {
                maps[i].MapPreTick();
            }
            if (!DebugSettings.fastEcology)
            {
                ticksGameInt++;
            }
            else
            {
                ticksGameInt += 2000;
            }
            Shader.SetGlobalFloat(ShaderPropertyIDs.GameSeconds, TicksGame.TicksToSeconds());
            tickListNormal.Tick();
            tickListRare.Tick();
            tickListLong.Tick();
            try
            {
                Find.DateNotifier.DateNotifierTick();
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }
            try
            {
                Find.Scenario.TickScenario();
            }
            catch (Exception ex2)
            {
                Log.Error(ex2.ToString());
            }
            try
            {
                Find.World.WorldTick();
            }
            catch (Exception ex3)
            {
                Log.Error(ex3.ToString());
            }
            try
            {
                Find.StoryWatcher.StoryWatcherTick();
            }
            catch (Exception ex4)
            {
                Log.Error(ex4.ToString());
            }
            try
            {
                Find.GameEnder.GameEndTick();
            }
            catch (Exception ex5)
            {
                Log.Error(ex5.ToString());
            }
            try
            {
                Find.Storyteller.StorytellerTick();
            }
            catch (Exception ex6)
            {
                Log.Error(ex6.ToString());
            }
            try
            {
                Current.Game.taleManager.TaleManagerTick();
            }
            catch (Exception ex7)
            {
                Log.Error(ex7.ToString());
            }
            try
            {
                Find.World.WorldPostTick();
            }
            catch (Exception ex8)
            {
                Log.Error(ex8.ToString());
            }
            for (int j = 0; j < maps.Count; j++)
            {
                maps[j].MapPostTick();
            }
            try
            {
                Find.History.HistoryTick();
            }
            catch (Exception ex9)
            {
                Log.Error(ex9.ToString());
            }
            GameComponentUtility.GameComponentTick();
            try
            {
                Find.LetterStack.LetterStackTick();
            }
            catch (Exception ex10)
            {
                Log.Error(ex10.ToString());
            }
            try
            {
                Find.Autosaver.AutosaverTick();
            }
            catch (Exception ex11)
            {
                Log.Error(ex11.ToString());
            }
            if (DebugViewSettings.logHourlyScreenshot && Find.TickManager.TicksGame >= lastAutoScreenshot + 2500)
            {
                ScreenshotTaker.QueueSilentScreenshot();
                lastAutoScreenshot = Find.TickManager.TicksGame / 2500 * 2500;
            }
            try
            {
                FilthMonitor.FilthMonitorTick();
            }
            catch (Exception ex12)
            {
                Log.Error(ex12.ToString());
            }
            UnityEngine.Debug.developerConsoleVisible = false;
        }
Example #7
0
        public void DoSingleTick()
        {
            List <Map> maps = Find.Maps;

            for (int i = 0; i < maps.Count; i++)
            {
                maps[i].MapPreTick();
            }
            if (!DebugSettings.fastEcology)
            {
                this.ticksGameInt++;
            }
            else
            {
                this.ticksGameInt += 250;
            }
            Shader.SetGlobalFloat(ShaderPropertyIDs.GameSeconds, this.TicksGame.TicksToSeconds());
            this.tickListNormal.Tick();
            this.tickListRare.Tick();
            this.tickListLong.Tick();
            try
            {
                Find.DateNotifier.DateNotifierTick();
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }
            try
            {
                Find.Scenario.TickScenario();
            }
            catch (Exception ex2)
            {
                Log.Error(ex2.ToString());
            }
            try
            {
                Find.World.WorldTick();
            }
            catch (Exception ex3)
            {
                Log.Error(ex3.ToString());
            }
            try
            {
                Find.StoryWatcher.StoryWatcherTick();
            }
            catch (Exception ex4)
            {
                Log.Error(ex4.ToString());
            }
            try
            {
                Find.GameEnder.GameEndTick();
            }
            catch (Exception ex5)
            {
                Log.Error(ex5.ToString());
            }
            try
            {
                Find.Storyteller.StorytellerTick();
            }
            catch (Exception ex6)
            {
                Log.Error(ex6.ToString());
            }
            try
            {
                Current.Game.taleManager.TaleManagerTick();
            }
            catch (Exception ex7)
            {
                Log.Error(ex7.ToString());
            }
            try
            {
                Find.World.WorldPostTick();
            }
            catch (Exception ex8)
            {
                Log.Error(ex8.ToString());
            }
            for (int j = 0; j < maps.Count; j++)
            {
                maps[j].MapPostTick();
            }
            try
            {
                Find.History.HistoryTick();
            }
            catch (Exception ex9)
            {
                Log.Error(ex9.ToString());
            }
            GameComponentUtility.GameComponentTick();
            try
            {
                Find.LetterStack.LetterStackTick();
            }
            catch (Exception ex10)
            {
                Log.Error(ex10.ToString());
            }
            try
            {
                Find.Autosaver.AutosaverTick();
            }
            catch (Exception ex11)
            {
                Log.Error(ex11.ToString());
            }
            Debug.developerConsoleVisible = false;
        }
Example #8
0
 public void UpdateEntry()
 {
     GameComponentUtility.GameComponentUpdate();
 }
Example #9
0
 public void LoadGame()
 {
     if (this.maps.Any <Map>())
     {
         Log.Error("Called LoadGame() but there already is a map. There should be 0 maps...", false);
         return;
     }
     MemoryUtility.UnloadUnusedUnityAssets();
     Current.ProgramState = ProgramState.MapInitializing;
     this.ExposeSmallComponents();
     LongEventHandler.SetCurrentEventText("LoadingWorld".Translate());
     if (Scribe.EnterNode("world"))
     {
         try
         {
             this.World = new World();
             this.World.ExposeData();
         }
         finally
         {
             Scribe.ExitNode();
         }
         this.World.FinalizeInit();
         LongEventHandler.SetCurrentEventText("LoadingMap".Translate());
         Scribe_Collections.Look <Map>(ref this.maps, "maps", LookMode.Deep, new object[0]);
         if (this.maps.RemoveAll((Map x) => x == null) != 0)
         {
             Log.Warning("Some maps were null after loading.", false);
         }
         int num = -1;
         Scribe_Values.Look <int>(ref num, "currentMapIndex", -1, false);
         if (num < 0 && this.maps.Any <Map>())
         {
             Log.Error("Current map is null after loading but there are maps available. Setting current map to [0].", false);
             num = 0;
         }
         if (num >= this.maps.Count)
         {
             Log.Error("Current map index out of bounds after loading.", false);
             if (this.maps.Any <Map>())
             {
                 num = 0;
             }
             else
             {
                 num = -1;
             }
         }
         this.currentMapIndex = -128;
         this.CurrentMap      = ((num < 0) ? null : this.maps[num]);
         LongEventHandler.SetCurrentEventText("InitializingGame".Translate());
         Find.CameraDriver.Expose();
         DeepProfiler.Start("FinalizeLoading");
         Scribe.loader.FinalizeLoading();
         DeepProfiler.End();
         LongEventHandler.SetCurrentEventText("SpawningAllThings".Translate());
         for (int i = 0; i < this.maps.Count; i++)
         {
             try
             {
                 this.maps[i].FinalizeLoading();
             }
             catch (Exception arg)
             {
                 Log.Error("Error in Map.FinalizeLoading(): " + arg, false);
             }
             try
             {
                 this.maps[i].Parent.FinalizeLoading();
             }
             catch (Exception arg2)
             {
                 Log.Error("Error in MapParent.FinalizeLoading(): " + arg2, false);
             }
         }
         this.FinalizeInit();
         if (Prefs.PauseOnLoad)
         {
             LongEventHandler.ExecuteWhenFinished(delegate
             {
                 Find.TickManager.DoSingleTick();
                 Find.TickManager.CurTimeSpeed = TimeSpeed.Paused;
             });
         }
         GameComponentUtility.LoadedGame();
         return;
     }
     Log.Error("Could not find world XML node.", false);
 }
Example #10
0
        public void InitNewGame()
        {
            string str = (from mod in LoadedModManager.RunningMods
                          select mod.ToString()).ToCommaList(false);

            Log.Message("Initializing new game with mods " + str, false);
            if (this.maps.Any <Map>())
            {
                Log.Error("Called InitNewGame() but there already is a map. There should be 0 maps...", false);
                return;
            }
            if (this.initData == null)
            {
                Log.Error("Called InitNewGame() but init data is null. Create it first.", false);
                return;
            }
            MemoryUtility.UnloadUnusedUnityAssets();
            DeepProfiler.Start("InitNewGame");
            try
            {
                Current.ProgramState = ProgramState.MapInitializing;
                IntVec3           intVec      = new IntVec3(this.initData.mapSize, 1, this.initData.mapSize);
                Settlement        settlement  = null;
                List <Settlement> settlements = Find.WorldObjects.Settlements;
                for (int i = 0; i < settlements.Count; i++)
                {
                    if (settlements[i].Faction == Faction.OfPlayer)
                    {
                        settlement = settlements[i];
                        break;
                    }
                }
                if (settlement == null)
                {
                    Log.Error("Could not generate starting map because there is no any player faction base.", false);
                }
                this.tickManager.gameStartAbsTick = GenTicks.ConfiguredTicksAbsAtGameStart;
                Map currentMap = MapGenerator.GenerateMap(intVec, settlement, settlement.MapGeneratorDef, settlement.ExtraGenStepDefs, null);
                this.worldInt.info.initialMapSize = intVec;
                if (this.initData.permadeath)
                {
                    this.info.permadeathMode           = true;
                    this.info.permadeathModeUniqueName = PermadeathModeUtility.GeneratePermadeathSaveName();
                }
                PawnUtility.GiveAllStartingPlayerPawnsThought(ThoughtDefOf.NewColonyOptimism);
                this.FinalizeInit();
                Current.Game.CurrentMap = currentMap;
                Find.CameraDriver.JumpToCurrentMapLoc(MapGenerator.PlayerStartSpot);
                Find.CameraDriver.ResetSize();
                if (Prefs.PauseOnLoad && this.initData.startedFromEntry)
                {
                    LongEventHandler.ExecuteWhenFinished(delegate
                    {
                        this.tickManager.DoSingleTick();
                        this.tickManager.CurTimeSpeed = TimeSpeed.Paused;
                    });
                }
                Find.Scenario.PostGameStart();
                if (Faction.OfPlayer.def.startingResearchTags != null)
                {
                    foreach (ResearchProjectTagDef current in Faction.OfPlayer.def.startingResearchTags)
                    {
                        foreach (ResearchProjectDef current2 in DefDatabase <ResearchProjectDef> .AllDefs)
                        {
                            if (current2.HasTag(current))
                            {
                                this.researchManager.FinishProject(current2, false, null);
                            }
                        }
                    }
                }
                GameComponentUtility.StartedNewGame();
                this.initData = null;
            }
            finally
            {
                DeepProfiler.End();
            }
        }
Example #11
0
 public void LoadGame()
 {
     if (maps.Any())
     {
         Log.Error("Called LoadGame() but there already is a map. There should be 0 maps...");
     }
     else
     {
         MemoryUtility.UnloadUnusedUnityAssets();
         Current.ProgramState = ProgramState.MapInitializing;
         ExposeSmallComponents();
         LongEventHandler.SetCurrentEventText("LoadingWorld".Translate());
         if (!Scribe.EnterNode("world"))
         {
             Log.Error("Could not find world XML node.");
         }
         else
         {
             try
             {
                 World = new World();
                 World.ExposeData();
             }
             finally
             {
                 Scribe.ExitNode();
             }
             World.FinalizeInit();
             LongEventHandler.SetCurrentEventText("LoadingMap".Translate());
             Scribe_Collections.Look(ref maps, "maps", LookMode.Deep);
             if (maps.RemoveAll((Map x) => x == null) != 0)
             {
                 Log.Warning("Some maps were null after loading.");
             }
             int value = -1;
             Scribe_Values.Look(ref value, "currentMapIndex", -1);
             if (value < 0 && maps.Any())
             {
                 Log.Error("Current map is null after loading but there are maps available. Setting current map to [0].");
                 value = 0;
             }
             if (value >= maps.Count)
             {
                 Log.Error("Current map index out of bounds after loading.");
                 value = ((!maps.Any()) ? (-1) : 0);
             }
             currentMapIndex = sbyte.MinValue;
             CurrentMap      = ((value < 0) ? null : maps[value]);
             LongEventHandler.SetCurrentEventText("InitializingGame".Translate());
             Find.CameraDriver.Expose();
             DeepProfiler.Start("FinalizeLoading");
             Scribe.loader.FinalizeLoading();
             DeepProfiler.End();
             LongEventHandler.SetCurrentEventText("SpawningAllThings".Translate());
             for (int i = 0; i < maps.Count; i++)
             {
                 try
                 {
                     maps[i].FinalizeLoading();
                 }
                 catch (Exception arg)
                 {
                     Log.Error("Error in Map.FinalizeLoading(): " + arg);
                 }
                 try
                 {
                     maps[i].Parent.FinalizeLoading();
                 }
                 catch (Exception arg2)
                 {
                     Log.Error("Error in MapParent.FinalizeLoading(): " + arg2);
                 }
             }
             FinalizeInit();
             if (Prefs.PauseOnLoad)
             {
                 LongEventHandler.ExecuteWhenFinished(delegate
                 {
                     Find.TickManager.DoSingleTick();
                     Find.TickManager.CurTimeSpeed = TimeSpeed.Paused;
                 });
             }
             GameComponentUtility.LoadedGame();
         }
     }
 }
Example #12
0
        public void InitNewGame()
        {
            string str = LoadedModManager.RunningMods.Select((ModContentPack mod) => mod.PackageIdPlayerFacing).ToLineList("  - ");

            Log.Message("Initializing new game with mods:\n" + str);
            if (maps.Any())
            {
                Log.Error("Called InitNewGame() but there already is a map. There should be 0 maps...");
                return;
            }
            if (initData == null)
            {
                Log.Error("Called InitNewGame() but init data is null. Create it first.");
                return;
            }
            MemoryUtility.UnloadUnusedUnityAssets();
            DeepProfiler.Start("InitNewGame");
            try
            {
                //InitMap
                Current.ProgramState = ProgramState.MapInitializing;
                IntVec3           intVec      = new IntVec3(initData.mapSize, 1, initData.mapSize);
                Settlement        settlement  = null;
                List <Settlement> settlements = Find.WorldObjects.Settlements;
                for (int i = 0; i < settlements.Count; i++)
                {
                    if (settlements[i].Faction == Faction.OfPlayer)
                    {
                        settlement = settlements[i];
                        break;
                    }
                }
                if (settlement == null)
                {
                    Log.Error("Could not generate starting map because there is no any player faction base.");
                }
                tickManager.gameStartAbsTick = GenTicks.ConfiguredTicksAbsAtGameStart;

                //--------------
                //Map currentMap=Map

                //Map currentMap = MapGenerator.GenerateMap(intVec, settlement, settlement.MapGeneratorDef, settlement.ExtraGenStepDefs);

                //Map currentMap=MapGenerator.GenerateMap(intVec,settlement,settlement.MapGeneratorDef,settlement.ExtraGenStepDefs)

                Map currentMap = MapGenerator.GenerateMap(intVec, settlement, settlement.MapGeneratorDef, settlement.ExtraGenStepDefs);
                worldInt.info.initialMapSize = intVec;
                if (initData.permadeath)
                {
                    info.permadeathMode           = true;
                    info.permadeathModeUniqueName = PermadeathModeUtility.GeneratePermadeathSaveName();
                }
                PawnUtility.GiveAllStartingPlayerPawnsThought(ThoughtDefOf.NewColonyOptimism);
                FinalizeInit();
                Current.Game.CurrentMap = currentMap;
                Find.CameraDriver.JumpToCurrentMapLoc(MapGenerator.PlayerStartSpot);
                Find.CameraDriver.ResetSize();
                if (Prefs.PauseOnLoad && initData.startedFromEntry)
                {
                    LongEventHandler.ExecuteWhenFinished(delegate
                    {
                        tickManager.DoSingleTick();
                        tickManager.CurTimeSpeed = TimeSpeed.Paused;
                    });
                }

                //--------------end
                Find.Scenario.PostGameStart();
                if (Faction.OfPlayer.def.startingResearchTags != null)
                {
                    foreach (ResearchProjectTagDef startingResearchTag in Faction.OfPlayer.def.startingResearchTags)
                    {
                        foreach (ResearchProjectDef allDef in DefDatabase <ResearchProjectDef> .AllDefs)
                        {
                            if (allDef.HasTag(startingResearchTag))
                            {
                                researchManager.FinishProject(allDef);
                            }
                        }
                    }
                }
                if (Faction.OfPlayer.def.startingTechprintsResearchTags != null)
                {
                    foreach (ResearchProjectTagDef startingTechprintsResearchTag in Faction.OfPlayer.def.startingTechprintsResearchTags)
                    {
                        foreach (ResearchProjectDef allDef2 in DefDatabase <ResearchProjectDef> .AllDefs)
                        {
                            if (allDef2.HasTag(startingTechprintsResearchTag))
                            {
                                int techprints = researchManager.GetTechprints(allDef2);
                                if (techprints < allDef2.techprintCount)
                                {
                                    researchManager.AddTechprints(allDef2, allDef2.techprintCount - techprints);
                                }
                            }
                        }
                    }
                }
                GameComponentUtility.StartedNewGame();
                initData = null;
            }
            finally
            {
                DeepProfiler.End();
            }
        }
Example #13
0
 public void LoadGame()
 {
     if (this.maps.Any())
     {
         Log.Error("Called LoadGame() but there already is a map. There should be 0 maps...");
     }
     else
     {
         MemoryUtility.UnloadUnusedUnityAssets();
         Current.ProgramState = ProgramState.MapInitializing;
         this.ExposeSmallComponents();
         BackCompatibility.AfterLoadingSmallGameClassComponents(this);
         LongEventHandler.SetCurrentEventText("LoadingWorld".Translate());
         if (Scribe.EnterNode("world"))
         {
             try
             {
                 this.World = new World();
                 this.World.ExposeData();
             }
             finally
             {
                 Scribe.ExitNode();
             }
             this.World.FinalizeInit();
             LongEventHandler.SetCurrentEventText("LoadingMap".Translate());
             Scribe_Collections.Look <Map>(ref this.maps, "maps", LookMode.Deep, new object[0]);
             int num = -1;
             Scribe_Values.Look(ref num, "visibleMapIndex", -1, false);
             if (num < 0 && this.maps.Any())
             {
                 Log.Error("Visible map is null after loading but there are maps available. Setting visible map to [0].");
                 num = 0;
             }
             if (num >= this.maps.Count)
             {
                 Log.Error("Visible map index out of bounds after loading.");
                 num = ((!this.maps.Any()) ? (-1) : 0);
             }
             this.visibleMapIndex = -128;
             this.VisibleMap      = ((num < 0) ? null : this.maps[num]);
             LongEventHandler.SetCurrentEventText("InitializingGame".Translate());
             Find.CameraDriver.Expose();
             DeepProfiler.Start("FinalizeLoading");
             Scribe.loader.FinalizeLoading();
             DeepProfiler.End();
             LongEventHandler.SetCurrentEventText("SpawningAllThings".Translate());
             for (int i = 0; i < this.maps.Count; i++)
             {
                 this.maps[i].FinalizeLoading();
             }
             this.FinalizeInit();
             if (Prefs.PauseOnLoad)
             {
                 LongEventHandler.ExecuteWhenFinished(delegate
                 {
                     Find.TickManager.DoSingleTick();
                     Find.TickManager.CurTimeSpeed = TimeSpeed.Paused;
                 });
             }
             GameComponentUtility.LoadedGame();
         }
         else
         {
             Log.Error("Could not find world XML node.");
         }
     }
 }
Example #14
0
        public void InitNewGame()
        {
            string str = GenText.ToCommaList(from mod in LoadedModManager.RunningMods
                                             select mod.ToString(), true);

            Log.Message("Initializing new game with mods " + str);
            if (this.maps.Any())
            {
                Log.Error("Called InitNewGame() but there already is a map. There should be 0 maps...");
            }
            else if (this.initData == null)
            {
                Log.Error("Called InitNewGame() but init data is null. Create it first.");
            }
            else
            {
                MemoryUtility.UnloadUnusedUnityAssets();
                DeepProfiler.Start("InitNewGame");
                try
                {
                    Current.ProgramState = ProgramState.MapInitializing;
                    IntVec3            intVec       = new IntVec3(this.initData.mapSize, 1, this.initData.mapSize);
                    FactionBase        factionBase  = null;
                    List <FactionBase> factionBases = Find.WorldObjects.FactionBases;
                    int num = 0;
                    while (num < factionBases.Count)
                    {
                        if (factionBases[num].Faction != Faction.OfPlayer)
                        {
                            num++;
                            continue;
                        }
                        factionBase = factionBases[num];
                        break;
                    }
                    if (factionBase == null)
                    {
                        Log.Error("Could not generate starting map because there is no any player faction base.");
                    }
                    this.tickManager.gameStartAbsTick = GenTicks.ConfiguredTicksAbsAtGameStart;
                    Map visibleMap = MapGenerator.GenerateMap(intVec, factionBase, factionBase.MapGeneratorDef, factionBase.ExtraGenStepDefs, null);
                    this.worldInt.info.initialMapSize = intVec;
                    if (this.initData.permadeath)
                    {
                        this.info.permadeathMode           = true;
                        this.info.permadeathModeUniqueName = PermadeathModeUtility.GeneratePermadeathSaveName();
                    }
                    PawnUtility.GiveAllStartingPlayerPawnsThought(ThoughtDefOf.NewColonyOptimism);
                    this.FinalizeInit();
                    Current.Game.VisibleMap = visibleMap;
                    Find.CameraDriver.JumpToVisibleMapLoc(MapGenerator.PlayerStartSpot);
                    Find.CameraDriver.ResetSize();
                    if (Prefs.PauseOnLoad && this.initData.startedFromEntry)
                    {
                        LongEventHandler.ExecuteWhenFinished(delegate
                        {
                            this.tickManager.DoSingleTick();
                            this.tickManager.CurTimeSpeed = TimeSpeed.Paused;
                        });
                    }
                    Find.Scenario.PostGameStart();
                    if (Faction.OfPlayer.def.startingResearchTags != null)
                    {
                        foreach (string startingResearchTag in Faction.OfPlayer.def.startingResearchTags)
                        {
                            foreach (ResearchProjectDef allDef in DefDatabase <ResearchProjectDef> .AllDefs)
                            {
                                if (allDef.HasTag(startingResearchTag))
                                {
                                    this.researchManager.InstantFinish(allDef, false);
                                }
                            }
                        }
                    }
                    GameComponentUtility.StartedNewGame();
                    this.initData = null;
                }
                finally
                {
                    DeepProfiler.End();
                }
            }
        }