C# 클래스 FSO.Client.UI.Framework.UIElement

Base class for all UIElements. This class has all the common stuff that user interface components have. This includes: X,Y, ScaleX, ScaleY, Visible, Parent etc. The UIElement has its own coordinate space. You can imagine that when you draw a texture inside a UIElement you are drawing it at 0,0 within the UIElement. This is then translated by the engine to screen coordinates.
상속: IDepthProvider
파일 보기 프로젝트 열기: RHY3756547/FreeSO 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
MASK_COLORS uint[]
Visible bool

보호된 프로퍼티들

프로퍼티 타입 설명
_BlendColor Color
_HasOpacity bool
_Mtx float[]
_MtxDirty bool
_Opacity float
_OpacityDirty bool
_Parent UIContainer
_Scale Vector2
_ScaleParent Vector2
_ScaleX float
_ScaleY float
_Tooltip string
_X float
_Y float
m_StringID string

Private Properties

프로퍼티 타입 설명

공개 메소드들

메소드 설명
AddUpdateHook ( UpdateHookDelegate hook ) : void

Adds a callback that will be executed every update loop.

Async ( AsyncHandler handler ) : void

Little utility to make it easier to do work outside of the UI thread

Draw ( FSO.Client.UI.Framework.UISpriteBatch batch ) : void

Basic draw method. Your component should implement this and add any drawing behavior it needs.

DrawLocalString ( SpriteBatch batch, string text, Vector2 to, TextStyle style ) : void

This utility will draw a line of text onto the UIElement.

DrawLocalString ( SpriteBatch batch, string text, Vector2 to, TextStyle style, Rectangle bounds, TextAlignment align ) : void

This utility will draw a line of text onto the UIElement.

DrawLocalString ( SpriteBatch batch, string text, Vector2 to, TextStyle style, Rectangle bounds, TextAlignment align, Rectangle margin ) : void

This utility will draw a line of text onto the UIElement.

DrawLocalString ( SpriteBatch batch, string text, Vector2 to, TextStyle style, Rectangle bounds, TextAlignment align, Rectangle margin, UIElementState state ) : void

This utility will draw a line of text onto the UIElement.

DrawLocalTexture ( SpriteBatch batch, Microsoft.Xna.Framework.Graphics.Texture2D texture, Nullable from, Vector2 to, Vector2 scale ) : void

Draws a texture to the UIElement. This method will deal with the matrix calculations

DrawLocalTexture ( SpriteBatch batch, Microsoft.Xna.Framework.Graphics.Texture2D texture, Nullable from, Vector2 to, Vector2 scale, Color blend ) : void

Draws a texture to the UIElement. This method will deal with the matrix calculations

DrawLocalTexture ( SpriteBatch batch, Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle from, Vector2 to ) : void

Draws a texture to the UIElement. This method will deal with the matrix calculations

DrawLocalTexture ( SpriteBatch batch, Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector2 to ) : void

Draws a texture to the UIElement. This method will deal with the matrix calculations

DrawTiledTexture ( SpriteBatch batch, Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle dest, Color blend ) : void
FlooredLocalPoint ( Vector2 point ) : Vector2
GetBounds ( ) : Rectangle

Gets the bounding box for the component

GetMousePosition ( Microsoft.Xna.Framework.Input.MouseState mouse ) : Vector2

Gets the local mouse coordinates for the given mouse state

GetTexture ( ContentID id ) : Microsoft.Xna.Framework.Graphics.Texture2D
GetTexture ( ulong id ) : Microsoft.Xna.Framework.Graphics.Texture2D
GlobalPoint ( Vector2 globalPoint ) : Vector2

Converts a point relative to the screen into a point relative to this component

HitTestArea ( UpdateState state, Rectangle area, bool cache ) : bool

Returns true if the mouse is over the given area

InvalidateMatrix ( ) : void

Utility to force the component to recalculate its matrix

InvalidateOpacity ( ) : void

Utility to force the component to recalculate its blend colour

ListenForMouse ( Rectangle region, UIMouseEvent callback ) : UIMouseEventRef
LocalPoint ( Vector2 point ) : Vector2

Converts a point relative to this UIElement into a point relative to the screen

