C# Class MrGravity.LevelSelect

Level selection menu that allows you to pick the level to start
Exibir arquivo Open project: DizWARE/Mr-Gravity

Public Properties

Property Type Description
Back int
LevelDirectory string
LevelList string
LevelThumbsDirectory string
Next int
Previous int
TrialLevelList string

Public Methods

Method Description
CheckForSave ( PlayerIndex player ) : void

Checks if a save file for the game already exists - and loads it if so. Meant to be used solely on XBOX360. Should be used as soon as we know what PlayerIndex the "gamer" is using (IE right after the title screen). Note: if a save game does not exist the constructor for this class should have filled in the default values (0 stars, all but the first locked - on xbox our default xml file should always have the default values - we cannot save information to that file as it is a binary xnb file that can't be changed at run time) Do not call this until we know the PlayerIndex the player is using!

Draw ( SpriteBatch spriteBatch, GraphicsDeviceManager graphics, Matrix scale ) : void

Draws the menu on the screen

GetNextLevel ( ) : Level

Gets the next level in the game

LevelSelect ( IControlScheme controlScheme ) : System

Constructs the menu screen that allows the player to select a level

Load ( Microsoft.Xna.Framework.Content.ContentManager content, GraphicsDevice graphics ) : void

Load the data that is needed to show the Level selection screen

Reset ( ) : Level

Resets all levels to be locked (except the first level) and resets all scores to 0 This should be changed a bit for our new world structure. Perhaps on xbox360 we can simply just reload the default xml file here (which is guaranteed to have default values within it if including it in the project in the proper state), and then save the game so the storage container contains the reset values as well. Additionally... I am not sure why this returns a level....

Save ( PlayerIndex player ) : void

Saves level unlock and scoring information PC saving is straightforward - but xDoc.Save() will not work on xbox360. Instead we use the built in XmlSerializer class to serialize an element out to an xml file. We build our Xelement like normal - but instead of saving that directly using XDocument.Save() we place this XElement into a struct, and use XmlSerializer to serialize the data out into a storage device on the xbox.

UnlockNextLevel ( ) : void

Unlocks the next level in the game(if it is already unlocked than it won't do anything)

Update ( GameTime gameTime, GameStates &gameState, Level &currentLevel ) : void

Handle any changes while on the level selection menu

Private Methods

Method Description
HandleAPressed ( GameStates &gameState, Level &currentLevel ) : void

Handle what happens when the player presses A for all options

HandleDirectionKeys ( ) : void

Handle actions for each direction the player may press on their controller

Method Details

CheckForSave() public method

Checks if a save file for the game already exists - and loads it if so. Meant to be used solely on XBOX360. Should be used as soon as we know what PlayerIndex the "gamer" is using (IE right after the title screen). Note: if a save game does not exist the constructor for this class should have filled in the default values (0 stars, all but the first locked - on xbox our default xml file should always have the default values - we cannot save information to that file as it is a binary xnb file that can't be changed at run time) Do not call this until we know the PlayerIndex the player is using!
public CheckForSave ( PlayerIndex player ) : void
player PlayerIndex
return void

Draw() public method

Draws the menu on the screen
public Draw ( SpriteBatch spriteBatch, GraphicsDeviceManager graphics, Matrix scale ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch Canvas we are drawing to
graphics GraphicsDeviceManager Information on the device's graphics
scale Matrix
return void

GetNextLevel() public method

Gets the next level in the game
public GetNextLevel ( ) : Level
return Level

LevelSelect() public method

Constructs the menu screen that allows the player to select a level
public LevelSelect ( IControlScheme controlScheme ) : System
controlScheme IControlScheme Controls that the player are using
return System

Load() public method

Load the data that is needed to show the Level selection screen
public Load ( Microsoft.Xna.Framework.Content.ContentManager content, GraphicsDevice graphics ) : void
content Microsoft.Xna.Framework.Content.ContentManager Access to the content of the project
graphics GraphicsDevice Graphics that draws to the screen
return void

Reset() public method

Resets all levels to be locked (except the first level) and resets all scores to 0 This should be changed a bit for our new world structure. Perhaps on xbox360 we can simply just reload the default xml file here (which is guaranteed to have default values within it if including it in the project in the proper state), and then save the game so the storage container contains the reset values as well. Additionally... I am not sure why this returns a level....
public Reset ( ) : Level
return Level

Save() public method

Saves level unlock and scoring information PC saving is straightforward - but xDoc.Save() will not work on xbox360. Instead we use the built in XmlSerializer class to serialize an element out to an xml file. We build our Xelement like normal - but instead of saving that directly using XDocument.Save() we place this XElement into a struct, and use XmlSerializer to serialize the data out into a storage device on the xbox.
public Save ( PlayerIndex player ) : void
player PlayerIndex
return void

UnlockNextLevel() public method

Unlocks the next level in the game(if it is already unlocked than it won't do anything)
public UnlockNextLevel ( ) : void
return void

Update() public method

Handle any changes while on the level selection menu
public Update ( GameTime gameTime, GameStates &gameState, Level &currentLevel ) : void
gameTime Microsoft.Xna.Framework.GameTime Current time within the game
gameState GameStates Current gamestate of the game
currentLevel Level Current level of the game
return void

Property Details

Back public_oe static_oe property

public static int Back
return int

LevelDirectory public_oe static_oe property

public static string LevelDirectory
return string

LevelList public_oe static_oe property

public static string LevelList
return string

LevelThumbsDirectory public_oe static_oe property

public static string LevelThumbsDirectory
return string

Next public_oe static_oe property

public static int Next
return int

Previous public_oe static_oe property

public static int Previous
return int

TrialLevelList public_oe static_oe property

public static string TrialLevelList
return string