SwiftlyS2

IMenuBuilderAPI

Interface IMenuBuilderAPI

Namespace: SwiftlyS2.Shared.Menus

Assembly: SwiftlyS2.CS2.dll

Provides a fluent builder interface for creating and configuring menus. All methods support chaining for convenient menu construction.

public interface IMenuBuilderAPI

Properties

Design

Gets the design interface for this menu.

IMenuDesignAPI Design { get; }
Property Value

Methods

AddOption(IMenuOption)

Adds a menu option to the menu.

IMenuBuilderAPI AddOption(IMenuOption option)
Parameters
Returns

BindToParent(IMenuAPI)

Binds this menu to a parent menu, creating a hierarchical navigation structure.

IMenuBuilderAPI BindToParent(IMenuAPI parent)
Parameters
Returns

Build()

Builds the menu and returns the final menu instance.

IMenuAPI Build()
Returns

DisableExit()

Disables the exit button for this menu.

IMenuBuilderAPI DisableExit()
Returns

DisableSound()

Disables sound effects for menu interactions.

IMenuBuilderAPI DisableSound()
Returns

EnableExit()

Enables the exit button for this menu.

IMenuBuilderAPI EnableExit()
Returns

EnableSound()

Enables sound effects for menu interactions.

IMenuBuilderAPI EnableSound()
Returns

SetAutoCloseDelay(float)

Sets the automatic close delay for the menu.

IMenuBuilderAPI SetAutoCloseDelay(float seconds = 0)
Parameters
  • seconds float — Time in seconds before the menu automatically closes. Set to 0 to disable auto-close. Default is 0.
Returns

SetExitButton(KeyBind)

Overrides the default key binding for closing the menu.

IMenuBuilderAPI SetExitButton(KeyBind keyBind)
Parameters
  • keyBind KeyBind — The key binding to use.
Returns
Remarks

This overrides the default exit button behavior. Supports multiple key bindings using the bitwise OR operator. Example: KeyBind.Esc | KeyBind.A allows either Esc or A to close the menu.

SetMoveBackwardButton(KeyBind)

Overrides the default key binding for moving backward through menu options.

IMenuBuilderAPI SetMoveBackwardButton(KeyBind keyBind)
Parameters
  • keyBind KeyBind — The key binding to use.
Returns
Remarks

This overrides the default move backward button behavior. Supports multiple key bindings using the bitwise OR operator. Example: KeyBind.S | KeyBind.Mouse2 allows either S or Mouse2 to move backward.

SetMoveForwardButton(KeyBind)

Overrides the default key binding for moving forward through menu options.

IMenuBuilderAPI SetMoveForwardButton(KeyBind keyBind)
Parameters
  • keyBind KeyBind — The key binding to use.
Returns
Remarks

This overrides the default move forward button behavior. Supports multiple key bindings using the bitwise OR operator. Example: KeyBind.W | KeyBind.Mouse1 allows either W or Mouse1 to move forward.

SetPlayerFrozen(bool)

Controls whether player movement is frozen while the menu is open.

IMenuBuilderAPI SetPlayerFrozen(bool frozen = false)
Parameters
  • frozen bool — True to freeze player movement, false to allow movement. Default is false.
Returns

SetSelectButton(KeyBind)

Overrides the default key binding for selecting menu options.

IMenuBuilderAPI SetSelectButton(KeyBind keyBind)
Parameters
  • keyBind KeyBind — The key binding to use.
Returns
Remarks

This overrides the default select button behavior. Supports multiple key bindings using the bitwise OR operator. Example: KeyBind.Mouse1 | KeyBind.E allows either Mouse1 or E to select options.

On this page