LocalPoint ( float x, float y ) : Vector2

Converts a point relative to this UIElement into a point relative to the screen

LocalRect ( float x, float y, float w, float h ) : Rectangle

Converts a rectangle relative to this UIElement into a rectangle relative to the screen.

LocalRect ( float x, float y, float w, float h, float mtx ) : Rectangle

Converts a rectangle relative to this UIElement into a rectangle relative to the screen.

PreDraw ( FSO.Client.UI.Framework.UISpriteBatch batch ) : void

May be removed - Called before the draw method.

RemoveMouseListener ( UIMouseEventRef item ) : void
RemoveUpdateHook ( UpdateHookDelegate hook ) : void

Removes a previously added update hook.

StoreTexture ( ulong id, ContentResource assetData ) : Microsoft.Xna.Framework.Graphics.Texture2D
StoreTexture ( ulong id, ContentResource assetData, bool mask, bool cacheOnDisk ) : Microsoft.Xna.Framework.Graphics.Texture2D
ToString ( ) : string
Update ( UpdateState state ) : void

Standard UIElement update method. All sub-classes should call this super method. The argument is an UpdateState object, this object contains everything you may need during update including GameTime, MouseState, KeyboardState etc. This is useful because it means we dont ask for Mouse & Keyboard state in every UIElement which would be wasteful

WillDraw ( ) : bool

Scans through parents to determine if this element will be drawn.

보호된 메소드들

메소드 설명
CalculateMatrix ( ) : void

Calculate a matrix which represents this objects position in screen space

CalculateOpacity ( ) : void

When the opacity changes this method is used to calculate the blend colour.

ManualTextureMask ( Microsoft.Xna.Framework.Graphics.Texture2D &Texture, Color ColorFrom ) : void

Manually replaces a specified color in a texture with transparent black, thereby masking it.

메소드 상세

AddUpdateHook() 공개 메소드

Adds a callback that will be executed every update loop.
public AddUpdateHook ( UpdateHookDelegate hook ) : void
hook UpdateHookDelegate
리턴 void

Async() 공개 메소드

Little utility to make it easier to do work outside of the UI thread
public Async ( AsyncHandler handler ) : void
handler AsyncHandler
리턴 void

CalculateMatrix() 보호된 메소드

Calculate a matrix which represents this objects position in screen space
protected CalculateMatrix ( ) : void
리턴 void

CalculateOpacity() 보호된 메소드

When the opacity changes this method is used to calculate the blend colour.
protected CalculateOpacity ( ) : void
리턴 void

Draw() 공개 추상적인 메소드

Basic draw method. Your component should implement this and add any drawing behavior it needs.
public abstract Draw ( FSO.Client.UI.Framework.UISpriteBatch batch ) : void
batch FSO.Client.UI.Framework.UISpriteBatch
리턴 void

DrawLocalString() 공개 메소드

This utility will draw a line of text onto the UIElement.
public DrawLocalString ( SpriteBatch batch, string text, Vector2 to, TextStyle style ) : void
batch Microsoft.Xna.Framework.Graphics.SpriteBatch The SpriteBatch to draw the text onto
text string The content of the text
to Vector2 The position of the text. Relative to this UIElement.
style TextStyle The text style
리턴 void

DrawLocalString() 공개 메소드

This utility will draw a line of text onto the UIElement.
public DrawLocalString ( SpriteBatch batch, string text, Vector2 to, TextStyle style, Rectangle bounds, TextAlignment align ) : void
batch Microsoft.Xna.Framework.Graphics.SpriteBatch The SpriteBatch to draw the text onto
text string The content of the text
to Vector2 The position of the text. Relative to this UIElement.
style TextStyle The text style
bounds Microsoft.Xna.Framework.Rectangle Rectangle relative to this UIElement which the text should be positioned within
align TextAlignment Alignment of the text within the bounds box.
리턴 void

DrawLocalString() 공개 메소드

