IMenu
Interfacepublic interface IMenu : IDisposableAn arrangement of components, a renderer and a keymap.
A menu arranges and manages components. It implements no interaction behaviour of its own beyond traversal, and no drawing behaviour at all.
View sourceProperties
How long a session may sit idle before it closes itself, or null to never auto-close.
TimeSpan? AutoCloseDelay { get; }Counted from when the session opens, not from the last input. Closing acts exactly like the player pressing the Close key: it returns to Parent when there is one.
The menu id. Doubles as its configuration scope for keybinds.
string Id { get; }How players interact with this menu.
MenuInputMethod InputMethod { get; }The resolved actions and keys for this menu.
IMenuKeymap Keymap { get; }The menu to return to when this one closes, if any.
IMenu? Parent { get; set; }Normally set once through IMenu). It stays writable so a menu built lazily by a SubmenuComponent can be told where it was opened from.
The renderer this menu draws through.
IMenuRenderer Renderer { get; }The sessions currently viewing this menu.
IReadOnlyList<IMenuSession> Sessions { get; }Methods
Appends a component to a region.
void Add(MenuRegion region, IMenuComponent component)- regionMenuRegionThe region to add to.
- componentIMenuComponentThe component to add.
Closes this menu for a player.
void Close(IPlayer player)- playerIPlayerThe player to close for.
Lists the components in a region, in layout order.
IReadOnlyList<IMenuComponent> GetComponents(MenuRegion region)- regionMenuRegionThe region to read.
Gets a player's session for this menu.
IMenuSession? GetSession(IPlayer player)- playerIPlayerThe player to look up.
Inserts a component into a region at a position.
void Insert(MenuRegion region, int index, IMenuComponent component)- regionMenuRegionThe region to add to.
- indexintThe position to insert at.
- componentIMenuComponentThe component to add.
Opens this menu for a player, replacing whatever menu they had open.
IMenuSession Open(IPlayer player)- playerIPlayerThe player to show the menu to.
Opens this menu for every connected, non-bot player, replacing whatever each had open.
IReadOnlyList<IMenuSession> OpenForAll()Removes a component from wherever it sits.
bool Remove(IMenuComponent component)- componentIMenuComponentThe component to remove.
Raised after the selection moves within a session.
event Action<IMenuSession>? FocusChanged