This screen implements the game help. More...
Public Member Functions | |
| GravityChooserHelpScreen (string[] screenMessage) | |
| Constructor of the screen. | |
| override void | LoadContent () |
| Load graphics content for the game. | |
| override void | UnloadContent () |
| Unload graphics content used by the game. | |
| override void | Update (GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) |
| Updates the state of the screen. | |
| override void | HandleInput (InputState input) |
| Lets the game respond to player input. Unlike the Update method, this will only be called when the gameplay screen is active. | |
| override void | Draw (GameTime gameTime) |
| Draws the gameplay screen. | |
This screen implements the game help.
Definition at line 25 of file GravityChooserHelpScreen.cs.
| GravityChooser.GravityChooserHelpScreen.GravityChooserHelpScreen | ( | string[] | screenMessage | ) |
Constructor of the screen.
| screenMessage | The help message to display. |
Definition at line 61 of file GravityChooserHelpScreen.cs.
00062 { 00063 // New message list 00064 this.messages = new List<string>(); 00065 00066 // Store screen message 00067 this.messages.AddRange(screenMessage); 00068 00069 // Add exit message 00070 string[] exitMessage = { "", "", "[Key] or (Button) to return to Main Menu" }; 00071 this.messages.AddRange(exitMessage); 00072 00073 TransitionOnTime = TimeSpan.FromSeconds(0.5); 00074 TransitionOffTime = TimeSpan.FromSeconds(0.5); 00075 }
| override void GravityChooser.GravityChooserHelpScreen.Draw | ( | GameTime | gameTime | ) | [virtual] |
Draws the gameplay screen.
Reimplemented from NewGamePhysics.StateManager.GameScreen.
Definition at line 171 of file GravityChooserHelpScreen.cs.
00172 { 00173 // Get drawing helpers and textures 00174 PrimitiveBatch primitiveBatch = ScreenManager.PrimitiveBatch; 00175 SpriteBatch spriteBatch = ScreenManager.SpriteBatch; 00176 Viewport viewport = ScreenManager.GraphicsDevice.Viewport; 00177 SpriteFont font = ScreenManager.Fonts["game"]; 00178 00179 // Draw score summary 00180 Color color = Color.White; 00181 Vector2 origin = new Vector2(0, 0); 00182 Vector2 position = new Vector2(viewport.Width * 0.05f, viewport.Height * 0.05f); 00183 float scale = 0.5f; 00184 spriteBatch.Begin(); 00185 for (int i = 0; i < numRows; i++) 00186 { 00187 string message = messages[i]; 00188 if (textAlpha[i] > 0.0f) 00189 { 00190 if (string.IsNullOrEmpty(message)) 00191 { 00192 // Skip this row 00193 position.Y += ((float)font.LineSpacing * 0.5f * scale); 00194 } 00195 else 00196 { 00197 color = new Color(Color.White, MathHelper.SmoothStep(0.0f, 1.0f, textAlpha[i])); 00198 spriteBatch.DrawString( 00199 font, 00200 message, 00201 position, 00202 color, 00203 0, 00204 origin, 00205 scale, 00206 SpriteEffects.None, 00207 0); 00208 position.Y += ((float)font.LineSpacing * 1.2f * scale); 00209 } 00210 } 00211 } 00212 spriteBatch.End(); 00213 00214 // If the game is transitioning on or off, fade it out to black. 00215 if (TransitionPosition > 0) 00216 { 00217 ScreenManager.FadeBackBufferToBlack(255 - TransitionAlpha); 00218 } 00219 00220 base.Draw(gameTime); 00221 }
| override void GravityChooser.GravityChooserHelpScreen.HandleInput | ( | InputState | input | ) | [virtual] |
Lets the game respond to player input. Unlike the Update method, this will only be called when the gameplay screen is active.
Reimplemented from NewGamePhysics.StateManager.GameScreen.
Definition at line 140 of file GravityChooserHelpScreen.cs.
00141 { 00142 if (input == null) 00143 { 00144 throw new ArgumentNullException("input"); 00145 } 00146 00147 // Look up inputs for the active player profile. 00148 PlayerIndex playerIndex = ControllingPlayer.Value; 00149 00150 KeyboardState keyboardState = input.CurrentKeyboardStates[(int)playerIndex]; 00151 GamePadState gamePadState = input.CurrentGamePadStates[(int)playerIndex]; 00152 00153 // The game pauses either if the user presses the pause button, or if 00154 // they unplug the active gamepad. This requires us to keep track of 00155 // whether a gamepad was ever plugged in, because we don't want to pause 00156 // on PC if they are playing with a keyboard and have no gamepad at all! 00157 bool gamePadDisconnected = !gamePadState.IsConnected && 00158 input.GamePadWasConnected[(int)playerIndex]; 00159 00160 // Back to main menu 00161 if (input.IsMenuSelect(ControllingPlayer, out playerIndex)) 00162 { 00163 GravityChooserLoadingScreen.Load(ScreenManager, false, null, new GravityChooserBackgroundScreen(), 00164 new GravityChooserMainMenuScreen()); 00165 } 00166 }
| override void GravityChooser.GravityChooserHelpScreen.LoadContent | ( | ) | [virtual] |
Load graphics content for the game.
Reimplemented from NewGamePhysics.StateManager.GameScreen.
Definition at line 80 of file GravityChooserHelpScreen.cs.
00081 { 00082 if (this.contentManager == null) 00083 { 00084 this.contentManager = new ContentManager(ScreenManager.Game.Services, "Content"); 00085 } 00086 00087 // Reset text fader 00088 numRows = messages.Count; 00089 currentRow = 0; 00090 textAlpha = new float[numRows]; 00091 for (int i = 0; i < numRows; i++) 00092 { 00093 textAlpha[i] = 0.0f; 00094 } 00095 00096 // Reset game time 00097 ScreenManager.Game.ResetElapsedTime(); 00098 }
| override void GravityChooser.GravityChooserHelpScreen.UnloadContent | ( | ) | [virtual] |
Unload graphics content used by the game.
Reimplemented from NewGamePhysics.StateManager.GameScreen.
Definition at line 103 of file GravityChooserHelpScreen.cs.
| override void GravityChooser.GravityChooserHelpScreen.Update | ( | GameTime | gameTime, | |
| bool | otherScreenHasFocus, | |||
| bool | coveredByOtherScreen | |||
| ) | [virtual] |
Updates the state of the screen.
Reimplemented from NewGamePhysics.StateManager.GameScreen.
Definition at line 115 of file GravityChooserHelpScreen.cs.
00117 { 00118 base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); 00119 00120 if (IsActive) 00121 { 00122 // Fade logic 00123 if (currentRow < numRows) 00124 { 00125 textAlpha[currentRow] += fadeSpeed; 00126 if (string.IsNullOrEmpty(messages[currentRow]) || 00127 (textAlpha[currentRow] >= 1.0f)) 00128 { 00129 textAlpha[currentRow] = 1.0f; 00130 currentRow++; 00131 } 00132 } 00133 } 00134 }
1.6.2