- Main Page
- Classes
- Files

- File List

# C:/Users/Andreas Schiffler/Desktop/SVN/NewGamePhysics/MontyHallGame/Screens/MontyHallPauseMenuScreen.cs

    00001 //-----------------------------------------------------------------------------
    00002 // MontyHallPauseMenuScreen.cs
    00003 // (C) A. Schiffler, 2009-2011
    00004 //-----------------------------------------------------------------------------
    00005
    00006 namespace MontyHallGame
    00007 {
    00008     using Microsoft.Xna.Framework;
    00009     using NewGamePhysics.StateManager;
    00010
    00015     class MontyHallPauseMenuScreen : MenuScreen
    00016     {
    00017         #region Initialization
    00018
    00019
    00023         public MontyHallPauseMenuScreen()
    00024             : base("Paused")
    00025         {
    00026             // Flag that there is no need for the game to transition
    00027             // off when the pause menu is on top of it.
    00028             IsPopup = true;
    00029
    00030             // Create our menu entries.
    00031             MenuEntry resumeGameMenuEntry = new MenuEntry("Resume Game");
    00032             MenuEntry quitGameMenuEntry = new MenuEntry("Quit Game");
    00033
    00034             // Hook up menu event handlers.
    00035             resumeGameMenuEntry.Selected += OnCancel;
    00036             quitGameMenuEntry.Selected += QuitGameMenuEntrySelected;
    00037
    00038             // Add entries to the menu.
    00039             MenuEntries.Add(resumeGameMenuEntry);
    00040             MenuEntries.Add(quitGameMenuEntry);
    00041         }
    00042
    00043
    00044         #endregion
    00045
    00046         #region Handle Input
    00047
    00048
    00052         void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
    00053         {
    00054             const string message = "Are you sure you want to quit this game?";
    00055
    00056             MontyHallMessageBoxScreen confirmQuitMessageBox = new MontyHallMessageBoxScreen(message);
    00057
    00058             confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;
    00059
    00060             ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer);
    00061         }
    00062
    00063
    00069         void ConfirmQuitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
    00070         {
    00071             MontyHallLoadingScreen.Load(ScreenManager, false, null, new MontyHallBackgroundScreen(),
    00072                                                            new MontyHallMainMenuScreen());
    00073         }
    00074
    00075
    00076         #endregion
    00077
    00078         #region Draw
    00079
    00080
    00085         public override void Draw(GameTime gameTime)
    00086         {
    00087             ScreenManager.FadeBackBufferToBlack(TransitionAlpha * 2 / 3);
    00088
    00089             base.Draw(gameTime);
    00090         }
    00091
    00092
    00093         #endregion
    00094     }
    00095 }