/// <summary> /// Event handler for when the Quit Game menu entry is selected. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="PlayerIndexEventArgs"/> instance containing the event data.</param> private void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e) { const string message = "Are you sure you want to quit?"; MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(message); confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted; this.ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer); }
/// <summary> /// Load graphics content for the screen. /// </summary> public override void LoadContent() { _back = new BackgroundScreen("Textures/Backgrounds/GradientBackground"); _intro = new MessageBoxScreen(this.IntroMessage); _intro.Accepted += screen_Accepted; _intro.Cancelled += screen_Cancelled; base.LoadContent(); }
/// <summary> /// When the user cancels the main menu, ask if they want to exit the sample. /// </summary> /// <param name="playerIndex">The index of the player calling the event.</param> protected override void OnCancel(PlayerIndex playerIndex) { const string message = "Are you sure you want to exit the game?"; var confirmExitMessageBox = new MessageBoxScreen(message); confirmExitMessageBox.Accepted += this.ConfirmExitMessageBoxAccepted; this.ScreenManager.AddScreen(confirmExitMessageBox, playerIndex); }
/// <summary> /// Handles the Accepted event of the screen control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="PlayerIndexEventArgs"/> instance containing the event data.</param> void screen_Accepted(object sender, PlayerIndexEventArgs e) { _back.ExitScreen(); _intro.ExitScreen(); _intro = null; }