UI
Functions
AddMenuButton
function UI.AddMenuButton((string) ButtonText , (function) FunctionToCall, (optional) other parameters)
UI.AddMenuButton
Adds a button to the pause menu
GetSprite
function UI.GetSprite((string)Sprite name)
Parameter | Type | |
---|---|---|
Sprite name | string |
Filename without extension of the desired Sprite |
UI.GetSprite
Returns a sprite with the desired filename without extension. To get your own sprites this way place them as .png files in the 'sprites' folder or the 'icons' folder of your mod.
Example
UI.GetSprite("missing")
AddBlueButton
function UI.AddBlueButton((RectTransform)Parent , (string)Text, (string)Tag, (function)Callback)
Parameter | Type | |
---|---|---|
Parent | RectTransform |
Parent of the new button. |
Text | string |
Text to show on the button |
Tag | string |
Tag that can be used to retrieve this button later. |
Callback | function |
Function to call back when this button is pressed |
UI.AddBlueButton
Adds a blue button to a parent RectTransform with a tag that can be used to retrieve it later.
Example
UI.AddBlueButton(rect,"Button", "buttons", Callback)
AddCloseButton
function UI.AddCloseButton((RectTransform)Parent , (string)Text, (string)Tag, (function)Callback)
Parameter | Type | |
---|---|---|
Parent | RectTransform |
Parent of the new button. |
Text | string |
Text to show on the button |
Tag | string |
Tag that can be used to retrieve this button later. |
Callback | function |
Function to call back when this button is pressed |
UI.AddCloseButton
Adds a red close button to a parent RectTransform with a tag that can be used to retrieve it later.
Example
UI.AddCloseButton(rect,"Button", "buttons", Callback)
DeleteWithTag
function UI.DeleteWithTag((string)Tag)
Parameter | Type | |
---|---|---|
Tag | string |
Tag to delete |
UI.DeleteWithTag
Deletes all UI elements found with the specified tag
Example
UI.DeleteWithTag("trophy")
NewColor
function UI.NewColor((float)Red , (float)Green, (float)Blue, (float)Alpha)
Parameter | Type | |
---|---|---|
Red | float |
Red Value decimal between 0 and 1 |
Green | float |
Green Value decimal between 0 and 1 |
Blue | float |
Blue Value decimal between 0 and 1 |
Alpha | float |
Alpha Value decimal between 0 and 1 |
UI.NewColor
Returns a color with the desired parameters.
Example
UI.NewColor(1,1,1,1)
ColorFromHex
function UI.ColorFromHex((string)Hex color)
Parameter | Type | |
---|---|---|
Hex color | string |
Hex code for a color |
UI.ColorFromHex
Returns a color with the desired hex code.
Example
UI.ColorFromHex(#fff)
ShowCornerNotification
function UI.ShowCornerNotification((string) text)
UI.ShowCornerNotification
Shows a corner notification
ShowTopNotification
function UI.ShowTopNotification((string) text)
UI.ShowTopNotification
Shows a top notification
ReceiveChatMessage
function UI.ReceiveChatMessage((string) text)
UI.ReceiveChatMessage
Adds a string to the chat messages