C# Class PathfindingTest.UI.HUD

Inheritance: MouseClickListener
显示文件 Open project: Wotuu/RTS_XNA_v2 Class Usage Examples

Public Properties

Property Type Description
color Color
hudTex Texture2D
miniMapTex Texture2D
player Player
sf SpriteFont

Public Methods

Method Description
CountUnits ( ) : void

Count the different unit/building types selected. Checks what objects to load in the HUD.

DefineMiniMapRectangle ( ) : Rectangle

Defines the space the minimap is using

DefineRectangle ( ) : Rectangle

Defines the space the HUD is using.

HUD ( Player p, Color c ) : System

Sets the textures to use for the HUD. Creates new instances of needed components. Sets variables to their default values.

IncrementStartCommandXY ( float startX ) : void
IncrementStartObjectXY ( float startX ) : void
IsMouseOverBuilding ( ) : Boolean

Checks whether the mouse is hovering over an object on the HUD.

MouseClickListener ( MouseEvent me ) : void

Used for creating units and buildings respectively.

Update ( KeyboardState ks, MouseState ms ) : void

Checks whether the HUD should be hidden or not. (if the player this HUD belongs to is not the player that is watching) Loads the objects to display according to selected units/buildings.

Private Methods

Method Description
Draw ( SpriteBatch sb ) : void

Draws the HUD and the objects required.

LoadCommands ( ) : void

Method Details

CountUnits() public method

Count the different unit/building types selected. Checks what objects to load in the HUD.
public CountUnits ( ) : void
return void

DefineMiniMapRectangle() public method

Defines the space the minimap is using
public DefineMiniMapRectangle ( ) : Rectangle
return Microsoft.Xna.Framework.Rectangle

DefineRectangle() public method

Defines the space the HUD is using.
public DefineRectangle ( ) : Rectangle
return Microsoft.Xna.Framework.Rectangle

HUD() public method

Sets the textures to use for the HUD. Creates new instances of needed components. Sets variables to their default values.
public HUD ( Player p, Color c ) : System
p PathfindingTest.Players.Player The player this HUD belongs to
c Color The desired color for this HUD
return System

IncrementStartCommandXY() public method

public IncrementStartCommandXY ( float startX ) : void
startX float
return void

IncrementStartObjectXY() public method

public IncrementStartObjectXY ( float startX ) : void
startX float
return void

IsMouseOverBuilding() public method

Checks whether the mouse is hovering over an object on the HUD.
public IsMouseOverBuilding ( ) : Boolean
return Boolean

MouseClickListener() public method

Used for creating units and buildings respectively.
public MouseClickListener ( MouseEvent me ) : void
me MouseEvent The MouseEvent to use
return void

Update() public method

Checks whether the HUD should be hidden or not. (if the player this HUD belongs to is not the player that is watching) Loads the objects to display according to selected units/buildings.
public Update ( KeyboardState ks, MouseState ms ) : void
ks KeyboardState Default KeyboardState
ms MouseState Default MouseState
return void

Property Details

color public_oe property

public Color color
return Color

hudTex public_oe property

public Texture2D hudTex
return Texture2D

miniMapTex public_oe property

public Texture2D miniMapTex
return Texture2D

player public_oe property

public Player player
return Player

sf public_oe property

public SpriteFont sf
return SpriteFont