void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e) { const string message = "Are you sure you want to exit?"; MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(message, true, true); confirmExitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted; ScreenManager.AddScreen(confirmExitMessageBox, ControllingPlayer); }
protected override void OnCancel(PlayerIndex playerIndex) { //Are all players not joined and wanting to exit?? if (p1NJ == true && p2NJ == true && p3NJ == true && p4NJ == true) { const string message = "Are you sure you want to exit?"; MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(message, true, true); confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted; ScreenManager.AddScreen(confirmExitMessageBox, playerIndex); } //Back out of the game but doesn't end game unless everyone backs out if (playerIndex == PlayerIndex.One) { if (active) { p1NJ = true; p1JNR = false; joinedP1 = 0; numberOfPlayersJoined--; if (p1R == true) { p1NJ = false; p1JNR = true; p1R = false; readyP1--; joinedP1++; play = false; numberOfPlayersJoined++; } } else { //reactivates the screen active = true; } } #region OtherPlayers if (playerIndex == PlayerIndex.Two) { if (active) { p2NJ = true; p2JNR = false; joinedP2 = 0; numberOfPlayersJoined--; if (p2R == true) { p2NJ = false; p2JNR = true; p2R = false; readyP2--; joinedP2++; play = false; numberOfPlayersJoined++; } } else { active = true; } } if (playerIndex == PlayerIndex.Three) { if (active) { p3NJ = true; p3JNR = false; joinedP3 = 0; numberOfPlayersJoined--; if (p3R == true) { p3NJ = false; p3JNR = true; p3R = false; readyP3--; joinedP3++; play = false; numberOfPlayersJoined++; } } else { active = true; } } if (playerIndex == PlayerIndex.Four) { if (active) { p4NJ = true; p4JNR = false; joinedP4 = 0; numberOfPlayersJoined--; if (p4R == true) { p4NJ = false; p4JNR = true; p4R = false; readyP4--; joinedP4++; play = false; numberOfPlayersJoined++; } } else { active = true; } } if (player.State == MediaState.Playing) { player.Stop(); play = false; counter = 0; } #endregion SetMenuEntryText(); }