void OnDelete(object sender, PlayerIndexEventArgs e) { const string message = "Do you really want to delete this profile?"; var confirmDelete = new DecisionScreen(message); confirmDelete.Accepted += ConfirmDeleteAccepted; ScreenManager.AddScreen(confirmDelete, e.PlayerIndex); }
/// <summary> /// Lets the game respond to player input. Unlike the Update method, /// this will only be called when the gameplay screen is active. /// </summary> public override void HandleInput(InputState input) { if (input == null) { return; } // Look up inputs for the active player profile. if (ControllingPlayer == null) { Debug.WriteLine("ControllingPlayer is null..."); return; } var playerIndex = (int)ControllingPlayer.Value; var keyboardState = input.CurrentKeyboardStates[playerIndex]; var gamePadState = input.CurrentGamePadStates[playerIndex]; // The game pauses either if the user presses the pause button, or if // they unplug the active gamepad. This requires us to keep track of // whether a gamepad was ever plugged in, because we don't want to pause // on PC if they are playing with a keyboard and have no gamepad at all! var gamePadDisconnected = !gamePadState.IsConnected && input.GamePadWasConnected[playerIndex]; if (input.IsPauseGame(ControllingPlayer) || gamePadDisconnected) { const string message = "Pause. Do you really want to exit game?"; var confirmExit = new DecisionScreen(message); confirmExit.Accepted += ConfirmExitGameAccepted; ScreenManager.AddScreen(confirmExit, ControllingPlayer); } }
/// <summary> /// When the user cancels the main menu, ask if they want to exit the sample. /// </summary> void OnExit(object sender, PlayerIndexEventArgs e) { const string message = "Do you really want to exit Bomberman Adventure?"; var confirmExit = new DecisionScreen(message); confirmExit.Accepted += ConfirmExitAccepted; ScreenManager.AddScreen(confirmExit, e.PlayerIndex); }