-
Notifications
You must be signed in to change notification settings - Fork 1
Selection

Adding a ModOptionSelection object to your menu displays a Dropdown which expands to a list of items when clicked which can be selected.
ModOptionSelection myDropdown = new ModOptionSelection("mySetting", "Option Label");ModOptionSelection initialization requires only an identifier, label but can be initialized with additional arguments choices, defaultSelection and the standard enabled. You will then want to add options using ModOptionSelection.Choices.Add(), and can then add it to ModOptions.
The choices argument is of type ModSelectionOptionChoices which has its own section at the end of this document. If you prefer to set up the choices prior to initializing the ModOptionSelection it can be created, added to, then passed into the initializer.
The defaultSelection argument allows for the selection of a value at initialization. The index must be in the range of the choices argument.
To read which dropdown value is selected check the string Selection which returns the identifier or int SelectionIndex property. The event ValueChanged is triggered every time the selection is changed through either Selection or SelectionIndex properties, except on initialization.
The mod can manually change the state of the checkbox by writing to the Selection or SelectionIndex properties. If the identifier string does exist the list or the index is out of range an exception will be thrown.
public ModOptionSelection(string identifier, string labelText, ModSelectionOptionChoices choices = null, int defaultSelection = 0, bool enabled = true);public ModSelectionOptionChoices Choices { get; }
public int SelectionIndex { get; set; }
public string Selection { get; }public delegate void ModOptionSelectionHandler(string ComponentIdentifier, string selectionIdentifier);
public event ModOptionSelectionHandler ValueChanged;To be added