Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Creating Buttons

Plague edited this page Oct 10, 2021 · 5 revisions

To Create A Button, Use:

ButtonAPI.CreateButton(ButtonAPI.ButtonType.Default, "Text On Your Button Here", "Your ToolTip Here", ButtonAPI.HorizontalPosition.FirstButtonPos, ButtonAPI.VerticalPosition.TopButton, null/*Your Parent Transform*/, delegate (bool a)
{
    //Your Code When The Button Is Clicked Here
}, Color.white/*ToggledOffColour*/, Color.magenta/*ToggledOnColour, Always Used On Default ButtonType*/, null/*BorderColour, Set To Null To Inherit The Current QuickMenu Button Colours*/, true/*FullSizeButton, If You Want The Button To Be Full Size, Or Half The Hight*/, false/*ButtomHalf, If You Want The Button Placed On The Top Half Of The Button (If This Button Is Half Sized) Or The Bottom Half*/, false/*HalfHorizontally, Whether You Want The Button Size Cut In Half Horizontally*/, false/*CurrentToggleState, Typically A Boolean In Your Mod, Only Applies If Current Button Is ButtonType.Toggle*/, null/*SpriteForButton, The Option To Add A Sprite Image As Your Button's Background*/, true/*ChangeColourOnClick, Only Change This If You Will Be Changing The Text Colour To OnColour Manually In Your OnClick Delegate*/);

To Create A SubMenu, Use:

ButtonAPI.MakeEmptyPage("SubMenuInternalNameHere", "An Optional Title For Your SubMenu That Will Be Above The QuickMenu Here", "An Optional ToolTip For When You Hover Over The Title Of The SubMenu", Color.magenta/*An Optional OnColour For The Title If You're Making It A Toggle, You Can Pass Null Otherwise*/, Color.white/*An Optional OffColour Here, This Sets The Standard Colour Of The Title, And The OnColour If Being Made A Toggle, If Either This Or OnColour Are Defined, It Will Use That Colour By Default If It Is Available, If Both Are Null, It Will Use Color.white.*/, delegate (bool a)
{
    //Optional OnClick For The Title Here
});

Tip: Add .transform To The End Of That Code To Use It As The Parent For Your Buttons.

Context: If A SubMenu With The Same InternalName Was Already Created Before, This Will Simply Return It And Not Make A New Page.

To Enter A SubMenu; Such As In Your Button's OnClick, Use:

ButtonAPI.EnterSubMenu(LocalVariableOfSubMenuTransform/*Or You Can Paste The Code Just Above In Here To Make The SubMenu Page As You Enter It, Or Return It If It Was Made Beforehand*/);
Clone this wiki locally