SettingsQuickAccessMenu
A class in Root.Township, Alta.QuickAccessActions.
Quick access menu action that opens a settings board in front of the local player: either client settings, or the server's settings for players with permission. Client side.
- Listed in Players and characters
- Inherits or implements
QuickAccessMenuAction - Attributes
CreateAssetMenu
Constructors
| Member | What it is |
|---|---|
SettingsQuickAccessMenu() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
11 private and internal fields
| Member | What it is |
|---|---|
private IQuickAccessSettingsBoard activeBoard | The board currently shown, if any. |
private PooledObjectDefinition boardDefinition | Pooled board object that shows the settings. |
private float boardDistanceFromHead | How far in front of the player the board appears. |
private float boardHeight | Height of the board above the player's feet. |
private bool hasPermission | Whether the local player may use this menu; server settings need server permissions. |
private bool isActive | Whether the board is open. Backing field for IsActive. |
private bool isIgnored | Set when initialized without a player, which hides the action. |
private bool isServerSettings | Edits the server's settings instead of the player's own. Backing field for IsServerSettings. |
private static Logger logger | Class logger. |
private PooledObjectDefinition[] settingsDefinitions | Pooled UI element to use for each setting type. Backing field for SettingsDefinitions. |
private SettingsFieldAccess[] settingsToDisplay | The settings listed on the board. Backing field for SettingsToDisplay. |
Properties
| Member | What it is |
|---|---|
override bool IsActive { get; } | True while the board is open. |
override bool IsIgnored { get; } | True when hidden from the menu: no permission, no ServerSettingsSync, or the server menu unavailable for non-devs. |
bool IsServerSettings { get; } | True if this edits the server's settings instead of the player's own. |
override bool IsValid { get; } | False while the player is downed. |
ServerSettings ServerSettings { get; private set; } | Server settings fetched for the open board. They are sent back to the server when the board closes. |
PooledObjectDefinition[] SettingsDefinitions { get; } | Pooled UI prefab for each SettingType. |
SettingsFieldAccess[] SettingsToDisplay { get; } | The settings fields shown on the board. |
Methods
| Member | What it is |
|---|---|
override async void InitializeForPlayer(Player player, bool isDev) | Works out if the local player may use it. Server settings need a permissions check against the joined server, except in a local test. |
override void Run(Controller controller) | Toggles the board. For server settings it first requests them from the server. |
5 private and internal methods
| Member | What it is |
|---|---|
private void Activate() | Spawns the settings board in front of the player, sets it up and closes it if the player dies. |
private void DeregisterBoard() | Closes the board; for server settings, sends the edited settings back to the server. |
private void PlayerDied(DamageData obj) | Closes the board when the local player is killed. |
private void PositionBoardForPlayer(Transform boardTransform) | Places the board at boardHeight above the player's feet, boardDistanceFromHead in front, facing them. |
private async void ValidateAccessAndGetServerSettings() | Asks the server for its settings and opens the board if the menu is still open when they arrive. |
Used in
Members of other types that take, return or hold a SettingsQuickAccessMenu: