#
PowerButtons
Fields
Methods
#
Constructors
No constructors
#
Fields
#
CustomButtons: Dictionary<string, PowerButton>
Dictionary with all custom buttons which made with NCMS
#
Methods
#
CreateButton(name, sprite, localName, localDescription, position, type = ButtonType.Click, parent = null, call = null): PowerButton
Creates new PowerButton
Returns: PowerButton
Example:
//...
var sprite = NCMS.Utils.Sprites.LoadSprite($"{Mod.Info.Path}/icon.png");
var button = NCMS.Utils.PowerButtons.CreateButton("exampleButton", sprite, "Example Button", "This is the example button", Vector2.zero, NCMS.Utils.ButtonType.Click, null, exampleMethod);
//...
static void exampleMethod(){
Debug.Log("Example Button was clicked");
}
#
CreateTextButton(name, text, position, color, position, parent = null, callback = null): UnityEngine.Button
Creates new PowerButton
Returns: UnityEngine.Button
#
AddButtonToTab(button, tab, position): void
Attaches PowerButton to PowersTab
Returns: void
Example:
//...
var sprite = NCMS.Utils.Sprites.LoadSprite($"{Mod.Info.Path}/icon.png");
var button = NCMS.Utils.PowerButtons.CreateButton("exampleButton", sprite, "Example Button", "This is the example button", Vector2.zero, NCMS.Utils.ButtonType.Click, null, exampleMethod);
NCMS.Utils.PowerButtons.AddButtonToTab(button, NCMS.Utils.PowerTab.Main, new Vector2(332, -18));
//...
static void exampleMethod(){
Debug.Log("Example Button was clicked");
}
Result:
#
GetToggleValue(name): bool
Checks current state of button with type Toggle
Returns: bool
#
ToggleButton(name): void
Changes current state of button with type Toggle
Returns: void