private void ShowRetryDialog(string message = null, string caption = null) { var messageBoxMessage = MyTextsWrapper.Get(MyTextsWrapperEnum.CantSaveSectorFailed); var messageBoxCaption = MyTextsWrapper.Get(MyTextsWrapperEnum.MessageBoxCaptionError); if (m_pause) { if (!MinerWars.AppCode.App.MyMinerGame.IsPaused()) { MinerWars.AppCode.App.MyMinerGame.SwitchPause(); } } Vector2 buttonSize = new Vector2(MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.X * 2.4f, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y); var messageBoxScreen = new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyMessageBoxButtonsType.YES_NO, messageBoxMessage, messageBoxCaption, null, MyTextsWrapperEnum.ButtonRetry, MyTextsWrapperEnum.ButtonContinueWithoutSaving, MessageBoxCallback, false, buttonSize); MyGuiManager.AddScreen(messageBoxScreen); }
void OnJoiningCancelOrTimeout(object sender, WaitingCanceledArgs waitingCanceledArgs) { MyMultiplayerPeers.Static.Shutdown(); switch (waitingCanceledArgs.CancelReason) { case CancelReasonEnum.UserCancel: // do nothing break; case CancelReasonEnum.Timeout: MyGuiScreenMessageBox.Show(MyTextsWrapperEnum.JoinGameTimeout, MyTextsWrapperEnum.JoinGame, MyMessageBoxType.ERROR); break; default: throw new ArgumentOutOfRangeException(); } GetDataFromServer(true); }
public static void OnExitToMainMenuMessageBoxCallback(MyGuiScreenMessageBoxCallbackEnum callbackReturn) { if (callbackReturn == MyGuiScreenMessageBoxCallbackEnum.YES) { // No mission active...ask whether save or not if (MySession.Static != null && MyMissions.ActiveMission == null && MyGuiScreenGamePlay.Static.IsGameStoryActive() && MyClientServer.LoggedPlayer.GetCanSave()) { var messageBox = new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.SaveCurrentProgress, MyTextsWrapperEnum.SaveCurrentProgressCaption, MyTextsWrapperEnum.Yes, MyTextsWrapperEnum.No, OnSaveGameResponse); messageBox.SkipTransition = true; messageBox.InstantClose = false; MyGuiManager.AddScreen(messageBox); } else { UnloadAndExitToMenu(); } } else { MyGuiManager.GetMainMenuScreen().m_screenCanHide = true; } }
public static void OnExitToMainMenuClick(MyGuiControlButton sender) { MyGuiManager.GetMainMenuScreen().m_screenCanHide = false; var messageBox = new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.AreYouSureYouWantToExit, MyTextsWrapperEnum.MessageBoxExitQuestion, MyTextsWrapperEnum.Yes, MyTextsWrapperEnum.No, OnExitToMainMenuMessageBoxCallback); messageBox.SkipTransition = true; messageBox.InstantClose = false; MyGuiManager.AddScreen(messageBox); }
private void ShowRetryDialog(string message = null, string caption = null) { var messageBoxMessage = MyTextsWrapper.Get(MyTextsWrapperEnum.CantSaveSectorFailed); var messageBoxCaption = MyTextsWrapper.Get(MyTextsWrapperEnum.MessageBoxCaptionError); if (m_pause) { if (!MinerWars.AppCode.App.MyMinerGame.IsPaused()) { MinerWars.AppCode.App.MyMinerGame.SwitchPause(); } } Vector2 buttonSize = new Vector2(MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.X * 2.4f, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y); var messageBoxScreen = new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyMessageBoxButtonsType.YES_NO, messageBoxMessage, messageBoxCaption, null, MyTextsWrapperEnum.ButtonRetry, MyTextsWrapperEnum.ButtonContinueWithoutSaving, MessageBoxCallback, false, buttonSize); MyGuiManager.AddScreen(messageBoxScreen); }
/// <summary> /// Initialized new single player session and loads load checkpoint /// </summary> public static MyServerAction StartLastCheckpoint() { if (MyClientServer.LoggedPlayer.IsDemoUser()) { return MySession.StartNewGame(MyGameplayConstants.GameplayDifficultyProfile.GameplayDifficulty); } else { // Difficulty doesn't matter, will be rewritten by checkpoint MySession.Static = new MySinglePlayerSession(MyGameplayDifficultyEnum.NORMAL); MySession.Static.Init(); try { return MySession.Static.LoadLastCheckpoint(); } catch (MyDataCorruptedException) { var screen = new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.SaveCorruptedText, MyTextsWrapperEnum.SaveCorruptedCaption, MyTextsWrapperEnum.Ok, OnErrorClick); MyGuiManager.AddScreen(screen); return null; } } }