The main menu screen is the first thing displayed when the game starts up. More...
Public Member Functions | |
| MontyHallMainMenuScreen () | |
| Constructor fills in the menu contents. | |
| override void | LoadContent () |
| Load graphics content for the screen. | |
| override void | Update (GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) |
| Update the main menu screen. | |
| override void | Draw (GameTime gameTime) |
| Draw the main menu screen. | |
Protected Member Functions | |
| override void | OnCancel (PlayerIndex playerIndex) |
| When the user cancels the main menu, ask if they want to exit the sample. | |
The main menu screen is the first thing displayed when the game starts up.
Definition at line 21 of file MontyHallMainMenuScreen.cs.
| MontyHallGame.MontyHallMainMenuScreen.MontyHallMainMenuScreen | ( | ) |
Constructor fills in the menu contents.
Definition at line 31 of file MontyHallMainMenuScreen.cs.
00032 : base("Monty Hall Game") 00033 { 00034 // Create our menu entries. 00035 MenuEntry hrngMenuEntry = new MenuEntry("Play with Physical Entropy"); 00036 MenuEntry prngMenuEntry = new MenuEntry("Play with Simulated Entropy"); 00037 MenuEntry optionsMenuEntry = new MenuEntry("Options and Settings"); 00038 MenuEntry helpMenuEntry = new MenuEntry("Game Controls Help"); 00039 MenuEntry infoMenuEntry = new MenuEntry("Game Information"); 00040 MenuEntry exitMenuEntry = new MenuEntry("Exit Game"); 00041 00042 // Hook up menu event handlers. 00043 hrngMenuEntry.Selected += HrngMenuEntrySelected; 00044 prngMenuEntry.Selected += PrngMenuEntrySelected; 00045 optionsMenuEntry.Selected += OptionsMenuEntrySelected; 00046 infoMenuEntry.Selected += InfoMenuEntrySelected; 00047 helpMenuEntry.Selected += HelpMenuEntrySelected; 00048 exitMenuEntry.Selected += OnCancel; 00049 00050 00051 // Add entries to the menu; 00052 // randomize the users rng choices. 00053 Random random = new Random(); 00054 if (random.Next(0, 2) == 0) 00055 { 00056 MenuEntries.Add(hrngMenuEntry); 00057 MenuEntries.Add(prngMenuEntry); 00058 } 00059 else 00060 { 00061 MenuEntries.Add(prngMenuEntry); 00062 MenuEntries.Add(hrngMenuEntry); 00063 } 00064 00065 // Add other entries to menu 00066 MenuEntries.Add(optionsMenuEntry); 00067 MenuEntries.Add(infoMenuEntry); 00068 MenuEntries.Add(helpMenuEntry); 00069 MenuEntries.Add(exitMenuEntry); 00070 }
| override void MontyHallGame.MontyHallMainMenuScreen.Draw | ( | GameTime | gameTime | ) | [virtual] |
Draw the main menu screen.
| gameTime | The current game time. |
Reimplemented from NewGamePhysics.StateManager.MenuScreen.
Definition at line 122 of file MontyHallMainMenuScreen.cs.
00123 { 00124 base.Draw(gameTime); 00125 00126 // Draw scroller 00127 SpriteBatch spriteBatch = ScreenManager.SpriteBatch; 00128 scrollingInfoText.Draw(gameTime, spriteBatch); 00129 }
| override void MontyHallGame.MontyHallMainMenuScreen.LoadContent | ( | ) | [virtual] |
Load graphics content for the screen.
Reimplemented from NewGamePhysics.StateManager.GameScreen.
Definition at line 72 of file MontyHallMainMenuScreen.cs.
00073 { 00074 // Create scrollers 00075 SpriteFont font = ScreenManager.Fonts["retro"]; 00076 MontyHallGame game = (MontyHallGame)ScreenManager.Game; 00077 int width = game.GraphicsDevice.Viewport.Width; 00078 scrollingInfoText = new ScrollingText("", font, width, 420); 00079 scrollingInfoText.ScrollerSpeed = 125.0f; 00080 00081 base.LoadContent(); 00082 }
| override void MontyHallGame.MontyHallMainMenuScreen.OnCancel | ( | PlayerIndex | playerIndex | ) | [protected, virtual] |
When the user cancels the main menu, ask if they want to exit the sample.
| sender | The event sender | |
| e | The event args. |
Reimplemented from NewGamePhysics.StateManager.MenuScreen.
Definition at line 257 of file MontyHallMainMenuScreen.cs.
00258 { 00259 const string message = "Are you sure you want to exit?"; 00260 00261 MontyHallMessageBoxScreen confirmExitMessageBox = new MontyHallMessageBoxScreen(message); 00262 00263 confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted; 00264 00265 ScreenManager.AddScreen(confirmExitMessageBox, playerIndex); 00266 }
| override void MontyHallGame.MontyHallMainMenuScreen.Update | ( | GameTime | gameTime, | |
| bool | otherScreenHasFocus, | |||
| bool | coveredByOtherScreen | |||
| ) | [virtual] |
Update the main menu screen.
| gameTime | The current game time. | |
| otherScreenHasFocus | Flag indicating of another screen has the focus. | |
| coveredByOtherScreen | Flag indicating of the screen is covered by another screen. |
Reimplemented from NewGamePhysics.StateManager.MenuScreen.
Definition at line 95 of file MontyHallMainMenuScreen.cs.
00096 { 00097 if (WaitForUncover) 00098 { 00099 if ((!coveredByOtherScreen) || (!otherScreenHasFocus)) 00100 { 00101 // Update the texts 00102 UpdateAllTexts(); 00103 00104 // Play jingle 00105 ScreenManager.Sounds["intro"].Play(); 00106 00107 // Update menu text 00108 WaitForUncover = false; 00109 } 00110 } 00111 00112 // Update scrollers 00113 scrollingInfoText.Update(gameTime); 00114 00115 base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); 00116 }
1.6.2