Example #1
0
 protected void LoadInitialScreens()
 {
     if (Settings.ForceEnglish)
     {
         LocaleActivator.ActivateLocale(Settings.ActiveLocale, this.Content);
     }
     if (Game1.AutoLoadExtensionPath != null)
     {
         ExtensionLoader.ActiveExtensionInfo = ExtensionInfo.ReadExtensionInfo(Game1.AutoLoadExtensionPath);
         SaveFileManager.Init(true);
         SaveFileManager.DeleteUser("test");
         MainMenu.CreateNewAccountForExtensionAndStart("test", "test", this.sman, (GameScreen)null, (ExtensionsMenuScreen)null);
     }
     else if (Settings.MenuStartup)
     {
         this.sman.AddScreen((GameScreen) new MainMenu(), new PlayerIndex?(this.sman.controllingPlayer));
     }
     else
     {
         this.sman.AddScreen((GameScreen) new OS(), new PlayerIndex?(this.sman.controllingPlayer));
     }
 }
Example #2
0
 private void HookUpCreationEvents()
 {
     this.loginScreen.RequestGoBack += (Action)(() => this.State = MainMenu.MainMenuState.Normal);
     this.loginScreen.StartNewGameForUsernameAndPass += (Action <string, string>)((username, pass) =>
     {
         if (SaveFileManager.AddUser(username, pass))
         {
             string filePathForLogin = SaveFileManager.GetFilePathForLogin(username, pass);
             this.ExitScreen();
             MainMenu.resetOS();
             if (!Settings.soundDisabled)
             {
                 this.ScreenManager.playAlertSound();
             }
             try
             {
                 OS os = new OS();
                 os.SaveGameUserName    = filePathForLogin;
                 os.SaveUserAccountName = username;
                 if (this.NextStartedGameShouldBeDLCAccelerated)
                 {
                     os.IsDLCConventionDemo = true;
                     os.Flags.AddFlag("TutorialComplete");
                     Settings.EnableDLC         = true;
                     Settings.initShowsTutorial = false;
                     os.initShowsTutorial       = false;
                 }
                 this.ScreenManager.AddScreen((GameScreen)os, new PlayerIndex?(this.ScreenManager.controllingPlayer));
                 os.Flags.AddFlag("startVer:" + MainMenu.OSVersion);
                 if (!this.NextStartedGameShouldBeDLCAccelerated)
                 {
                     return;
                 }
                 SessionAccelerator.AccelerateSessionToDLCStart((object)os);
                 os.delayer.Post(ActionDelayer.Wait(0.15), (Action)(() => Game1.getSingleton().IsMouseVisible = true));
                 this.NextStartedGameShouldBeDLCAccelerated = false;
             }
             catch (Exception ex)
             {
                 this.UpdateUIForSaveCreationFailed(ex);
             }
         }
         else
         {
             this.loginScreen.ResetForNewAccount();
             this.loginScreen.WriteToHistory(" ERROR: Username invalid or already in use.");
         }
     });
     this.loginScreen.LoadGameForUserFileAndUsername += (Action <string, string>)((userFile, username) =>
     {
         this.ExitScreen();
         MainMenu.resetOS();
         if (SaveFileManager.StorageMethods[0].FileExists(userFile))
         {
             OS.WillLoadSave = true;
             OS os = new OS();
             os.SaveGameUserName    = userFile;
             os.SaveUserAccountName = username;
             try
             {
                 this.ScreenManager.AddScreen((GameScreen)os, new PlayerIndex?(this.ScreenManager.controllingPlayer));
             }
             catch (XmlException ex)
             {
                 this.UpdateUIForSaveCorruption(userFile, (Exception)ex);
             }
             catch (FormatException ex)
             {
                 this.UpdateUIForSaveCorruption(userFile, (Exception)ex);
             }
             catch (NullReferenceException ex)
             {
                 this.UpdateUIForSaveCorruption(userFile, (Exception)ex);
             }
             catch (FileNotFoundException ex)
             {
                 this.UpdateUIForSaveMissing(userFile, (Exception)ex);
             }
             catch (ContentLoadException ex1)
             {
                 string str = Utils.ReadEntireContentsOfStream(SaveFileManager.StorageMethods[0].GetFileReadStream(userFile));
                 if (str.Contains("DigiPets"))
                 {
                     string data = str.Replace("DigiPets", "Neopals").Replace("DigiPoints", "Neopoints");
                     for (int index = 0; index < 3; ++index)
                     {
                         try
                         {
                             Thread.Sleep(200);
                             SaveFileManager.StorageMethods[0].WriteFileData(userFile, data);
                             break;
                         }
                         catch (IOException ex2)
                         {
                         }
                         Thread.Sleep(500);
                     }
                     MainMenu.AccumErrors = "-- Savefile Automatically Upgraded - Try again! --";
                 }
                 else
                 {
                     this.UpdateUIForSaveCorruption(userFile, (Exception)ex1);
                 }
             }
         }
         else
         {
             OS.WillLoadSave = false;
             this.UpdateUIForSaveMissing(userFile, (Exception) new FileNotFoundException());
         }
     });
     this.attractModeScreen.Start += (Action)(() =>
     {
         try
         {
             this.ExitScreen();
             MainMenu.resetOS();
             if (!Settings.soundDisabled)
             {
                 this.ScreenManager.playAlertSound();
             }
             this.ScreenManager.AddScreen((GameScreen) new OS(), new PlayerIndex?(this.ScreenManager.controllingPlayer));
         }
         catch (Exception ex)
         {
             Utils.writeToFile("OS Load Error: " + ex.ToString() + "\n\n" + ex.StackTrace, "crashLog.txt");
         }
     });
     this.attractModeScreen.StartDLC += (Action)(() =>
     {
         try
         {
             this.ExitScreen();
             MainMenu.resetOS();
             Settings.EnableDLC = true;
             Settings.initShowsTutorial = false;
             if (!Settings.soundDisabled)
             {
                 this.ScreenManager.playAlertSound();
             }
             OS os = new OS();
             os.IsDLCConventionDemo = true;
             os.Flags.AddFlag("TutorialComplete");
             os.SaveGameUserName = "******" + Settings.ConventionLoginName + ".xml";
             os.SaveUserAccountName = Settings.ConventionLoginName;
             this.ScreenManager.AddScreen((GameScreen)os, new PlayerIndex?(this.ScreenManager.controllingPlayer));
             os.allFactions.setCurrentFaction("Bibliotheque", os);
             ThemeManager.setThemeOnComputer((object)os.thisComputer, "DLC/Themes/RiptideClassicTheme.xml");
             ThemeManager.switchTheme((object)os, "DLC/Themes/RiptideClassicTheme.xml");
             for (int index1 = 0; index1 < 60; ++index1)
             {
                 int index2;
                 do
                 {
                     index2 = Utils.random.Next(os.netMap.nodes.Count);
                 }while (os.netMap.nodes[index2].idName == "mainHub" || os.netMap.nodes[index2].idName == "entropy00" || os.netMap.nodes[index2].idName == "entropy01");
                 os.netMap.discoverNode(os.netMap.nodes[index2]);
             }
             os.delayer.Post(ActionDelayer.Wait(0.15), (Action)(() =>
             {
                 Game1.getSingleton().IsMouseVisible = true;
                 os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[22], "SSHCrack.exe"));
                 os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[21], "FTPBounce.exe"));
                 MissionFunctions.runCommand(7, "changeSong");
                 MusicManager.stop();
             }));
             os.delayer.Post(ActionDelayer.Wait(38.0), (Action)(() => ComputerLoader.loadMission("Content/DLC/Missions/Demo/DLCDemointroMission1.xml", false)));
         }
         catch (Exception ex)
         {
             Utils.writeToFile("OS Load Error: " + ex.ToString() + "\n\n" + ex.StackTrace, "crashLog.txt");
         }
     });
     this.extensionsScreen.ExitClicked += (Action)(() => this.State = MainMenu.MainMenuState.Normal);
     this.extensionsScreen.CreateNewAccountForExtension_UserAndPass += (Action <string, string>)((user, pass) => MainMenu.CreateNewAccountForExtensionAndStart(user, pass, this.ScreenManager, (GameScreen)this, this.extensionsScreen));
     this.extensionsScreen.LoadAccountForExtension_FileAndUsername  += (Action <string, string>)((userFile, username) =>
     {
         this.ExitScreen();
         MainMenu.resetOS();
         Settings.IsInExtensionMode = true;
         OS.WillLoadSave            = SaveFileManager.StorageMethods[0].FileExists(userFile);
         this.ScreenManager.AddScreen((GameScreen) new OS()
         {
             SaveGameUserName    = userFile,
             SaveUserAccountName = username
         }, new PlayerIndex?(this.ScreenManager.controllingPlayer));
     });
 }