ServerMultiCommandAction
A class in Root.Township, Alta.Menu.
Client menu control that builds one button per option of a multi-option server command and sends the chosen option. Base for AssistedSpawnCommandAction.
- Listed in Menus, UI and platforms
- Inherits or implements
MenuGameSetting - Derived types
AssistedSpawnCommandAction
Constructors
| Member | What it is |
|---|---|
ServerMultiCommandAction() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|---|
protected bool isSetUp | Set once the buttons are built, so SetSettings only runs once. |
8 private and internal fields
| Member | What it is |
|---|---|
private Transform buttonParent | Transform the buttons are spawned under. |
private TextButton buttonPrefab | Prefab for each option button. |
private TextRenderer buttonText | Text showing the command's name. |
private float minDelayBetweenCommands | Cooldown in seconds after a command. Default 0.5. |
private static float nextCommand | Static time before which no control of this type can send again. |
private ServerMultiOptionCommandDefinition optionCommands | The multi-option command definition. |
private const string pressableLayer | Layer name OnlyOnPlayerHMD. The code passes the same string directly. |
private float width | Length of the row the buttons are spread across. |
Methods
| Member | What it is |
|---|---|
override void SetSettings(ISettingsFieldAccess newSettingToDisplay) | First call only: takes the multi-option command and builds its buttons. |
protected virtual void DynamicButtonSetup(TextButton textButton, int buttonIndex) | Wires a button to send the command with its option index. Overridden by subclasses. |
protected void SetupControlView(IUsesMultipleButtons multiCommandOptions) | Shows the command name and spawns a button per label, spaced evenly along width and on the OnlyOnPlayerHMD layer. |