Skip to main content

QuickAccessSettingsBoard

A class in Root.Township, Alta.QuickAccessActions.

Pooled settings board opened by a settings quick access action: slides down and shows pages of setting controls, one by one as it animates. Client only.

Constructors​

MemberWhat it is
QuickAccessSettingsBoard()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

19 private and internal fields
MemberWhat it is
private static readonly int _ProgressShader property ID for the board material's reveal progress.
private List<PooledObject> activeSettingsControls currently shown.
private Transform animatingParentTransform moved up and down by the animation.
private float animationDurationSeconds the slide takes.
private int currentPannelIndex of the shown page.
private float distanceBetweenSettingsVertical gap between controls.
private float distanceToDespawnSquaredSquared walk-away distance for CheckDistance (25, so 5 m).
private bool isAnimatingTrue while sliding; page changes are ignored then.
private Material materialThe shared board material driven by the animation.
private GameObject[] pageButtonsNext and previous page buttons, shown only with more than one page.
private int pannelCountNumber of pages.
private Vector3 positionWorld position where the board was set up, used by the distance check.
private float pullDownBoardHeightDownLocal Y the board slides down to when shown.
private Renderer[] renderersRenderers that share the board material.
private SettingsQuickAccessMenu settingsThe settings menu action that opened the board.
private int settingsInPanelNumber of controls on the page being shown.
private Transform settingsParentWhere the controls are spawned.
private int settingsPerBoardSettings per page.
private List<SettingsFieldAccess> settingsToDisplayThe valid settings to show, across all pages.

Properties​

MemberWhat it is
Transform Transform { get; }The board's transform.

Events​

MemberWhat it is
event Action DistanceDisabledRaised when the player walks away from the board; the settings menu action uses it to drop the board.

Methods​

MemberWhat it is
void NextPanel()Hides the current page and shows the next, wrapping round. Ignored while animating.
void PreviousPanel()Hides the current page and shows the previous, wrapping round. Ignored while animating.
override void Release()Plays the hide animation, then returns the board to its pool.
void Setup(SettingsQuickAccessMenu settings)Loads the valid settings from the menu action, works out pages, shows page buttons if there are several and opens the first page.
protected override void Awake()Makes one tracked material copy and shares it across all the board's renderers.
5 private and internal methods
MemberWhat it is
private IEnumerator AnimateMovement(bool isShowing, Action onFinished = null) (iterator)Coroutine that slides the board down (adding controls as it goes) or up (removing them), fading the material's _Progress.
private void CheckDistance()Raises DistanceDisabled if the player's head is further than distanceToDespawnSquared from where the board opened. Nothing in this class calls it.
private void HideSettingControl(float position, ref float distance)Per animation step when hiding: releases the bottom control once the board passes it.
private void OpenPanel()Starts the show animation for the current page.
private void ShowSettingControl(float position, ref float distance)Per animation step when showing: spawns the next pooled control once the board has moved far enough.