Skip to main content

EnumMenuSettingBase

A class in Root.Township, Alta.Menu.

A menu setting that steps through a list of string values (next and previous) and writes the chosen one to its setting.

Constructors​

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

Fields​

MemberWhat it is
protected bool isRefreshingTrue while the values are loading. Changes are ignored meanwhile.
protected string[] possibleValuesThe values to step through, from the setting.
1 private and internal field
MemberWhat it is
private TextRenderer valueTextText that shows the current value.

Properties​

MemberWhat it is
int CurrentEnumIndex { get; protected set; }Index of the shown value in possibleValues.

Methods​

MemberWhat it is
void GoToNextValue()Moves to the next value, wrapping round, and saves it.
void GoToPreviousValue()Moves to the previous value, wrapping round, and saves it.
protected virtual void FinishedRefresh()Called after the values have loaded. Empty by default.
protected void Refresh()Wraps the index, writes the value to the setting and updates the text.
protected override void Setup()Loads the possible values and current value from the setting.
protected virtual void UpdateText()Shows the current value on the label.
protected int WrapEnumIndex(int index)Wraps an index into the range of possibleValues.
1 private and internal method
MemberWhat it is
private async void RefreshValues()Loads the setting's possible values and current value, finds its index and updates the text. Blocks changes while it runs.