This utility will draw a line of text onto the UIElement.
public DrawLocalString ( SpriteBatch batch, string text, Vector2 to, TextStyle style, Rectangle bounds, TextAlignment align, Rectangle margin ) : void
batch Microsoft.Xna.Framework.Graphics.SpriteBatch The SpriteBatch to draw the text onto
text string The content of the text
to Vector2 The position of the text. Relative to this UIElement.
style TextStyle The text style
bounds Microsoft.Xna.Framework.Rectangle Rectangle relative to this UIElement which the text should be positioned within
align TextAlignment Alignment of the text within the bounds box.
margin Microsoft.Xna.Framework.Rectangle Margin offset from the bounding box.
리턴 void

DrawLocalString() 공개 메소드

This utility will draw a line of text onto the UIElement.
public DrawLocalString ( SpriteBatch batch, string text, Vector2 to, TextStyle style, Rectangle bounds, TextAlignment align, Rectangle margin, UIElementState state ) : void
batch Microsoft.Xna.Framework.Graphics.SpriteBatch The SpriteBatch to draw the text onto
text string The content of the text
to Vector2 The position of the text. Relative to this UIElement.
style TextStyle The text style
bounds Microsoft.Xna.Framework.Rectangle Rectangle relative to this UIElement which the text should be positioned within
align TextAlignment Alignment of the text within the bounds box.
margin Microsoft.Xna.Framework.Rectangle Margin offset from the bounding box.
state UIElementState State of the text, e.g. hover, down, normal
리턴 void

DrawLocalTexture() 공개 메소드

Draws a texture to the UIElement. This method will deal with the matrix calculations
public DrawLocalTexture ( SpriteBatch batch, Microsoft.Xna.Framework.Graphics.Texture2D texture, Nullable from, Vector2 to, Vector2 scale ) : void
batch Microsoft.Xna.Framework.Graphics.SpriteBatch
texture Microsoft.Xna.Framework.Graphics.Texture2D
from Nullable
to Vector2
scale Vector2
리턴 void

DrawLocalTexture() 공개 메소드

Draws a texture to the UIElement. This method will deal with the matrix calculations
public DrawLocalTexture ( SpriteBatch batch, Microsoft.Xna.Framework.Graphics.Texture2D texture, Nullable from, Vector2 to, Vector2 scale, Color blend ) : void
batch Microsoft.Xna.Framework.Graphics.SpriteBatch
texture Microsoft.Xna.Framework.Graphics.Texture2D
from Nullable
to Vector2
scale Vector2
blend Color
리턴 void

DrawLocalTexture() 공개 메소드

Draws a texture to the UIElement. This method will deal with the matrix calculations
public DrawLocalTexture ( SpriteBatch batch, Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle from, Vector2 to ) : void
batch Microsoft.Xna.Framework.Graphics.SpriteBatch
texture Microsoft.Xna.Framework.Graphics.Texture2D
from Microsoft.Xna.Framework.Rectangle
to Vector2
리턴 void

DrawLocalTexture() 공개 메소드

Draws a texture to the UIElement. This method will deal with the matrix calculations
public DrawLocalTexture ( SpriteBatch batch, Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector2 to ) : void
batch Microsoft.Xna.Framework.Graphics.SpriteBatch
texture Microsoft.Xna.Framework.Graphics.Texture2D
to Vector2
리턴 void

DrawTiledTexture() 공개 메소드

public DrawTiledTexture ( SpriteBatch batch, Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle dest, Color blend ) : void
batch Microsoft.Xna.Framework.Graphics.SpriteBatch
texture Microsoft.Xna.Framework.Graphics.Texture2D
dest Microsoft.Xna.Framework.Rectangle
blend Color
리턴 void

FlooredLocalPoint() 공개 메소드

public FlooredLocalPoint ( Vector2 point ) : Vector2
point Vector2
리턴 Vector2

GetBounds() 공개 메소드

Gets the bounding box for the component
public GetBounds ( ) : Rectangle
리턴 Microsoft.Xna.Framework.Rectangle

GetMousePosition() 공개 메소드

Gets the local mouse coordinates for the given mouse state
public GetMousePosition ( Microsoft.Xna.Framework.Input.MouseState mouse ) : Vector2
mouse Microsoft.Xna.Framework.Input.MouseState
리턴 Vector2

GetTexture() 공개 정적인 메소드

