-
Notifications
You must be signed in to change notification settings - Fork 1
Toggle
Justin Oroz edited this page Jul 7, 2017
·
8 revisions

Adding a ModOptionToggle object to your menu displays a Checkbox which can be toggled on or off.
ModOptionToggle myCheckbox = new ModOptionToggle("mySetting", "Option Label");ModOptionToggle initialization requires only an identifier and label, but can be initialized with additional arguments isOn and the standard enabled.
To read the checkbox value check the boolean IsOn property. If the checkbox is checked the value is true, unchecked is false. The event ValueChanged is triggered every time the IsOn property is changed, except on initialization.
The mod can manually change the state of the checkbox by writing to the IsOn property or using the Toggle() method.
public ModOptionToggle(string identifier, string labelText, bool isOn = true, bool enabled = true)public void Toggle()public bool IsOn { get; set; }public delegate void ModOptionToggleHandler(string identifier, bool isOn);
public event ModOptionToggleHandler ValueChanged