void MusicMenuEntrySelected(object sender, PlayerIndexEventArgs e) { Music = !Music; Game1.WithMusic = Music; SetMenuEntryText(); }
/// <summary> /// Event handler for when the Quit Game menu entry is selected. /// </summary> void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e) { const string message = "Are you sure you want to quit this game?"; MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(message); confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted; ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer); }
void VolumeMusicMenuEntryRight(object sender, PlayerIndexEventArgs e) { VolumeMusic += 5; if (VolumeMusic > 100) VolumeMusic = 100; Game1.VolumeMusic = VolumeMusic; SetMenuEntryText(); }
void VolumeMusicMenuEntryLeft(object sender, PlayerIndexEventArgs e) { VolumeMusic -= 5; if (VolumeMusic < 0) VolumeMusic = 0; Game1.VolumeMusic = VolumeMusic; SetMenuEntryText(); }
void SoundMenuEntrySelected(object sender, PlayerIndexEventArgs e) { Sound = !Sound; Game1.WithSound = Sound; SetMenuEntryText(); }
void VolumeSoundMenuEntryRight(object sender, PlayerIndexEventArgs e) { VolumeSound += 5; if (VolumeSound > 100) VolumeSound = 100; Game1.VolumeSound = VolumeSound; SetMenuEntryText(); }
void VolumeSoundMenuEntryLeft(object sender, PlayerIndexEventArgs e) { VolumeSound -= 5; if (VolumeSound < 0) VolumeSound = 0; Game1.VolumeSound = VolumeSound; SetMenuEntryText(); }
/// <summary> /// Event handler for when the user selects ok on the "are you sure /// you want to quit" message box. This uses the loading screen to /// transition from the game back to the main menu screen. /// </summary> void ConfirmQuitMessageBoxAccepted(object sender, PlayerIndexEventArgs e) { //LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new MainMenuScreen()); LoadingScreen.Load(ScreenManager, false, null, new MainMenuScreen()); }
void PlayGameMenuEntrySelected(object sender, PlayerIndexEventArgs e) { LoadingScreen.Load(ScreenManager, true, e.PlayerIndex, new GameplayScreen()); }
void OptionsMenuEntrySelected(object sender, PlayerIndexEventArgs e) { ScreenManager.AddScreen(new OptionsScreen(), e.PlayerIndex); }
void ConfirmExitMessageBoxAccepted(object sender, PlayerIndexEventArgs e) { ScreenManager.Game.Exit(); }
/// <summary> /// Helper overload makes it easy to use OnCancel as a MenuEntry event handler. /// </summary> protected void OnCancel(object sender, PlayerIndexEventArgs e) { OnCancel(e.PlayerIndex); }