C# Класс MrGravity.WorldSelect

Level selection menu that allows you to pick the level to start
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
LevelDirectory string

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
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

Описание методов

CheckForSave() публичный Метод

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
Результат bool

Draw() публичный Метод

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
Результат void

GetLevelCollect() публичный Метод

public GetLevelCollect ( ) : int
Результат int

GetLevelDeath() публичный Метод

public GetLevelDeath ( ) : int
Результат int

GetLevelTime() публичный Метод

public GetLevelTime ( ) : int
Результат int

Load() публичный Метод

Loads all the content needed for the levels
public Load ( Microsoft.Xna.Framework.Content.ContentManager content ) : void
content Microsoft.Xna.Framework.Content.ContentManager
Результат void

Reset() публичный Метод

Resets the world system
public Reset ( ) : void
Результат void

Save() публичный Метод

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
Результат void

UnlockWorld() публичный Метод

Unlocks the given world
public UnlockWorld ( int world ) : void
world int The world.
Результат void

Update() публичный Метод

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
Результат void

UpdateStarCount() публичный Метод

Updates the star count.
public UpdateStarCount ( ) : void
Результат void

WorldSelect() публичный Метод

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
Результат System

Описание свойств

LevelDirectory публичное статическое свойство

public static string LevelDirectory
Результат string