Table of Contents
ModHelperComponent for a PopUp menu similar to desktop right click menus
public class ModHelperPopupMenu : BTD_Mod_Helper.Api.Components.ModHelperPanel
Inheritance UnityEngine.MonoBehaviour ModHelperComponent ModHelperPanel ModHelperPopupMenu
Whether the menu should automatically hide when a click happens elsewhere
public bool autoHide;
The parent object that this is for, used for determining if clicks elsewhere will auto hide the menu or not
public ModHelperComponent parentComponent;
Whether this menu is open or not
public bool IsShowing { get; }
The current ModHelperPopupOptions in the menu
public System.Collections.Generic.IEnumerable<BTD_Mod_Helper.Api.Components.ModHelperPopupOption> Options { get; }
System.Collections.Generic.IEnumerable<ModHelperPopupOption>
Add an option to the menu
public BTD_Mod_Helper.Api.Components.ModHelperPopupMenu AddOption(BTD_Mod_Helper.Api.Components.Info info, string text=null, string icon=null, UnityAction action=null, BTD_Mod_Helper.Api.Components.ModHelperPopupMenu subMenu=null, Func<bool> isSelected=null);
info
Info
The info to use for its size, if no Height is set, 75 will be used
text
System.String
Option label, if null then uses the Name from the info
icon
System.String
Option icon, null for no icon, empty string for still creating the icon but it being empty
action
UnityEngine.Events.UnityAction
Action to perform when this option is clicked
subMenu
ModHelperPopupMenu
Sub menu that this option opens
isSelected
Il2CppSystem.Func
Function to determine if this option should display as selected or not
ModHelperPopupMenu
this
Add an option to the menu
public BTD_Mod_Helper.Api.Components.ModHelperPopupMenu AddOption(BTD_Mod_Helper.Api.Components.ModHelperPopupOption option);
option
ModHelperPopupOption
Option to add
ModHelperPopupMenu
this
Adds a horizontal separation line to the menu
public BTD_Mod_Helper.Api.Components.ModHelperPopupMenu AddSeparator(int height=2);
height
System.Int32
ModHelperPopupMenu
this
Constructs a new PopUp Menu, and makes it inactive to start
public static BTD_Mod_Helper.Api.Components.ModHelperPopupMenu Create(BTD_Mod_Helper.Api.Components.Info info, bool fitSize=true);
info
Info
the initial info for the menu
fitSize
System.Boolean
whether to use a UnityEngine.UI.ContentSizeFitter
ModHelperPopupMenu
the created menu
Hide the menu
public void Hide(bool propagate=false);
propagate
System.Boolean
Show the menu
public void Show();