コード例 #1
0
ファイル: Root_Play.cs プロジェクト: KraigXu/GameProject
 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);
     }
 }
コード例 #2
0
ファイル: Root_Entry.cs プロジェクト: KraigXu/GameProject
 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);
     }
 }
コード例 #3
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);
     }
 }