/// <summary> /// When the user cancels the main menu, ask if they want to exit the sample. /// </summary> protected override void OnExit(PlayerIndex playerIndex) { const string message = "Are you sure you want to exit?"; MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(message); confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted; ScreenManager.AddScreen(confirmExitMessageBox, playerIndex); }
void CloseGame(object state) { Thread.Sleep(4000); this.ExitScreen(); MessageBoxScreen mbs = new MessageBoxScreen((string)state); mbs.Accepted += delegate { ScreenManager.AddScreen(new MainMenuScreen(), this.controllingPlayer); }; mbs.Cancelled += delegate { this.Game.Exit(); }; ScreenManager.AddScreen(mbs, this.controllingPlayer); }