Class GUI
GUI for Game-User-Interface. Handles UI related rendering and interaction logic
Properties
BodyColor
Color tint of the current invoke GUI element's body
Declaration
public static Color32 BodyColor { get; set; }
Color
Total color tint of the current invoke GUI element
Declaration
public static Color32 Color { get; set; }
ContentColor
Color tint of the current invoke GUI element's content part
Declaration
public static Color32 ContentColor { get; set; }
ContentVersion
Internal changing version of the GUI content
Declaration
public static int ContentVersion { get; }
Enable
True if the current invoke GUI element should be interactable with user
Declaration
public static bool Enable { get; set; }
FieldHeight
Unified height of a standard field-like element should have
Declaration
public static int FieldHeight { get; }
FieldPadding
Unified gap of a standard element should have
Declaration
public static int FieldPadding { get; }
Interactable
False if the current invoke GUI element should be not interactable with user but still looks interactable
Declaration
public static bool Interactable { get; set; }
IsTyping
True if the user is typing in text field at current frame
Declaration
public static bool IsTyping { get; }
LabelWidth
Unified width of the label part of the current invoke GUI element
Declaration
public static int LabelWidth { get; set; }
ScrollbarSize
Unified size of a standard scrollbar element should have
Declaration
public static int ScrollbarSize { get; }
Skin
Built-in skin of the system
Declaration
public static GUISkin Skin { get; set; }
ToolbarSize
Unified size of a standard toolbar element should have
Declaration
public static int ToolbarSize { get; }
TypingTextFieldID
Control ID of the current typing input field
Declaration
public static int TypingTextFieldID { get; }
Methods
BackgroundLabel(IRect, char[], Color32, out IRect, int, GUIStyle)
Label with a color block as background
Declaration
public static void BackgroundLabel(IRect rect, char[] chars, Color32 backgroundColor, out IRect bounds, int backgroundPadding = 0, GUIStyle style = null)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
Color32 | backgroundColor | Color of the background block |
IRect | bounds | Rendering boundary of the text content in global space |
int | backgroundPadding | Border size of the background block in unified size |
BackgroundLabel(IRect, char[], Color32, int, GUIStyle)
Label with a color block as background
Declaration
public static void BackgroundLabel(IRect rect, char[] chars, Color32 backgroundColor, int backgroundPadding = 0, GUIStyle style = null)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
Color32 | backgroundColor | Color of the background block |
int | backgroundPadding | Border size of the background block in unified size |
BackgroundLabel(IRect, string, Color32, out IRect, int, bool, GUIStyle)
Label with a color block as background
Declaration
public static void BackgroundLabel(IRect rect, string text, Color32 backgroundColor, out IRect bounds, int backgroundPadding = 0, bool forceInside = false, GUIStyle style = null)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
string | text | Text content |
Color32 | backgroundColor | Color of the background block |
IRect | bounds | Rendering boundary of the text content in global space |
int | backgroundPadding | Border size of the background block in unified size |
bool | forceInside | True if the text content clamp inside the background block |
BackgroundLabel(IRect, string, Color32, int, bool, GUIStyle)
Label with a color block as background
Declaration
public static void BackgroundLabel(IRect rect, string text, Color32 backgroundColor, int backgroundPadding = 0, bool forceInside = false, GUIStyle style = null)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
string | text | Text content |
Color32 | backgroundColor | Color of the background block |
int | backgroundPadding | Border size of the background block in unified size |
bool | forceInside | True if the text content clamp inside the background block |
BeginChangeCheck()
Start the change check. Use GUI.EndChangeCheck to get the result
Declaration
public static void BeginChangeCheck()
BlankButton(IRect, out GUIState)
GUI element that behave like a button
Declaration
public static bool BlankButton(IRect rect, out GUIState state)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
Returns
Type | Description |
---|---|
bool | True if the button is pressed at current frame |
BlankSlider(int, IRect, int, int, int, out GUIState, bool, int)
Draw a slider that user can drag with mouse to change a intager value
Declaration
public static int BlankSlider(int controlID, IRect rect, int value, int min, int max, out GUIState state, bool vertical = false, int step = 0)
Parameters
Type | Name | Description |
---|---|---|
int | controlID | ID to identify the interaction of this element |
IRect | rect | Rect position in global space |
int | min | Minimal limitation for the value |
int | max | Maximal limitation for the value |
bool | vertical | True if this slider slide verticaly |
int | step | Smooth step of the sliding. 0 means no step. |
Returns
Type | Description |
---|---|
int | New value after slide |
BlankToggle(IRect, bool, out GUIState)
Draw a GUI element with a check box and check mark
Declaration
public static bool BlankToggle(IRect rect, bool isOn, out GUIState state)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
bool | isOn | True if the toggle is checked |
Returns
Type | Description |
---|---|
bool | True if the toggle is checked |
Button(IRect, int, out GUIState, GUIStyle)
GUI element that behave like a button
Declaration
public static bool Button(IRect rect, int icon, out GUIState state, GUIStyle style = null)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
int | icon | Artwork sprite ID for the icon inside this button |
Returns
Type | Description |
---|---|
bool | True if the button is pressed at current frame |
Button(IRect, int, GUIStyle)
GUI element that behave like a button
Declaration
public static bool Button(IRect rect, int icon, GUIStyle style = null)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
int | icon | Artwork sprite ID for the icon inside this button |
Returns
Type | Description |
---|---|
bool | True if the button is pressed at current frame |
Button(IRect, string, out GUIState, GUIStyle, int)
GUI element that behave like a button
Declaration
public static bool Button(IRect rect, string label, out GUIState state, GUIStyle style = null, int charSize = -2)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
string | label | Text content inside this button |
int | charSize | Character size of the label in unified space |
Returns
Type | Description |
---|---|
bool | True if the button is pressed at current frame |
Button(IRect, string, GUIStyle, int)
GUI element that behave like a button
Declaration
public static bool Button(IRect rect, string label, GUIStyle style = null, int charSize = -2)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
string | label | Text content inside this button |
int | charSize | Character size of the label in unified space |
Returns
Type | Description |
---|---|
bool | True if the button is pressed at current frame |
CancelTyping()
Stop typing on any input field
Declaration
public static void CancelTyping()
DarkButton(IRect, int)
GUI element that behave like a button
Declaration
public static bool DarkButton(IRect rect, int icon)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
int | icon | Artwork sprite ID for the icon inside this button |
Returns
Type | Description |
---|---|
bool | True if the button is pressed at current frame |
DarkButton(IRect, string, int)
GUI element that behave like a button
Declaration
public static bool DarkButton(IRect rect, string label, int charSize = -2)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
string | label | Text content inside this button |
int | charSize | Character size of the label in unified space |
Returns
Type | Description |
---|---|
bool | True if the button is pressed at current frame |
DrawAxis(Int2, Int2, Int2, int, int, int, int, Color32, Color32, int, GUIStyle, IRect)
Declaration
public static void DrawAxis(Int2 position, Int2 length, Int2 stepCount, int stepNumberGap, int thickness, int stepThickness, int z, Color32 colorX, Color32 colorY, int labelHeight = 0, GUIStyle labelStyle = null, IRect clampRect = default)
DrawSlice(AngeSprite, IRect)
Draw the artwork sprite with 9-slice logic. Border size will be unified.
Declaration
public static Cell[] DrawSlice(AngeSprite sprite, IRect rect)
Parameters
Type | Name | Description |
---|---|---|
AngeSprite | sprite | Artwork sprite |
IRect | rect | Rect position in global space |
Returns
Type | Description |
---|---|
Cell[] | Rendering cells of this element |
DrawSlice(int, IRect)
Draw the artwork sprite with 9-slice logic. Border size will be unified.
Declaration
public static Cell[] DrawSlice(int spriteID, IRect rect)
Parameters
Type | Name | Description |
---|---|---|
int | spriteID | ID of the artwork sprite |
IRect | rect | Rect position in global space |
Returns
Type | Description |
---|---|
Cell[] | Rendering cells of this element |
DrawStyleBody(IRect, GUIStyle, GUIState)
Draw the given style as body of a GUI element
Declaration
public static void DrawStyleBody(IRect rect, GUIStyle style, GUIState state)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
DrawStyleBody(IRect, GUIStyle, GUIState, Color32)
Draw the given style as body of a GUI element
Declaration
public static void DrawStyleBody(IRect rect, GUIStyle style, GUIState state, Color32 tint)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
Color32 | tint | Color tint that apply on this element |
DrawStyleContent(IRect, int, GUIStyle, GUIState, bool, bool)
Draw the given style as content of a GUI element
Declaration
public static void DrawStyleContent(IRect rect, int sprite, GUIStyle style, GUIState state, bool ignoreSlice = false, bool fit = false)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
int | sprite | Artwork sprite |
bool | ignoreSlice | True if not apply 9-slice logic |
bool | fit | True if keep the aspect ratio of the sprite |
EndChangeCheck()
True if any GUI element changed it's value during the change check
Declaration
public static bool EndChangeCheck()
FilledSlider(int, IRect, int, int, int, bool, int)
Draw a slider that user can drag with mouse to change a intager value
Declaration
public static int FilledSlider(int controlID, IRect rect, int value, int min, int max, bool vertical = false, int step = 0)
Parameters
Type | Name | Description |
---|---|---|
int | controlID | ID to identify the interaction of this element |
IRect | rect | Rect position in global space |
int | min | Minimal limitation for the value |
int | max | Maximal limitation for the value |
bool | vertical | True if this slider slide verticaly |
int | step | Smooth step of the sliding. 0 means no step. |
Returns
Type | Description |
---|---|
int | New value after slide |
FrameBasedIntLabel(IRect, FrameBasedInt, Color32, Color32, GUIStyle)
Label for draw FrameBasedInt as a buff
Declaration
public static void FrameBasedIntLabel(IRect rect, FrameBasedInt number, Color32 greaterColor, Color32 lessColor, GUIStyle style = null)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
FrameBasedInt | number | Intager content |
Color32 | greaterColor | Text color for the extra part when final value is greater |
Color32 | lessColor | Text color for the extra part when final value is less |
FrameBasedIntLabel(IRect, FrameBasedInt, Color32, Color32, out IRect, GUIStyle)
Label for draw FrameBasedInt as a buff
Declaration
public static void FrameBasedIntLabel(IRect rect, FrameBasedInt number, Color32 greaterColor, Color32 lessColor, out IRect bounds, GUIStyle style = null)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
FrameBasedInt | number | Intager content |
Color32 | greaterColor | Text color for the extra part when final value is greater |
Color32 | lessColor | Text color for the extra part when final value is less |
IRect | bounds | Rendering boundary of the text content in global space |
GetContentRect(IRect, GUIStyle, GUIState)
Get rect position in global space for content inside a GUI element
Declaration
public static IRect GetContentRect(IRect rect, GUIStyle style, GUIState state)
HandleSlider(int, IRect, int, int, int, bool, int)
Draw a slider that user can drag with mouse to change a intager value
Declaration
public static int HandleSlider(int controlID, IRect rect, int value, int min, int max, bool vertical = false, int step = 0)
Parameters
Type | Name | Description |
---|---|---|
int | controlID | ID to identify the interaction of this element |
IRect | rect | Rect position in global space |
int | min | Minimal limitation for the value |
int | max | Maximal limitation for the value |
bool | vertical | True if this slider slide verticaly |
int | step | Smooth step of the sliding. 0 means no step. |
Returns
Type | Description |
---|---|
int | New value after slide |
HighlightCursor(int, IRect)
Draw an animated cursor
Declaration
public static void HighlightCursor(int spriteID, IRect rect)
Parameters
Type | Name | Description |
---|---|---|
int | spriteID | Artwork sprite ID |
IRect | rect | Rect position in global space |
HighlightCursor(int, IRect, Color32)
Draw an animated cursor
Declaration
public static void HighlightCursor(int spriteID, IRect rect, Color32 color)
Parameters
Type | Name | Description |
---|---|---|
int | spriteID | Artwork sprite ID |
IRect | rect | Rect position in global space |
Color32 | color | Color tint for this element only |
HorizontalColorField(ColorF, IRect, bool, bool, bool, bool, ColorF?)
Draw a GUI element to edit color value
Declaration
public static ColorF HorizontalColorField(ColorF color, IRect rect, bool hsv = true, bool alpha = false, bool stepped = true, bool folded = false, ColorF? defaultColor = null)
Parameters
Type | Name | Description |
---|---|---|
ColorF | color | The color value |
IRect | rect | Rect position in global space |
bool | hsv | True if the field use HSV instead of RGB |
bool | alpha | True if the field include alpha value |
bool | stepped | True if the field use smooth step when dragging |
bool | folded | True if the field is folded |
ColorF? | defaultColor | Default value will set to the color value when user press the reset button. Set to null when you don't want the reset button. |
Returns
Type | Description |
---|---|
ColorF | New color after edit |
HorizontalColorField(ColorF, IRect, string, GUIStyle, bool, bool, bool, bool, ColorF?)
Draw a GUI element to edit color value
Declaration
public static ColorF HorizontalColorField(ColorF color, IRect rect, string label, GUIStyle labelStyle = null, bool hsv = true, bool alpha = false, bool stepped = true, bool folded = false, ColorF? defaultColor = null)
Parameters
Type | Name | Description |
---|---|---|
ColorF | color | The color value |
IRect | rect | Rect position in global space |
string | label | Text content display on left of the field |
GUIStyle | labelStyle | GUI style for the label |
bool | hsv | True if the field use HSV instead of RGB |
bool | alpha | True if the field include alpha value |
bool | stepped | True if the field use smooth step when dragging |
bool | folded | True if the field is folded |
ColorF? | defaultColor | Default value will set to the color value when user press the reset button. Set to null when you don't want the reset button. |
Returns
Type | Description |
---|---|
ColorF | New color after edit |
Icon(IRect, int)
Draw a artwork sprite as an icon
Declaration
public static void Icon(IRect rect, int sprite)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
int | sprite | Artwork sprite |
Icon(IRect, int, GUIStyle, GUIState)
Draw a artwork sprite as an icon
Declaration
public static void Icon(IRect rect, int sprite, GUIStyle style, GUIState state)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
int | sprite | Artwork sprite |
IconToggle(IRect, bool, int, GUIStyle, GUIStyle)
Draw a GUI element with a check box and check mark
Declaration
public static bool IconToggle(IRect rect, bool isOn, int icon, GUIStyle markStyle = null, GUIStyle iconStyle = null)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
bool | isOn | True if the toggle is checked |
int | icon | Artwork sprite of the content inside the toggle |
GUIStyle | markStyle | GUI style of the check mark |
GUIStyle | iconStyle | GUI style of the icon content |
Returns
Type | Description |
---|---|
bool | True if the toggle is checked |
InputField(int, IRect, string, GUIStyle, Color32?)
Draw a GUI element to allow the user to edit a text content
Declaration
public static string InputField(int controlID, IRect rect, string text, GUIStyle bodyStyle = null, Color32? selectionColor = null)
Parameters
Type | Name | Description |
---|---|---|
int | controlID | ID to identify the interaction of this element |
IRect | rect | Rect position in global space |
string | text | Input content |
Color32? | selectionColor | Color of the selection block |
Returns
Type | Description |
---|---|
string | Editted text content |
InputField(int, IRect, string, out bool, out bool, GUIStyle, Color32?)
Draw a GUI element to allow the user to edit a text content
Declaration
public static string InputField(int controlID, IRect rect, string text, out bool changed, out bool confirm, GUIStyle bodyStyle = null, Color32? selectionColor = null)
Parameters
Type | Name | Description |
---|---|---|
int | controlID | ID to identify the interaction of this element |
IRect | rect | Rect position in global space |
string | text | Input content |
bool | changed | True if the field changed it's content at current frame |
bool | confirm | True if the field stop edit at current frame |
Color32? | selectionColor | Color of the selection block |
Returns
Type | Description |
---|---|
string | Editted text content |
IntDial(IRect, int, out bool, string, GUIStyle, GUIStyle, GUIStyle, int, int, int)
Draw a label display an intager with two buttons to add and remove value
Declaration
public static int IntDial(IRect rect, int value, out bool changed, string label = null, GUIStyle labelStyle = null, GUIStyle bodyStyle = null, GUIStyle dialButtonStyle = null, int delta = 1, int min = -2147483648, int max = 2147483647)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
int | value | The intager value |
bool | changed | True if the value is changed in this frame |
string | label | Text content displays on the left |
GUIStyle | labelStyle | GUI style for the text label |
GUIStyle | bodyStyle | GUI style for the int field |
GUIStyle | dialButtonStyle | GUI style for the buttons |
int | delta | How many value does it add/remove when the button get pressed |
int | min | Minimal value for the intager |
int | max | Maximal value for the intager |
Returns
Type | Description |
---|---|
int | New value after modified |
IntDial(IRect, int, string, GUIStyle, GUIStyle, GUIStyle, int, int, int)
Draw a label display an intager with two buttons to add and remove value
Declaration
public static int IntDial(IRect rect, int value, string label = null, GUIStyle labelStyle = null, GUIStyle bodyStyle = null, GUIStyle dialButtonStyle = null, int delta = 1, int min = -2147483648, int max = 2147483647)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
int | value | The intager value |
string | label | Text content displays on the left |
GUIStyle | labelStyle | GUI style for the text label |
GUIStyle | bodyStyle | GUI style for the int field |
GUIStyle | dialButtonStyle | GUI style for the buttons |
int | delta | How many value does it add/remove when the button get pressed |
int | min | Minimal value for the intager |
int | max | Maximal value for the intager |
Returns
Type | Description |
---|---|
int | New value after modified |
IntLabel(IRect, int, GUIStyle)
Label for intager content
Declaration
public static void IntLabel(IRect rect, int number, GUIStyle style = null)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
int | number | Intager content |
IntLabel(IRect, int, out IRect, GUIStyle)
Label for intager content
Declaration
public static void IntLabel(IRect rect, int number, out IRect bounds, GUIStyle style = null)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
int | number | Intager content |
IRect | bounds | Rendering boundary of the text content in global space |
Label(IRect, char[], GUIStyle, int)
Draw a text content on screen
Declaration
public static void Label(IRect rect, char[] text, GUIStyle style = null, int charSize = -2)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
char[] | text | Text content |
int | charSize | Unified height of the character |
Label(IRect, char[], out IRect, GUIStyle, int)
Draw a text content on screen
Declaration
public static void Label(IRect rect, char[] text, out IRect bounds, GUIStyle style = null, int charSize = -2)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
char[] | text | Text content |
IRect | bounds | Total rendering boundary of the characters in global space |
int | charSize | Unified height of the character |
Label(IRect, string, GUIStyle, int)
Draw a text content on screen
Declaration
public static void Label(IRect rect, string text, GUIStyle style = null, int charSize = -2)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
string | text | Text content |
int | charSize | Unified height of the character |
Label(IRect, string, out IRect, GUIStyle, int)
Draw a text content on screen
Declaration
public static void Label(IRect rect, string text, out IRect bounds, GUIStyle style = null, int charSize = -2)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
string | text | Text content |
IRect | bounds | Total rendering boundary of the characters in global space |
int | charSize | Unified height of the character |
Label(IRect, string, int, bool, out IRect, out int, GUIStyle, int)
Draw a text content on screen
Declaration
public static void Label(IRect rect, string text, int startIndex, bool drawInvisibleChar, out IRect bounds, out int endIndex, GUIStyle style = null, int charSize = -2)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
string | text | Text content |
int | startIndex | Label content start with this index |
bool | drawInvisibleChar | True if invisible characters should make the internal iteration grow |
IRect | bounds | Total rendering boundary of the characters in global space |
int | endIndex | Last rendered character index |
int | charSize | Unified height of the character |
Label(IRect, string, int, int, bool, out IRect, out IRect, out int, GUIStyle, int)
Draw a text content on screen
Declaration
public static void Label(IRect rect, string text, int beamIndex, int startIndex, bool drawInvisibleChar, out IRect bounds, out IRect beamRect, out int endIndex, GUIStyle style = null, int charSize = -2)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
string | text | Text content |
int | beamIndex | Index of the typing beam inside the text content |
int | startIndex | Label content start with this index |
bool | drawInvisibleChar | True if invisible characters should make the internal iteration grow |
IRect | bounds | Total rendering boundary of the characters in global space |
IRect | beamRect | Rendering rect position of the typing beam |
int | endIndex | Last rendered character index |
int | charSize | Unified height of the character |
LinkButton(IRect, string, GUIStyle, bool, int)
Button that behave like a link
Declaration
public static bool LinkButton(IRect rect, string label, GUIStyle labelStyle = null, bool useUnderLine = true, int charSize = -2)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
string | label | Text content |
GUIStyle | labelStyle | GUI style for the label content |
bool | useUnderLine | True if draw a line below the text |
int | charSize | Character size in unified space |
Returns
Type | Description |
---|---|
bool | True if the link is pressed at current frame |
LinkButton(IRect, string, out IRect, GUIStyle, bool, int)
Button that behave like a link
Declaration
public static bool LinkButton(IRect rect, string label, out IRect bounds, GUIStyle labelStyle = null, bool useUnderLine = true, int charSize = -2)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
string | label | Text content |
IRect | bounds | Boundary of the rendered content in global space |
GUIStyle | labelStyle | GUI style for the label content |
bool | useUnderLine | True if draw a line below the text |
int | charSize | Character size in unified space |
Returns
Type | Description |
---|---|
bool | True if the link is pressed at current frame |
PopupTriangleIcon(IRect, int)
Draw the triangle icon inside a popup button
Declaration
public static void PopupTriangleIcon(IRect rect, int iconSprite = 0)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position of the whole button in global space |
int | iconSprite | Artwork sprite ID. Leave it 0 to use the built-in sprite |
ReverseUnify(int)
Convert global size into unified size
Declaration
public static int ReverseUnify(int value)
ReverseUnifyMonitor(int)
Convert global size into unified size based on monitor size instead of application window height
Declaration
public static int ReverseUnifyMonitor(int value)
ScrollBar(int, IRect, int, int, int, GUIStyle, GUIStyle, bool)
Draw a bar that slide when user drag the handle inside
Declaration
public static int ScrollBar(int controlID, IRect contentRect, int position, int totalSize, int pageSize, GUIStyle handleStyle = null, GUIStyle bgStyle = null, bool vertical = true)
Parameters
Type | Name | Description |
---|---|---|
int | controlID | ID to identify the interaction of this element |
IRect | contentRect | Rect position of the content panel in global space |
int | position | Scrolling offset position in global space |
int | totalSize | Size of all content in global space |
int | pageSize | Size of the displaying content in global space |
GUIStyle | handleStyle | GUI style for the handle |
GUIStyle | bgStyle | GUI style for the background |
bool | vertical | True if it scrolls in vertical direction |
Returns
Type | Description |
---|---|
int | New position value |
ScrollLabel(string, IRect, int, GUIStyle)
Label that scroll the content inside verticaly
Declaration
public static int ScrollLabel(string text, IRect rect, int scrollPosition, GUIStyle style)
Parameters
Type | Name | Description |
---|---|---|
string | text | Text content |
IRect | rect | Rect position in global space |
int | scrollPosition | Offset Y position in global space |
Returns
Type | Description |
---|---|
int | The new scrolling position |
SetChange()
Mark the GUI system as changed
Declaration
public static void SetChange()
ShadowLabel(IRect, char[], int, GUIStyle)
Label with shadow below
Declaration
public static void ShadowLabel(IRect rect, char[] chars, int shadowDistance = 3, GUIStyle style = null)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
int | shadowDistance | Offset Y of the shadow in unified space |
ShadowLabel(IRect, string, int, GUIStyle)
Label with shadow below
Declaration
public static void ShadowLabel(IRect rect, string text, int shadowDistance = 3, GUIStyle style = null)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
string | text | Text content |
int | shadowDistance | Offset Y of the shadow in unified space |
Slider(int, IRect, int, int, int, GUIStyle, GUIStyle, GUIStyle, bool, int)
Draw a slider that user can drag with mouse to change a intager value
Declaration
public static int Slider(int controlID, IRect rect, int value, int min, int max, GUIStyle bodyStyle, GUIStyle handleStyle, GUIStyle fillStyle, bool vertical = false, int step = 0)
Parameters
Type | Name | Description |
---|---|---|
int | controlID | ID to identify the interaction of this element |
IRect | rect | Rect position in global space |
int | min | Minimal limitation for the value |
int | max | Maximal limitation for the value |
bool | vertical | True if this slider slide verticaly |
int | step | Smooth step of the sliding. 0 means no step. |
Returns
Type | Description |
---|---|
int | New value after slide |
SmallInputField(int, IRect, string, out bool, out bool, Color32?)
Draw a GUI element to allow the user to edit a text content
Declaration
public static string SmallInputField(int controlID, IRect rect, string text, out bool changed, out bool confirm, Color32? selectionColor = null)
Parameters
Type | Name | Description |
---|---|---|
int | controlID | ID to identify the interaction of this element |
IRect | rect | Rect position in global space |
string | text | Input content |
bool | changed | True if the field changed it's content at current frame |
bool | confirm | True if the field stop edit at current frame |
Color32? | selectionColor | Color of the selection block |
Returns
Type | Description |
---|---|
string | Editted text content |
SmallInputField(int, IRect, string, Color32?)
Draw a GUI element to allow the user to edit a text content
Declaration
public static string SmallInputField(int controlID, IRect rect, string text, Color32? selectionColor = null)
Parameters
Type | Name | Description |
---|---|---|
int | controlID | ID to identify the interaction of this element |
IRect | rect | Rect position in global space |
string | text | Input content |
Color32? | selectionColor | Color of the selection block |
Returns
Type | Description |
---|---|
string | Editted text content |
SmallIntDial(IRect, int, out bool, string, int, int, int)
Draw a label display an intager with two buttons to add and remove value
Declaration
public static int SmallIntDial(IRect rect, int value, out bool changed, string label = null, int delta = 1, int min = -2147483648, int max = 2147483647)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
int | value | The intager value |
bool | changed | True if the value is changed in this frame |
string | label | Text content displays on the left |
int | delta | How many value does it add/remove when the button get pressed |
int | min | Minimal value for the intager |
int | max | Maximal value for the intager |
Returns
Type | Description |
---|---|
int | New value after modified |
SmallIntDial(IRect, int, string, int, int, int)
Draw a label display an intager with two buttons to add and remove value
Declaration
public static int SmallIntDial(IRect rect, int value, string label = null, int delta = 1, int min = -2147483648, int max = 2147483647)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
int | value | The intager value |
string | label | Text content displays on the left |
int | delta | How many value does it add/remove when the button get pressed |
int | min | Minimal value for the intager |
int | max | Maximal value for the intager |
Returns
Type | Description |
---|---|
int | New value after modified |
SmallLabel(IRect, char[])
Draw a text content on screen
Declaration
public static void SmallLabel(IRect rect, char[] text)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
char[] | text | Text content |
SmallLabel(IRect, char[], out IRect)
Draw a text content on screen
Declaration
public static void SmallLabel(IRect rect, char[] text, out IRect bounds)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
char[] | text | Text content |
IRect | bounds | Total rendering boundary of the characters in global space |
SmallLabel(IRect, string)
Draw a text content on screen
Declaration
public static void SmallLabel(IRect rect, string text)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
string | text | Text content |
SmallLabel(IRect, string, out IRect)
Draw a text content on screen
Declaration
public static void SmallLabel(IRect rect, string text, out IRect bounds)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
string | text | Text content |
IRect | bounds | Total rendering boundary of the characters in global space |
SmallLabel(IRect, string, int, bool, out IRect, out int)
Draw a text content on screen
Declaration
public static void SmallLabel(IRect rect, string text, int startIndex, bool drawInvisibleChar, out IRect bounds, out int endIndex)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
string | text | Text content |
int | startIndex | Label content start with this index |
bool | drawInvisibleChar | True if invisible characters should make the internal iteration grow |
IRect | bounds | Total rendering boundary of the characters in global space |
int | endIndex | Last rendered character index |
SmallLabel(IRect, string, int, int, bool, out IRect, out IRect, out int)
Draw a text content on screen
Declaration
public static void SmallLabel(IRect rect, string text, int beamIndex, int startIndex, bool drawInvisibleChar, out IRect bounds, out IRect beamRect, out int endIndex)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
string | text | Text content |
int | beamIndex | Index of the typing beam inside the text content |
int | startIndex | Label content start with this index |
bool | drawInvisibleChar | True if invisible characters should make the internal iteration grow |
IRect | bounds | Total rendering boundary of the characters in global space |
IRect | beamRect | Rendering rect position of the typing beam |
int | endIndex | Last rendered character index |
SmallLinkButton(IRect, string, out IRect, bool, int)
Button that behave like a link
Declaration
public static bool SmallLinkButton(IRect rect, string label, out IRect bounds, bool useUnderLine = true, int charSize = -2)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
string | label | Text content |
IRect | bounds | Boundary of the rendered content in global space |
bool | useUnderLine | True if draw a line below the text |
int | charSize | Character size in unified space |
Returns
Type | Description |
---|---|
bool | True if the link is pressed at current frame |
SmallLinkButton(IRect, string, bool, int)
Button that behave like a link
Declaration
public static bool SmallLinkButton(IRect rect, string label, bool useUnderLine = true, int charSize = -2)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
string | label | Text content |
bool | useUnderLine | True if draw a line below the text |
int | charSize | Character size in unified space |
Returns
Type | Description |
---|---|
bool | True if the link is pressed at current frame |
StartTyping(int)
Procedurelly start typing with an input field
Declaration
public static void StartTyping(int controlID)
Parameters
Type | Name | Description |
---|---|---|
int | controlID | Control ID of the target input field |
Toggle(IRect, bool, GUIStyle, GUIStyle)
Draw a GUI element with a check box and check mark
Declaration
public static bool Toggle(IRect rect, bool isOn, GUIStyle bodyStyle = null, GUIStyle markStyle = null)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
bool | isOn | True if the toggle is checked |
GUIStyle | bodyStyle | GUI style of the toggle box |
GUIStyle | markStyle | GUI style of the check mark |
Returns
Type | Description |
---|---|
bool | True if the toggle is checked |
Toggle(IRect, bool, string, GUIStyle, GUIStyle, GUIStyle)
Draw a GUI element with a check box and check mark
Declaration
public static bool Toggle(IRect rect, bool isOn, string label, GUIStyle bodyStyle = null, GUIStyle markStyle = null, GUIStyle labelStyle = null)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
bool | isOn | True if the toggle is checked |
string | label | Text content inside the toggle |
GUIStyle | bodyStyle | GUI style of the toggle box |
GUIStyle | markStyle | GUI style of the check mark |
GUIStyle | labelStyle | GUI style of the text label |
Returns
Type | Description |
---|---|
bool | True if the toggle is checked |
ToggleButton(IRect, bool, int, GUIStyle)
Draw a GUI element with a check box and check mark
Declaration
public static bool ToggleButton(IRect rect, bool isOn, int icon, GUIStyle style = null)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
bool | isOn | True if the toggle is checked |
int | icon | Artwork sprite of the content inside the toggle |
Returns
Type | Description |
---|---|
bool | True if the toggle is checked |
ToggleButton(IRect, bool, string, GUIStyle)
Draw a GUI element with a check box and check mark
Declaration
public static bool ToggleButton(IRect rect, bool isOn, string label, GUIStyle bodyStyle = null)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
bool | isOn | True if the toggle is checked |
string | label | Text content inside the toggle |
GUIStyle | bodyStyle | GUI style of the toggle box |
Returns
Type | Description |
---|---|
bool | True if the toggle is checked |
ToggleFold(IRect, ref bool, int, string, int, int)
Draw a GUI element with a check box and check mark
Declaration
public static bool ToggleFold(IRect rect, ref bool folding, int icon, string label, int paddingLeft = 0, int paddingRight = 0)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
bool | folding | True if the panel if folded |
int | icon | Artwork sprite of the content inside the toggle |
string | label | Text content inside the toggle |
Returns
Type | Description |
---|---|
bool | True if the toggle is checked |
ToggleLeft(IRect, bool, string, GUIStyle, GUIStyle, GUIStyle)
Draw a GUI element with a check box and check mark
Declaration
public static bool ToggleLeft(IRect rect, bool isOn, string label, GUIStyle bodyStyle = null, GUIStyle labelStyle = null, GUIStyle markStyle = null)
Parameters
Type | Name | Description |
---|---|---|
IRect | rect | Rect position in global space |
bool | isOn | True if the toggle is checked |
string | label | Text content inside the toggle |
GUIStyle | bodyStyle | GUI style of the toggle box |
GUIStyle | labelStyle | GUI style of the text label |
GUIStyle | markStyle | GUI style of the check mark |
Returns
Type | Description |
---|---|
bool | True if the toggle is checked |
Unify(int)
Convert unified size into global size
Declaration
public static int Unify(int value)
UnifyBorder(Int4)
Convert unified size into global size
Declaration
public static Int4 UnifyBorder(Int4 border)
UnifyMonitor(int)
Convert unified size into global size based on monitor size instead of application window height
Declaration
public static int UnifyMonitor(int value)
VerticalColorField(ColorF, IRect, bool, bool, bool, bool, ColorF?)
Draw a GUI element to edit color value
Declaration
public static ColorF VerticalColorField(ColorF color, IRect rect, bool hsv = true, bool alpha = false, bool stepped = true, bool folded = false, ColorF? defaultColor = null)
Parameters
Type | Name | Description |
---|---|---|
ColorF | color | The color value |
IRect | rect | Rect position in global space |
bool | hsv | True if the field use HSV instead of RGB |
bool | alpha | True if the field include alpha value |
bool | stepped | True if the field use smooth step when dragging |
bool | folded | True if the field is folded |
ColorF? | defaultColor | Default value will set to the color value when user press the reset button. Set to null when you don't want the reset button. |
Returns
Type | Description |
---|---|
ColorF | New color after edit |
VerticalColorField(ColorF, IRect, string, GUIStyle, bool, bool, bool, bool, ColorF?)
Draw a GUI element to edit color value
Declaration
public static ColorF VerticalColorField(ColorF color, IRect rect, string label, GUIStyle labelStyle = null, bool hsv = true, bool alpha = false, bool stepped = true, bool folded = false, ColorF? defaultColor = null)
Parameters
Type | Name | Description |
---|---|---|
ColorF | color | The color value |
IRect | rect | Rect position in global space |
string | label | Text content display on left of the field |
GUIStyle | labelStyle | GUI style for the label |
bool | hsv | True if the field use HSV instead of RGB |
bool | alpha | True if the field include alpha value |
bool | stepped | True if the field use smooth step when dragging |
bool | folded | True if the field is folded |
ColorF? | defaultColor | Default value will set to the color value when user press the reset button. Set to null when you don't want the reset button. |
Returns
Type | Description |
---|---|
ColorF | New color after edit |