Class MenuUI
General class for menu entity ui
Fields
AllowMouseClick
True if the menu react to mouse input
Declaration
protected bool AllowMouseClick
AnimationAmount
How many amount of appearing animation should apply on this menu
Declaration
protected int AnimationAmount
ArrowMarkCode
Artwork sprite for the adjusting arrows
Declaration
protected SpriteCode ArrowMarkCode
BackgroundCode
Artwork sprite for the background
Declaration
protected SpriteCode BackgroundCode
BackgroundTint
Color tint of the background panel
Declaration
protected Color32 BackgroundTint
ContentPadding
Unified padding gap for the content panel
Declaration
protected Int4 ContentPadding
Interactable
True if the menu react to player input currently
Declaration
protected bool Interactable
ItemGap
Unified space between two items
Declaration
protected int ItemGap
ItemHeight
Unified height of a single item
Declaration
protected int ItemHeight
MaxItemCount
How many items can it display at the same time
Declaration
protected int MaxItemCount
MoreItemMarkCode
Artwork sprite for the mark displays on bottom when there's hiden item under the menu
Declaration
protected SpriteCode MoreItemMarkCode
MoreMarkSize
Unified size of the hidden item indicator
Declaration
protected Int2 MoreMarkSize
MoreMarkTint
Color tint of the hidden item indicator
Declaration
protected Color32 MoreMarkTint
MouseHighlightTint
Color tint for the current hovering item
Declaration
protected Color32 MouseHighlightTint
QuitOnPressStartOrEscKey
True if the menu close when player press "Start" button
Declaration
protected bool QuitOnPressStartOrEscKey
ScreenTint
Color tint that blocks all screen behind
Declaration
protected Color32 ScreenTint
SelectionArrowMarkSize
Unified size of the item adjusting arrow
Declaration
protected Int2 SelectionArrowMarkSize
SelectionMarkCode
Artwork sprite for the selecting item mark
Declaration
protected SpriteCode SelectionMarkCode
SelectionMarkSize
Unified size of the selection hand mark
Declaration
protected Int2 SelectionMarkSize
SelectionMarkTint
Color tint of the selecting hand mark
Declaration
protected Color32 SelectionMarkTint
WindowWidth
Unified width of the window
Declaration
protected int WindowWidth
Properties
AnimationDuration
Length in frame for the appearing animation
Declaration
public int AnimationDuration { get; set; }
BackgroundRect
Rect position of the background range in global space
Declaration
public IRect BackgroundRect { get; }
BackgroundStyle
GUI style instance of the background panel
Declaration
protected GUIStyle BackgroundStyle { get; set; }
BlockEvent
True if this UI blocks mouse button event
Declaration
protected override bool BlockEvent { get; }
Overrides
DefaultContentStyle
GUI style instance of the item content
Declaration
protected GUIStyle DefaultContentStyle { get; init; }
DefaultLabelStyle
GUI style instance of the item label
Declaration
protected GUIStyle DefaultLabelStyle { get; init; }
Message
Text content of the message display on top. Set to empty means no message should be display.
Declaration
public string Message { get; set; }
MessageStyle
GUI style instance of the message box
Declaration
protected GUIStyle MessageStyle { get; set; }
OverrideWindowWidth
Forced horizontal size in global space
Declaration
public int OverrideWindowWidth { get; set; }
SelectionIndex
Index of the current selecting item
Declaration
public int SelectionIndex { get; }
Methods
BeforeUpdate()
[2/4] This function is called every frame when entity is in stage. Prioritize using this function to update physics logic.
Declaration
public override void BeforeUpdate()
Overrides
DrawArrowItem(string, char[], bool, bool, out int, int, GUIStyle, GUIStyle, bool)
Draw an item inside the menu
Declaration
protected bool DrawArrowItem(string label, char[] chars, bool leftArrow, bool rightArrow, out int delta, int icon = 0, GUIStyle labelStyle = null, GUIStyle contentStyle = null, bool drawStyleBody = false)
Parameters
Type | Name | Description |
---|---|---|
string | label | Text displays on left side of this item |
char[] | chars | Text displays on right side of this item |
int | delta | Adjusted value from the user at current frame |
int | icon | Artwork sprite |
GUIStyle | labelStyle | GUI style of the label part |
GUIStyle | contentStyle | GUI style of the content part |
bool | drawStyleBody | True if the body of GUI style should be display |
Returns
Type | Description |
---|---|
bool | True if the item is pressed |
DrawArrowItem(string, string, bool, bool, out int, int, GUIStyle, GUIStyle, bool)
Draw an item inside the menu
Declaration
protected bool DrawArrowItem(string label, string content, bool leftArrow, bool rightArrow, out int delta, int icon = 0, GUIStyle labelStyle = null, GUIStyle contentStyle = null, bool drawStyleBody = false)
Parameters
Type | Name | Description |
---|---|---|
string | label | Text displays on left side of this item |
string | content | Text displays on right side of this item |
int | delta | Adjusted value from the user at current frame |
int | icon | Artwork sprite |
GUIStyle | labelStyle | GUI style of the label part |
GUIStyle | contentStyle | GUI style of the content part |
bool | drawStyleBody | True if the body of GUI style should be display |
Returns
Type | Description |
---|---|
bool | True if the item is pressed |
DrawItem(string, char[], int, GUIStyle, GUIStyle, bool)
Draw an item inside the menu
Declaration
protected bool DrawItem(string label, char[] chars, int icon = 0, GUIStyle labelStyle = null, GUIStyle contentStyle = null, bool drawStyleBody = false)
Parameters
Type | Name | Description |
---|---|---|
string | label | Text displays on left side of this item |
char[] | chars | Text displays on right side of this item |
int | icon | Artwork sprite |
GUIStyle | labelStyle | GUI style of the label part |
GUIStyle | contentStyle | GUI style of the content part |
bool | drawStyleBody | True if the body of GUI style should be display |
Returns
Type | Description |
---|---|
bool | True if the item is pressed |
DrawItem(string, int, GUIStyle, GUIStyle, bool)
Draw an item inside the menu
Declaration
protected bool DrawItem(string label, int icon = 0, GUIStyle labelStyle = null, GUIStyle contentStyle = null, bool drawStyleBody = false)
Parameters
Type | Name | Description |
---|---|---|
string | label | Text displays on left side of this item |
int | icon | Artwork sprite |
GUIStyle | labelStyle | GUI style of the label part |
GUIStyle | contentStyle | GUI style of the content part |
bool | drawStyleBody | True if the body of GUI style should be display |
Returns
Type | Description |
---|---|
bool | True if the item is pressed |
DrawItem(string, string, int, GUIStyle, GUIStyle, bool)
Draw an item inside the menu
Declaration
protected bool DrawItem(string label, string content, int icon = 0, GUIStyle labelStyle = null, GUIStyle contentStyle = null, bool drawStyleBody = false)
Parameters
Type | Name | Description |
---|---|---|
string | label | Text displays on left side of this item |
string | content | Text displays on right side of this item |
int | icon | Artwork sprite |
GUIStyle | labelStyle | GUI style of the label part |
GUIStyle | contentStyle | GUI style of the content part |
bool | drawStyleBody | True if the body of GUI style should be display |
Returns
Type | Description |
---|---|
bool | True if the item is pressed |
DrawMenu()
Declaration
protected abstract void DrawMenu()
GetWindowRect()
Get the rect position of the panel window in global space
Declaration
protected virtual IRect GetWindowRect()
OnActivated()
This function is called when entity enter the stage
Declaration
public override void OnActivated()
Overrides
OnSelectionChanged()
This function is called when item selection is changed
Declaration
protected virtual void OnSelectionChanged()
RefreshAnimation()
Declaration
protected void RefreshAnimation()
SetSelection(int)
Set current selecting item
Declaration
protected void SetSelection(int index)
UpdateUI()
Declaration
public override void UpdateUI()