-
Notifications
You must be signed in to change notification settings - Fork 1
Toggle
Justin Oroz edited this page Jul 8, 2018
·
8 revisions
Adding a ConfigToggle
object to your menu displays a Checkbox which can be toggled on or off.
ConfigToggle myCheckbox = new ConfigToggle("mySetting", "Option Label");
ConfigToggle
initialization requires only an identifier
and label
, but can be initialized with additional arguments isOn
and the standard enabled
. You can then add it to an OptionsTab
.
To read the checkbox value check the boolean IsOn
property. If the checkbox is checked the value is true
, unchecked is false
. The event StateDidChange
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.
ConfigToggle(string identifier, string labelText, bool isOn = true, bool enabled = true)
bool IsOn { get; set; }
void Toggle();
event ToggleHandler StateDidChange;