public static GetTexture ( ContentID id ) : Microsoft.Xna.Framework.Graphics.Texture2D
id FSO.Common.Content.ContentID
리턴 Microsoft.Xna.Framework.Graphics.Texture2D

GetTexture() 공개 정적인 메소드

public static GetTexture ( ulong id ) : Microsoft.Xna.Framework.Graphics.Texture2D
id ulong
리턴 Microsoft.Xna.Framework.Graphics.Texture2D

GlobalPoint() 공개 메소드

Converts a point relative to the screen into a point relative to this component
public GlobalPoint ( Vector2 globalPoint ) : Vector2
globalPoint Vector2
리턴 Vector2

HitTestArea() 공개 메소드

Returns true if the mouse is over the given area
public HitTestArea ( UpdateState state, Rectangle area, bool cache ) : bool
state FSO.Common.Rendering.Framework.Model.UpdateState
area Microsoft.Xna.Framework.Rectangle
cache bool
리턴 bool

InvalidateMatrix() 공개 메소드

Utility to force the component to recalculate its matrix
public InvalidateMatrix ( ) : void
리턴 void

InvalidateOpacity() 공개 메소드

Utility to force the component to recalculate its blend colour
public InvalidateOpacity ( ) : void
리턴 void

ListenForMouse() 공개 메소드

public ListenForMouse ( Rectangle region, UIMouseEvent callback ) : UIMouseEventRef
region Microsoft.Xna.Framework.Rectangle
callback UIMouseEvent
리턴 FSO.Common.Rendering.Framework.IO.UIMouseEventRef

LocalPoint() 공개 메소드

Converts a point relative to this UIElement into a point relative to the screen
public LocalPoint ( Vector2 point ) : Vector2
point Vector2
리턴 Vector2

LocalPoint() 공개 메소드

Converts a point relative to this UIElement into a point relative to the screen
public LocalPoint ( float x, float y ) : Vector2
x float
y float
리턴 Vector2

LocalRect() 공개 메소드

Converts a rectangle relative to this UIElement into a rectangle relative to the screen.
public LocalRect ( float x, float y, float w, float h ) : Rectangle
x float
y float
w float
h float
리턴 Microsoft.Xna.Framework.Rectangle

LocalRect() 공개 메소드

Converts a rectangle relative to this UIElement into a rectangle relative to the screen.
public LocalRect ( float x, float y, float w, float h, float mtx ) : Rectangle
x float
y float
w float
h float
mtx float
리턴 Microsoft.Xna.Framework.Rectangle

ManualTextureMask() 보호된 메소드

Manually replaces a specified color in a texture with transparent black, thereby masking it.
protected ManualTextureMask ( Microsoft.Xna.Framework.Graphics.Texture2D &Texture, Color ColorFrom ) : void
Texture Microsoft.Xna.Framework.Graphics.Texture2D The texture on which to apply the mask.
ColorFrom Color The color to mask away.
리턴 void

PreDraw() 공개 메소드

May be removed - Called before the draw method.
public PreDraw ( FSO.Client.UI.Framework.UISpriteBatch batch ) : void
batch FSO.Client.UI.Framework.UISpriteBatch
리턴 void

RemoveMouseListener() 공개 메소드

public RemoveMouseListener ( UIMouseEventRef item ) : void
item FSO.Common.Rendering.Framework.IO.UIMouseEventRef
리턴 void

RemoveUpdateHook() 공개 메소드

Removes a previously added update hook.
public RemoveUpdateHook ( UpdateHookDelegate hook ) : void
hook UpdateHookDelegate
리턴 void

StoreTexture() 공개 정적인 메소드

public static StoreTexture ( ulong id, ContentResource assetData ) : Microsoft.Xna.Framework.Graphics.Texture2D
id ulong
assetData FSO.Client.GameContent.ContentResource
리턴 Microsoft.Xna.Framework.Graphics.Texture2D

StoreTexture() 공개 정적인 메소드

public static StoreTexture ( ulong id, ContentResource assetData, bool mask, bool cacheOnDisk ) : Microsoft.Xna.Framework.Graphics.Texture2D
id ulong
assetData FSO.Client.GameContent.ContentResource
mask bool
cacheOnDisk bool
리턴 Microsoft.Xna.Framework.Graphics.Texture2D

