swiftlys2/docs/api/ai/
API Reference › Menu

IMenuActionRegistry

Interface
Namespace: SwiftlyS2.Shared.Menu · Assembly: SwiftlyS2.CS2.dll
public interface IMenuActionRegistry

The dynamic catalogue of bindable menu actions.

Registrations made through a plugin's own menu service are released automatically when that plugin unloads, so a plugin never has to unregister its actions by hand.

View source

Methods

GetScope(string)

Lists every action declared in a scope.

IReadOnlyList<MenuActionDescriptor> GetScope(string scope)
Parameters
  • scopestringThe scope to enumerate, typically a menu id.
Returns
The declarations, ordered by Order.

Register(MenuActionDescriptor)

Declares an action, replacing any previous declaration with the same id.

IDisposable Register(MenuActionDescriptor descriptor)
Parameters
Returns
A handle that removes the declaration when disposed.

TryGet(MenuActionId, out MenuActionDescriptor)

Looks up a declared action.

bool TryGet(MenuActionId id, out MenuActionDescriptor descriptor)
Parameters
Returns
true when the action is declared.

Unregister(MenuActionId)

Removes an action declaration.

bool Unregister(MenuActionId id)
Parameters
Returns
true when an action was removed.