Class GenericPopupUI
Popup menu UI for general perpose
Constructors
GenericPopupUI()
Declaration
public GenericPopupUI()
Properties
BackgroundRect
Rect position of the background in global space
Declaration
public IRect BackgroundRect { get; }
BlockEvent
True if this UI blocks mouse button event
Declaration
protected override bool BlockEvent { get; }
Overrides
CurrentSubLevel
Recursive layer count of the sub-menu if a new item is added
Declaration
public int CurrentSubLevel { get; set; }
Instance
Global single instance of this entity
Declaration
public static GenericPopupUI Instance { get; }
InvokingItemData
Custom data of the currently pressed item
Declaration
public static object InvokingItemData { get; }
InvokingItemlabel
Label of the currently pressed item
Declaration
public static string InvokingItemlabel { get; }
MenuID
Custom ID of the menu
Declaration
public int MenuID { get; }
OffsetX
Position offset X in global space between left edge of the camera to the left edge of this menu
Declaration
public int OffsetX { get; set; }
OffsetY
Position offset X in global space between bottom edge of the camera to the bottom edge of this menu
Declaration
public int OffsetY { get; set; }
ShowingPopup
True is the menu is currently displaying
Declaration
public static bool ShowingPopup { get; }
Methods
AddItem(string, Action, bool, bool, object, bool)
Add a new item (call BeginPopup first)
Declaration
public static void AddItem(string label, Action action, bool enabled = true, bool @checked = false, object data = null, bool editable = false)
Parameters
Type | Name | Description |
---|---|---|
string | label | Text content inside this item |
Action | action | This function is called when the item is pressed |
bool | enabled | True if this item can be press |
bool | checked | True if there should be a check mark display on this item |
object | data | Custom data for this item. Get this data with GenericPopupUI.InvokingItemData inside the "action" from param |
bool | editable | True if this label can be edit by the user |
AddItem(string, int, Direction2, int, Action, bool, bool, object, bool)
Add a new item (call BeginPopup first)
Declaration
public static void AddItem(string label, int icon, Direction2 iconPosition, int checkMarkSprite, Action action, bool enabled = true, bool @checked = false, object data = null, bool editable = false)
Parameters
Type | Name | Description |
---|---|---|
string | label | Text content inside this item |
int | icon | Artwork sprite of this item |
Direction2 | iconPosition | Position offset of this icon |
int | checkMarkSprite | Artwork sprite of the check mark |
Action | action | This function is called when the item is pressed |
bool | enabled | True if this item can be press |
bool | checked | True if there should be a check mark display on this item |
object | data | Custom data for this item. Get this data with GenericPopupUI.InvokingItemData inside the "action" from param |
bool | editable | True if this label can be edit by the user |
AddSeparator()
Add a empty line (call BeginPopup first)
Declaration
public static void AddSeparator()
BeginPopup(Int2, int)
Start to make a new menu list
Declaration
public static void BeginPopup(Int2 globalOffset, int menuID = 0)
BeginPopup(int)
Start to make a new menu list
Declaration
public static void BeginPopup(int menuID = 0)
BeginSubItem()
Start to make a sub menu
Declaration
public static void BeginSubItem()
ClearItems()
Remove all items inside the current popup menu
Declaration
public static void ClearItems()
ClosePopup()
Close current open popup menu
Declaration
public static void ClosePopup()
EndSubItem()
Stop making a sub menu
Declaration
public static void EndSubItem()
FirstUpdate()
[1/4] This function is called every frame when entity is in stage. Prioritize using this function to fill collider in to physics system.
Declaration
public override void FirstUpdate()
Overrides
OnActivated()
This function is called when entity enter the stage
Declaration
public override void OnActivated()
Overrides
OnInactivated()
This function is called when entity leave the stage
Declaration
public override void OnInactivated()
Overrides
SetTint(Color32, Color32)
Set color tint for the popup menu ui
Declaration
public static void SetTint(Color32 labelTint, Color32 iconTint)
UpdateUI()
Declaration
public override void UpdateUI()