ToString() 공개 메소드

public ToString ( ) : string
리턴 string

Update() 공개 메소드

Standard UIElement update method. All sub-classes should call this super method. The argument is an UpdateState object, this object contains everything you may need during update including GameTime, MouseState, KeyboardState etc. This is useful because it means we dont ask for Mouse & Keyboard state in every UIElement which would be wasteful
public Update ( UpdateState state ) : void
state FSO.Common.Rendering.Framework.Model.UpdateState
리턴 void

WillDraw() 공개 메소드

Scans through parents to determine if this element will be drawn.
public WillDraw ( ) : bool
리턴 bool

프로퍼티 상세

MASK_COLORS 공개적으로 정적으로 프로퍼티

public static uint[] MASK_COLORS
리턴 uint[]

Visible 공개적으로 프로퍼티

Indicates if the component is visible or not. If false the UIElement should not draw. This must be implemented in the super class. UIElement does nothing with this variable.
public bool Visible
리턴 bool

_BlendColor 보호되어 있는 프로퍼티

When the opacity changes this color will be changed into a representation of the opacity that can be used when calling the draw texture methods.
protected Color _BlendColor
리턴 Color

_HasOpacity 보호되어 있는 프로퍼티

Boolean which indicates if the opacity is not 1.0. This is here as a utility because its faster to compare a boolean than to compare a float (_Opacity != 1.0f)
protected bool _HasOpacity
리턴 bool

_Mtx 보호되어 있는 프로퍼티

Matrix object which represents the position & scale of this UIElement. Whenever X, Y, ScaleX, ScaleY, Parent (or any of these values on my parent) change We recalculate this matrix. It is used to convert local coordinates into absolute screen coordinates for drawing.
protected float[] _Mtx
리턴 float[]

_MtxDirty 보호되어 있는 프로퍼티

Indicates if something has changed to make the Matrix invalid, e.g. X,Y has changed or the component is now inside a different parent object. Also called when the parent decides its dirty.
protected bool _MtxDirty
리턴 bool

_Opacity 보호되어 있는 프로퍼티

Transparency value for this UIElement. Can be between 0.0 and 1.0
protected float _Opacity
리턴 float

_OpacityDirty 보호되어 있는 프로퍼티

Indicates if the opacity has changed and we have not recauclated the blend colour
protected bool _OpacityDirty
리턴 bool

_Parent 보호되어 있는 프로퍼티

The container which this element is a child of. Can be null if top level UI object. UIContainer sets this in its Add method. Helps describe the UI Tree.
protected UIContainer,FSO.Client.UI.Framework _Parent
리턴 UIContainer

_Scale 보호되어 있는 프로퍼티

This is the absolute scale of this UIElement, Aka it is all the parent scales multiplied together finally multiplied by this UIElement's scale. Essentially, this is the scale value you would pass into a texture draw method. It is relative to the screen
protected Vector2 _Scale
리턴 Vector2

_ScaleParent 보호되어 있는 프로퍼티

This is the absolute scale of this UIElement, Aka it is all the parent scales multiplied together. This is used for some specific calculations.
protected Vector2 _ScaleParent
리턴 Vector2

_ScaleX 보호되어 있는 프로퍼티

Scale Factor of the X Axis.
protected float _ScaleX
리턴 float

_ScaleY 보호되어 있는 프로퍼티

Scale Factor of the Y Axis.
protected float _ScaleY
리턴 float

_Tooltip 보호되어 있는 프로퍼티

Tooltip of this UIComponent. This is displayed when the mouse is moved over the control.
protected string _Tooltip
리턴 string

_X 보호되어 있는 프로퍼티

X position of this UIComponent. This coordinate is relative to this UIElement's parent component.
protected float _X
리턴 float

_Y 보호되어 있는 프로퍼티

Y position of this UIComponent. This coordinate is relative to this UIElement's parent component.
protected float _Y
리턴 float

m_StringID 보호되어 있는 프로퍼티

ID of the element, this is not used by any functional code. It is only used in the debug UI Inspector to help you identify which component you are looking at.
protected string m_StringID
리턴 string