Ejemplo n.º 1
0
 private static void CheckGlobalInit()
 {
     if (Root.globalInitDone)
     {
         return;
     }
     UnityDataInitializer.CopyUnityData();
     SteamManager.InitIfNeeded();
     string[] commandLineArgs = Environment.GetCommandLineArgs();
     if (commandLineArgs != null && commandLineArgs.Length > 1)
     {
         Log.Message("Command line arguments: " + GenText.ToSpaceList(commandLineArgs.Skip(1)), false);
     }
     VersionControl.LogVersionNumber();
     Application.targetFrameRate = 60;
     Prefs.Init();
     if (Prefs.DevMode)
     {
         StaticConstructorOnStartupUtility.ReportProbablyMissingAttributes();
     }
     LongEventHandler.QueueLongEvent(new Action(StaticConstructorOnStartupUtility.CallAll), null, false, null);
     Root.globalInitDone = true;
 }
Ejemplo n.º 2
0
 private static void CheckGlobalInit()
 {
     if (!globalInitDone)
     {
         string[] commandLineArgs = Environment.GetCommandLineArgs();
         if (commandLineArgs != null && commandLineArgs.Length > 1)
         {
             Log.Message("Command line arguments: " + GenText.ToSpaceList(commandLineArgs.Skip(1)));
         }
         PerformanceReporting.enabled = false;
         Application.targetFrameRate  = 60;
         UnityDataInitializer.CopyUnityData();
         SteamManager.InitIfNeeded();
         VersionControl.LogVersionNumber();
         Prefs.Init();
         if (Prefs.DevMode)
         {
             StaticConstructorOnStartupUtility.ReportProbablyMissingAttributes();
         }
         LongEventHandler.QueueLongEvent(StaticConstructorOnStartupUtility.CallAll, null, doAsynchronously: false, null);
         globalInitDone = true;
     }
 }
Ejemplo n.º 3
0
        public virtual void Start()
        {
            Current.Notify_LoadedSceneChanged();
            Root.CheckGlobalInit();
            Action action = delegate
            {
                this.soundRoot = new SoundRoot();
                if (GenScene.InPlayScene)
                {
                    this.uiRoot = new UIRoot_Play();
                }
                else if (GenScene.InEntryScene)
                {
                    this.uiRoot = new UIRoot_Entry();
                }
                this.uiRoot.Init();
                Messages.Notify_LoadedLevelChanged();
                if (Current.SubcameraDriver != null)
                {
                    Current.SubcameraDriver.Init();
                }
            };

            if (!PlayDataLoader.Loaded)
            {
                LongEventHandler.QueueLongEvent(delegate
                {
                    PlayDataLoader.LoadAllPlayData(false);
                }, null, true, null);
                LongEventHandler.QueueLongEvent(action, "InitializingInterface", false, null);
            }
            else
            {
                action();
            }
        }
Ejemplo n.º 4
0
        public static void CleanupTranslationFiles()
        {
            LoadedLanguage curLang = LanguageDatabase.activeLanguage;
            LoadedLanguage english = LanguageDatabase.defaultLanguage;

            if (curLang != english)
            {
                IEnumerable <ModMetaData> activeModsInLoadOrder = ModsConfig.ActiveModsInLoadOrder;
                if (activeModsInLoadOrder.Count() != 1 || !activeModsInLoadOrder.First().IsCoreMod)
                {
                    Messages.Message("MessageDisableModsBeforeCleaningTranslationFiles".Translate(), MessageTypeDefOf.RejectInput, historical: false);
                }
                else
                {
                    LongEventHandler.QueueLongEvent(delegate
                    {
                        if (curLang.anyKeyedReplacementsXmlParseError || curLang.anyDefInjectionsXmlParseError)
                        {
                            string value = curLang.lastKeyedReplacementsXmlParseErrorInFile ?? curLang.lastDefInjectionsXmlParseErrorInFile;
                            Messages.Message("MessageCantCleanupTranslationFilesBeucaseOfXmlError".Translate(value), MessageTypeDefOf.RejectInput, historical: false);
                        }
                        else
                        {
                            english.LoadData();
                            curLang.LoadData();
                            Dialog_MessageBox dialog_MessageBox = Dialog_MessageBox.CreateConfirmation("ConfirmCleanupTranslationFiles".Translate(curLang.FriendlyNameNative), delegate
                            {
                                LongEventHandler.QueueLongEvent(DoCleanupTranslationFiles, "CleaningTranslationFiles".Translate(), doAsynchronously: true, null);
                            }, destructive: true);
                            dialog_MessageBox.buttonAText = "ConfirmCleanupTranslationFiles_Confirm".Translate();
                            Find.WindowStack.Add(dialog_MessageBox);
                        }
                    }, null, doAsynchronously: false, null);
                }
            }
        }
Ejemplo n.º 5
0
 public static void InfectionSimulator()
 {
     LongEventHandler.QueueLongEvent(DebugOutputsInfection.InfectionSimulatorWorker(), "Simulating . . .", null);
 }
Ejemplo n.º 6
0
 public static void InfectionSimulator()
 {
     LongEventHandler.QueueLongEvent(InfectionSimulatorWorker(), "Simulating . . .");
 }
Ejemplo n.º 7
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);
     }
 }