C# Class MrGravity.LevelSelect

Level selection menu that allows you to pick the level to start
Afficher le fichier Open project: DizWARE/Mr-Gravity

Méthodes publiques

Свойство Type Description
Back int
LevelDirectory string
LevelList string
LevelThumbsDirectory string
Next int
Previous int
TrialLevelList string

Méthodes publiques

Méthode 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

Méthode 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 méthode

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
Résultat void

Draw() public méthode

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
Résultat void

GetNextLevel() public méthode

Gets the next level in the game
public GetNextLevel ( ) : Level
Résultat Level

LevelSelect() public méthode

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
Résultat System

Load() public méthode

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
Résultat void

Reset() public méthode

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
Résultat Level

Save() public méthode

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
Résultat void

UnlockNextLevel() public méthode

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

Update() public méthode

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
Résultat void

Property Details

Back public_oe static_oe property

public static int Back
Résultat int

LevelDirectory public_oe static_oe property

public static string LevelDirectory
Résultat string

LevelList public_oe static_oe property

public static string LevelList
Résultat string

LevelThumbsDirectory public_oe static_oe property

public static string LevelThumbsDirectory
Résultat string

Next public_oe static_oe property

public static int Next
Résultat int

Previous public_oe static_oe property

public static int Previous
Résultat int

TrialLevelList public_oe static_oe property

public static string TrialLevelList
Résultat string