/// <summary> /// Respond to "Exit" Item Selection /// </summary> /// <param name="playerIndex"></param> protected override void OnCancel(PlayerIndex playerIndex) { HighScoreScreen.SaveHighscore(); ScreenManager.Game.Exit(); AudioManager.StopSound("MenuMusic_Loop"); }
/// <summary> /// Performs necessary update logic. /// </summary> /// <param name="gameTime">Game time information.</param> /// <param name="otherScreenHasFocus">Whether another screen has the focus.</param> /// <param name="coveredByOtherScreen">Whether this screen is covered by another.</param> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { if (isExiting) { if (!HighScoreScreen.HighscoreSaved) { HighScoreScreen.SaveHighscore(); } else { isExiting = false; ScreenManager.Game.Exit(); } } base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); }