IMenuAPI
Interfacepublic interface IMenuAPI : IDisposableRepresents an interactive menu that can be displayed to players.
View sourceProperties
The builder used to construct and configure this menu.
IMenuBuilderAPI? Builder { get; }Configuration settings for this menu.
MenuConfiguration Configuration { get; }Keybind overrides for this menu.
MenuKeybindOverrides KeybindOverrides { get; }The menu manager that this menu belongs to.
IMenuManagerAPI MenuManager { get; }The scroll style for this menu options.
MenuOptionScrollStyle OptionScrollStyle { get; }Read-only collection of all options in this menu.
IReadOnlyList<IMenuOption> Options { get; }The parent hierarchy information in a hierarchical menu structure.
(IMenuAPI? ParentMenu, IMenuOption? TriggerOption) Parent { get; }ParentMenu is the parent menu instance, null for top-level menus. TriggerOption is the menu option that triggered this submenu, null for top-level or directly created menus.
Gets or sets an object that contains data about this menu.
object? Tag { get; set; }Methods
Adds a new option to this menu.
void AddOption(IMenuOption option)- optionIMenuOptionThe menu option to add.
Gets the menu option currently highlighted by the specified player.
IMenuOption? GetCurrentOption(IPlayer player)- playerIPlayerThe player whose current selection to retrieve.
Gets the index of the currently highlighted option for the specified player.
int GetCurrentOptionIndex(IPlayer player)- playerIPlayerThe player whose current selection index to retrieve.
Hides this menu for the specified player by removing its visual display.
void HideForPlayer(IPlayer player)- playerIPlayerThe player whose menu will be hidden.
This method only hides the menu visually. To properly close a menu (which handles state cleanup, triggering events, and reopening parent menus), use IMenuAPI) instead.
Moves the player's selection to the specified option.
bool MoveToOption(IPlayer player, IMenuOption option)- playerIPlayerThe player whose selection to move.
- optionIMenuOptionThe option to move the selection to.
Moves the player's selection to the specified option index.
bool MoveToOptionIndex(IPlayer player, int index)Removes an option from this menu.
bool RemoveOption(IMenuOption option)- optionIMenuOptionThe menu option to remove.
Shows this menu to the specified player by displaying its content.
void ShowForPlayer(IPlayer player)- playerIPlayerThe player who will see the menu.
This method only displays the menu visually. To properly open a menu (which handles state management, closing other menus, and triggering events), use IMenuAPI) instead.
Fired when a different option is hovered.
event EventHandler<MenuEventArgs>? OptionHoveredThis event is only fired when the hovered option changes.
Fired when the selection pointer is hovering over an option.
event EventHandler<MenuEventArgs>? OptionHoveringThis event is fired once per render frame.
Fired when a menu option is selected (activated) by the player.
event EventHandler<MenuEventArgs>? OptionSelected