Skip to content
Justin Oroz edited this page Jul 7, 2017 · 8 revisions

Checkbox

Overview

Adding a ModOptionToggle object to your menu displays a Checkbox which can be toggled on or off.

Usage

Initializing

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.

Reading/Modifying Values

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.

Properties and Methods

Initializers

public ModOptionToggle(string identifier, string labelText, bool isOn = true, bool enabled = true)

Methods

public void Toggle()

Properties

public bool IsOn { get; set; }

Events

public delegate void ModOptionToggleHandler(string identifier, bool isOn);
public event ModOptionToggleHandler ValueChanged
Clone this wiki locally