Skip to main content

OptionsPanel

A class in Root.Township, Alta.Meta.UI.

Menu popup that shows a message and a column of option buttons; pressing one runs its action and closes the panel.

Constructors​

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

Fields​

7 private and internal fields
MemberWhat it is
private OptionsPanelButtonConfig[] buttonConfigButton prefab for each button type.
private List<GameObject> currentButtonsButtons made by the last Setup.
private Transform parentWhere buttons are created.
private GameObject smallBackgroundBackground for two options or fewer.
private float spacingVertical gap between buttons.
private GameObject tallBackgroundBackground for more than two options.
private TextRenderer textText for the message.

Methods​

MemberWhat it is
void Setup(IEnumerable<OptionsConfig> optionsConfig, string message = null)Builds a button per option with the right prefab and the message, using the tall background for more than two options.
3 private and internal methods
MemberWhat it is
private void Awake()Uses its own transform as the button parent if none is set.
private Button GetPrefab(UIButtonType type)Returns the button prefab for a button type.
private void ResetButtons()Destroys the current buttons and hides the panel.

Used in​

Members of other types that take, return or hold a OptionsPanel: