C# Class Descent.GUI.GUIElementFactory

Responsible for creating the GUIElements for the different layers of the gui and for all the different states and roles in the game. This is done as a simple hierarchy of GUIElements and should be populated with logic (events on click) and Drawables to be displayed within the respective GUIElements in the tree.
Mostrar archivo Open project: nezbo/Descent

Public Methods

Method Description
CreateBoardElement ( Microsoft.Xna.Framework.Game game, Board board, Role role ) : GUIElement

Creates a guielement that displays how the board looks like and keeps updated when the board changes.

CreateEquipmentElement ( Microsoft.Xna.Framework.Game game, int x, int y, string slotTitle, Equipment equipment, int id ) : EquipmentElement

Creates an EquipmentElement for visualization of the properties of the given equipment. Using this method to create the element makes sure that all EquipmentElements in the game has the same dimensions and are equipped with proper click events.

CreateMenuElement ( Microsoft.Xna.Framework.Game game, Role role ) : GUIElement
CreateStateElement ( Microsoft.Xna.Framework.Game game, State state, Role role, GameState gameState ) : GUIElement

Creates a GUIElement that fits the given parameters.

DrawDice ( GUIElement target, EDice dice, int x, int y, int size ) : void

Draws a given dice-type to the target GUIElement. By using this method to draw the EDice, you're sure it's drawn the same way every time.

DrawSurgeAbility ( GUIElement target, SurgeAbility ability, int xPosition, int yPosition, bool small ) : void

Draws a visualization of a SurgeAbility on a target GUIElement. By using this method to draw the SurgeAbility, you're sure it's drawn the same way every time.

Private Methods

Method Description
CreateEmptyRoot ( Microsoft.Xna.Framework.Game game ) : GUIElement
LoadDiceTextures ( Microsoft.Xna.Framework.Game game ) : void
RelH ( Viewport viewport, int percentage ) : int
RelW ( Viewport viewport, int percentage ) : int

Method Details

CreateBoardElement() public static method

Creates a guielement that displays how the board looks like and keeps updated when the board changes.
public static CreateBoardElement ( Microsoft.Xna.Framework.Game game, Board board, Role role ) : GUIElement
game Microsoft.Xna.Framework.Game The current Game object.
board Descent.Model.Board.Board The Board to visualize.
role Role The Role to view the board from, for example /// the overlord may see the entire board from the beginning
return GUIElement

CreateEquipmentElement() public static method

Creates an EquipmentElement for visualization of the properties of the given equipment. Using this method to create the element makes sure that all EquipmentElements in the game has the same dimensions and are equipped with proper click events.
public static CreateEquipmentElement ( Microsoft.Xna.Framework.Game game, int x, int y, string slotTitle, Equipment equipment, int id ) : EquipmentElement
game Microsoft.Xna.Framework.Game The current Game object.
x int Will be the top-left coordinate of the EquipmentElement.
y int Will be the top-left coordinate of the EquipmentElement.
slotTitle string In case that the equipment is null it will display this title for the missing equipment.
equipment Descent.Model.Player.Figure.HeroStuff.Equipment The Equipment to visualize. Null here will indicate that the equipment slot is empty.
id int The game logic ID of this equipment, will be used for the click event.
return Descent.GUI.SubElements.EquipmentElement

CreateMenuElement() public static method

public static CreateMenuElement ( Microsoft.Xna.Framework.Game game, Role role ) : GUIElement
game Microsoft.Xna.Framework.Game
role Role
return GUIElement

CreateStateElement() public static method

Creates a GUIElement that fits the given parameters.
public static CreateStateElement ( Microsoft.Xna.Framework.Game game, State state, Role role, GameState gameState ) : GUIElement
game Microsoft.Xna.Framework.Game The current Game object.
state State The State to be visualized.
role Role The Role to view the given state from.
gameState Descent.State.GameState An object that holds some game properties that is needed for some States.
return GUIElement

DrawDice() public static method

Draws a given dice-type to the target GUIElement. By using this method to draw the EDice, you're sure it's drawn the same way every time.
public static DrawDice ( GUIElement target, EDice dice, int x, int y, int size ) : void
target GUIElement The GUIElement to display the dice in.
dice EDice The dice to display.
x int The top-left x-coordinate to start drawing from.
y int The top-left y-coordinate to start drawing from.
size int The width and height in pixels.
return void

DrawSurgeAbility() public static method

Draws a visualization of a SurgeAbility on a target GUIElement. By using this method to draw the SurgeAbility, you're sure it's drawn the same way every time.
public static DrawSurgeAbility ( GUIElement target, SurgeAbility ability, int xPosition, int yPosition, bool small ) : void
target GUIElement The GUIElement to draw the SurgeAbility on.
ability Descent.Model.Player.Figure.HeroStuff.SurgeAbility The SurgeAbility to display.
xPosition int The top-left x-coordinate to start drawing from.
yPosition int The top-left y-coordinate to start drawing from.
small bool True if the surge ability should be drawn as compact as possible, else false.
return void