C# Class MrGravity.WorldSelect

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

Méthodes publiques

Свойство Type Description
LevelDirectory string

Méthodes publiques

Méthode Description
CheckForSave ( ) : bool

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, Matrix scale ) : void

Draws the menu on the screen

GetLevelCollect ( ) : int
GetLevelDeath ( ) : int
GetLevelTime ( ) : int
Load ( Microsoft.Xna.Framework.Content.ContentManager content ) : void

Loads all the content needed for the levels

Reset ( ) : void

Resets the world system

Save ( ) : 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.

UnlockWorld ( int world ) : void

Unlocks the given world

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

Handle any changes while on the level selection menu

UpdateStarCount ( ) : void

Updates the star count.

WorldSelect ( IControlScheme controlScheme, GraphicsDeviceManager graphics ) : System

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

Private Methods

Méthode Description
CreateRegions ( ) : void

Creates all the regions for the level editor for easy placement within the Title Safe area

DrawInfoBar ( SpriteBatch spriteBatch, int shiftValue ) : void

Draw info bar on the right

DrawLevelPanel ( SpriteBatch spriteBatch ) : void

Draws the levels in each of its panels

DrawTitleBar ( SpriteBatch spriteBatch ) : void

Draw the title bar to the screen

Exit ( GameStates &gameState ) : void

Exits the level selection

HandleAKey ( GameStates &gameState, Level &currentLevel ) : void

Handles when the A key is pressed

HandleBKey ( GameStates &gameState ) : void

Handles when user presses the back key

HandleDirectionKey ( ) : void

Handles the directional keys

SelectDevice ( IAsyncResult result ) : void

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 ( ) : bool
Résultat bool

Draw() public méthode

Draws the menu on the screen
public Draw ( SpriteBatch spriteBatch, Matrix scale ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch Canvas we are drawing to
scale Matrix
Résultat void

GetLevelCollect() public méthode

public GetLevelCollect ( ) : int
Résultat int

GetLevelDeath() public méthode

public GetLevelDeath ( ) : int
Résultat int

GetLevelTime() public méthode

public GetLevelTime ( ) : int
Résultat int

Load() public méthode

Loads all the content needed for the levels
public Load ( Microsoft.Xna.Framework.Content.ContentManager content ) : void
content Microsoft.Xna.Framework.Content.ContentManager
Résultat void

Reset() public méthode

Resets the world system
public Reset ( ) : void
Résultat void

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

UnlockWorld() public méthode

Unlocks the given world
public UnlockWorld ( int world ) : void
world int The world.
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

UpdateStarCount() public méthode

Updates the star count.
public UpdateStarCount ( ) : void
Résultat void

WorldSelect() public méthode

Constructs the menu screen that allows the player to select a level
public WorldSelect ( IControlScheme controlScheme, GraphicsDeviceManager graphics ) : System
controlScheme IControlScheme Controls that the player are using
graphics GraphicsDeviceManager
Résultat System

Property Details

LevelDirectory public_oe static_oe property

public static string LevelDirectory
Résultat string