IMenuManagerAPI
Interface IMenuManagerAPI
Namespace: SwiftlyS2.Shared.Menus
Assembly: SwiftlyS2.CS2.dll
Central manager for creating and controlling all player menus.
public interface IMenuManagerAPIProperties
Configuration
Global configuration settings for all menus.
MenuManagerConfiguration Configuration { get; }Core
The SwiftlyS2 core instance.
ISwiftlyCore Core { get; }Methods
CloseAllMenus()
Closes every open menu for every player.
void CloseAllMenus()CloseMenu(IMenuAPI)
Closes the specified menu for all players who have it open.
void CloseMenu(IMenuAPI menu)- menu IMenuAPI — The menu to close.
CloseMenuForPlayer(IPlayer, IMenuAPI)
Closes the specified menu for a player. If the menu is not open for that player, this has no effect.
void CloseMenuForPlayer(IPlayer player, IMenuAPI menu)CreateBuilder()
Creates a new menu builder.
IMenuBuilderAPI CreateBuilder()- IMenuBuilderAPI — A new menu builder instance.
CreateMenu(MenuConfiguration, MenuKeybindOverrides, IMenuAPI?, MenuOptionScrollStyle, MenuOptionTextStyle)
Creates a new menu with an optional title.
IMenuAPI CreateMenu(MenuConfiguration configuration, MenuKeybindOverrides keybindOverrides, IMenuAPI? parent = null, MenuOptionScrollStyle optionScrollStyle = MenuOptionScrollStyle.CenterFixed, MenuOptionTextStyle optionTextStyle = MenuOptionTextStyle.TruncateEnd)- configuration MenuConfiguration — The configuration for the menu.
- keybindOverrides MenuKeybindOverrides — The keybind overrides for the menu.
- parent IMenuAPI? — The parent menu, or null for no parent.
- optionScrollStyle MenuOptionScrollStyle — The scroll style for the menu options.
- optionTextStyle MenuOptionTextStyle — The text overflow style for the menu options.
- IMenuAPI — A new menu instance ready to be configured.
GetCurrentMenu(IPlayer)
Gets the menu currently open for the specified player.
IMenuAPI? GetCurrentMenu(IPlayer player)- player IPlayer — The player to check.
- IMenuAPI? — The player's active menu, or null if they have no menu open.
OpenMenu(IMenuAPI)
Opens the specified menu for all players.
void OpenMenu(IMenuAPI menu)- menu IMenuAPI — The menu to display.
OpenMenu(IMenuAPI, Action<IPlayer, IMenuAPI>)
Opens the specified menu for all players.
void OpenMenu(IMenuAPI menu, Action<IPlayer, IMenuAPI> onClosed)- menu IMenuAPI — The menu to display.
- onClosed Action<IPlayer, IMenuAPI> — Callback invoked when the menu is closed.
OpenMenuForPlayer(IPlayer, IMenuAPI)
Opens the specified menu for a player. Any currently open menu will be closed first.
void OpenMenuForPlayer(IPlayer player, IMenuAPI menu)OpenMenuForPlayer(IPlayer, IMenuAPI, Action<IPlayer, IMenuAPI>)
Opens the specified menu for a player. Any currently open menu will be closed first.
void OpenMenuForPlayer(IPlayer player, IMenuAPI menu, Action<IPlayer, IMenuAPI> onClosed)- player IPlayer — The player who will see the menu.
- menu IMenuAPI — The menu to display.
- onClosed Action<IPlayer, IMenuAPI> — Callback invoked when the menu is closed for the player.
MenuClosed
Fired when a menu is closed for a player.
event EventHandler<MenuManagerEventArgs>? MenuClosedMenuOpened
Fired when a menu is opened for a player.
event EventHandler<MenuManagerEventArgs>? MenuOpened