Skip to content
Leonardo Emanuele edited this page Aug 5, 2023 · 9 revisions

UIMenu is the NativeUI main class, it creates the base menu for you to add items to.

C#

UIMenu mainMenu = new UIMenu("Banner Title", "SUBTITLE", new PointF(0, 0));
MenuPool.Add(mainMenu); // (deprecated after The Gary release v4)

Lua:

local mainMenu = UIMenu.New("Banner Title", "SUBTITLE", 0, 0)
MenuPool:Add(mainMenu) -- (deprecated after The Gary release v4)

UIMenu

image
The base of each menu.
UIMenu contains the banner, title, subtitle, descriptions, a list of items and windows, the events when anything happens is handled by the menu itself.
It controls everything.. 👀
How do we create a UIMenu?
It is created like this:
C#:

public UIMenu(string title, string subtitle, bool glare = false, bool alternativeTitle = false, float fadingTime = 0.1f)
public UIMenu(string title, string subtitle, PointF offset, bool glare = false, bool alternativeTitle = false, float fadingTime = 0.1f)
public UIMenu(string title, string subtitle, PointF offset, KeyValuePair<string, string> customBanner, bool glare = false, bool alternativeTitle = false, float fadingTime = 0.1f)
public UIMenu(string title, string subtitle, PointF offset, string spriteLibrary, string spriteName, bool glare = false, bool alternativeTitle = false, float fadingTime = 0.1f)

Lua:

UIMenu.New(Title, Subtitle, X, Y, glare, txtDictionary, txtName, alternativeTitle, fadingTime)

What can i do with it?
These are some of the main things you can do with it:
C#:

bool MouseControlsEnabled // true to use mouse 
bool EnableAnimation // enable / disable the scrolling animation (deprecated)
MenuAnimationType AnimationType // what scrolling animation you want it to do? 
bool MouseWheelControlEnabled // true to enable the mouse wheel to scroll the menu
int MaxItemsOnScreen // the number of item to see on the screen before the scrolling kicks in.
ItemFont DescriptionFont // the font that will be used to draw the description text (default ScaleformFonts.CHALET_LONDON_NINETEENSIXTY)
ScrollingType ScrollingType // how the menu will be scrolled (CLASSIC, PAGINATED, ENDLESS)
AddItem(UIMenuItem item) // adds an item to the menu
RemoveItemAt(int index) // removes an item by its index
RemoveItem(UIMenuItem item) // removes an item
AddWindow(UIMenuWindow window) // Adds a windows to the menu
RemoveWindowAt(int index) // removes the window at index
GoUp() // makes the menu go up by 1 item
GoDown() // makes the menu go down by 1 item
GoLeft() // if the item supports it, it makes the item index go left once
GoRight() // if the item supports it, it makes the item index go right once
Select(bool playSound) // the same as pressing return on your keyboard
GoBack() // the same as pressing backspace on your keyboard
bool Visible // this activate the menu and makes it visible on screen, it can return if the menu is visible or not
int CurrentSelection // sets or returns the current selection in menu
bool IsUsingController // returns true if you're using the controller
IndexChangedEvent OnIndexChange(UIMenu sender, int newIndex) // this is called everytime you go up or down in the menu
ItemSelectEvent OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index) // called when a UIMenuItem is selected
CheckboxChangeEvent OnCheckboxChange(UIMenu sender, UIMenuCheckboxItem checkboxItem, bool Checked) // called when a UIMenuCheckBoxItem is changed true or false
ListChangedEvent OnListChange(UIMenu sender, UIMenuListItem listItem, int newIndex)  // called when a UIMenuListItem is changed left or right
ListSelectedEvent OnListSelect(UIMenu sender, UIMenuListItem listItem, int newIndex) // called when a UIMenuListItem is selected
SliderChangedEvent OnSliderChange(UIMenu sender, UIMenuSliderItem listItem, int newIndex) // called when a UIMenuSliderItem is changed left or right
OnProgressChanged OnProgressChange(UIMenu menu, UIMenuProgressItem item, int newIndex) // called when a UIMenuProgressItem is changed left or right
OnProgressSelected OnProgressSelect(UIMenu menu, UIMenuProgressItem item, int newIndex) // called when a UIMenuProgressItem is selected
StatItemProgressChange OnStatsItemChanged(UIMenu menu, UIMenuStatsItem item, int value) // called when a UIMenuStatsItem is changed left or right
ColorPanelChangedEvent OnColorPanelChange(UIMenuItem menu, UIMenuColorPanel panel, int index) // called when a UIMenuColorPanel is interacted with
PercentagePanelChangedEvent OnPercentagePanelChange(UIMenuItem menu, UIMenuPercentagePanel panel, float value) // called when a UIMenuPercentagePanel is interacted with
GridPanelChangedEvent OnGridPanelChange(UIMenuItem menu, UIMenuGridPanel panel, PointF value) // called when a UIMenuGridPanel is interacted with
MenuStateChangeEvent OnMenuStateChanged(UIMenu oldMenu, UIMenu newMenu, MenuState state) // called when a the menu is opened, closed, changed to a submenu, or gone back to a parent menu

