public override bool Update(bool hasFocus) { if (!hasFocus) { return(base.Update(hasFocus)); } if (m_childScreenLaunched && hasFocus) { CloseScreenNow(); } if (m_childScreenLaunched) { return(base.Update(hasFocus)); } if (MyInput.Static.IsKeyPress(MyKeys.Escape)) { MyGuiScreenMainMenu.ReturnToMainMenu(); return(base.Update(hasFocus)); } switch (m_quickLaunchType) { case MyQuickLaunchType.LAST_SANDBOX: { var lastSessionPath = MyLocalCache.GetLastSessionPath(); if (lastSessionPath != null && System.IO.Directory.Exists(lastSessionPath)) { MyGuiScreenLoadSandbox.LoadSingleplayerSession(lastSessionPath); } else { MySandboxGame.AfterLogos(); } m_childScreenLaunched = true; } break; case MyQuickLaunchType.NEW_SANDBOX: { MyGuiScreenStartSandbox.QuickstartSandbox(null); m_childScreenLaunched = true; } break; default: { throw new InvalidBranchException(); } } return(base.Update(hasFocus)); }
private void OnSuccess(string sessionPath) { if (m_currentButton == m_copyButton) { var loadScreen = new MyGuiScreenLoadSandbox(); MyGuiSandbox.AddScreen(new MyGuiScreenLoadSandbox()); loadScreen.SelectSteamWorld(sessionPath); } else if (m_currentButton == m_loadButton) { MyGuiScreenLoadSandbox.LoadSingleplayerSession(sessionPath); } m_currentButton = null; }
public void ShowLoadMessageBox(string currentSession) { var messageBox = MyGuiSandbox.CreateMessageBox( buttonType : MyMessageBoxButtonsType.YES_NO, messageText : MyTexts.Get(MySpaceTexts.MessageBoxTextAreYouSureYouWantToQuickLoad), messageCaption : MyTexts.Get(MySpaceTexts.MessageBoxCaptionPleaseConfirm), callback : delegate(MyGuiScreenMessageBox.ResultEnum callbackReturn) { if (callbackReturn == MyGuiScreenMessageBox.ResultEnum.YES) { MyGuiScreenLoadSandbox.LoadSingleplayerSession(currentSession); } }); messageBox.SkipTransition = true; messageBox.CloseBeforeCallback = true; MyGuiSandbox.AddScreen(messageBox); }
private void OnEditButtonClick(object sender) { //run as normal save var row = m_scenarioTable.SelectedRow; if (row != null) { var save = FindSave(row); if (save != null) { CloseScreen(); MyGuiScreenLoadSandbox.LoadSingleplayerSession(save.Item1); } else { Debug.Fail("save not found"); } } else { Debug.Fail("row not found"); } }
private void CreateAndLoadFromSubscribedWorld() { var selectedRow = m_worldsTable.SelectedRow; if (selectedRow == null) { return; } var world = (MySteamWorkshop.SubscribedItem)selectedRow.UserData; if (world == null) { return; } MySteamWorkshop.CreateWorldInstanceAsync(world, MySteamWorkshop.MyWorkshopPathInfo.CreateWorldInfo(), false, delegate(bool success, string sessionPath) { if (success) { MyGuiScreenLoadSandbox.LoadSingleplayerSession(sessionPath); } }); }
public override bool Update(bool hasFocus) { if (!hasFocus) { return(base.Update(hasFocus)); } if (m_childScreenLaunched && hasFocus) { CloseScreenNow(); } if (m_childScreenLaunched) { return(base.Update(hasFocus)); } if (MyInput.Static.IsKeyPress(MyKeys.Escape)) { MyGuiScreenMainMenu.ReturnToMainMenu(); return(base.Update(hasFocus)); } switch (m_quickLaunchType) { case MyQuickLaunchType.LAST_SANDBOX: { var lastSessionPath = MyLocalCache.GetLastSessionPath(); if (lastSessionPath != null && System.IO.Directory.Exists(lastSessionPath)) { MyGuiScreenLoadSandbox.LoadSingleplayerSession(lastSessionPath); } else { MySandboxGame.AfterLogos(); } m_childScreenLaunched = true; } break; case MyQuickLaunchType.NEW_SANDBOX: { MyGuiScreenStartSandbox.QuickstartSandbox(null, null); m_childScreenLaunched = true; } break; case MyQuickLaunchType.SCENARIO_QUICKSTART: { MyGuiScreenStartSandbox.QuickstartSandbox(new MyObjectBuilder_MedievalSessionSettings() { EnableBarbarians = true, MaximumBots = 10000 }, new World.MyWorldGenerator.Args() { Scenario = (MyScenarioDefinition)MyDefinitionManager.Static.GetScenarioDefinition(new MyDefinitionId(typeof(MyObjectBuilder_ScenarioDefinition), "Quickstart")) }); m_childScreenLaunched = true; } break; default: { throw new InvalidBranchException(); } } return(base.Update(hasFocus)); }