Lua:

:MaxItemsOnScreen(max) -- the number of item to see on the screen before the scrolling kicks in.
:AnimationEnabled(enable) -- enable / disable the scrolling animation
:AnimationType(animType) -- what scrolling animation you want it to do?
:DescriptionFont(font) -- the font that will be used to draw the description text (default ScaleformFonts.CHALET_LONDON_NINETEENSIXTY)
:ScrollingType(type) -- how the menu will be scrolled (CLASSIC, PAGINATED, ENDLESS)
:CurrentSelection(value) -- sets or returns the current selection in menu
:AddWindow(Window) -- Adds a windows to the menu
:RemoveWindowAt(Index) -- removes the window at index
:AddItem(Item) -- adds an item to the menu
:RemoveItemAt(Index) -- removes an item by its index
:RemoveItem(item) -- removes an item
:Visible(bool) -- this activate the menu and makes it visible on screen, it can return if the menu is visible or not
:GoUp() -- makes the menu go up by 1 item
:GoDown() -- makes the menu go down by 1 item
:GoLeft() -- if the item supports it, it makes the item index go left once
:GoRight() -- if the item supports it, it makes the item index go right once
:SelectItem(play) -- the same as pressing return on your keyboard
:GoBack() -- the same as pressing backspace on your keyboard
:AddInstructionButton(button) -- adds an instructional button to the current menu
:RemoveInstructionButton(button) -- removes an instructional button to the current menu
OnIndexChange = function(menu, newindex) -- this is called everytime you go up or down in the menu
OnListChange = function(menu, list, newindex) -- called when a UIMenuListItem is changed left or right
OnSliderChange = function(menu, slider, newindex) -- called when a UIMenuSliderItem is changed left or right
OnProgressChange = function(menu, progress, newindex) -- called when a UIMenuProgressItem is changed left or right
OnCheckboxChange = function(menu, item, checked) -- called when a UIMenuCheckBoxItem is changed true or false
OnListSelect = function(menu, list, index) -- called when a UIMenuListItem is selected
OnSliderSelect = function(menu, slider, index) -- called when a UIMenuSliderItem is selected
OnProgressSelect = function(menu, progress, index) -- called when a UIMenuProgressItem is selected
OnItemSelect = function(menu, item, index) -- called when a UIMenuItem is selected
OnMenuChanged = function(oldmenu, newmenu, change) -- called when a the menu is opened, closed, changed to a submenu, or gone back to a parent menu
OnColorPanelChanged = function(oldmenu, newmenu, change) -- called when a UIMenuColorPanel is interacted with
OnPercentagePanelChanged = function(oldmenu, newmenu, change) -- called when a UIMenuPercentagePanel is interacted with
OnGridPanelChanged = function(oldmenu, newmenu, change) -- called when a UIMenuGridPanel is interacted with

Note that this are some of the UIMenu function working atm and they can be changed / added / removed in any moment due to development needs!

Description

image
The menu will show a description for each item that has one, the description is bounded to the selected item and will change when you select a different item.
It supports emojis, blips, and input icons.

Clone this wiki locally