Skip to main content

ToggleBool

A class in Root.Township, the global namespace.

A named on/off setting that registers itself in a static list so console commands can toggle it by name. Examples: immortals, damagepopup, xppopup.

Constructors​

MemberWhat it is
ToggleBool(string name, bool defaultValue = false)Creates a ToggleBool from name and defaultValue.

Fields​

MemberWhat it is
static Dictionary<string, ToggleBool> toggleableSettingsEvery registered setting by name, used by the settings console commands.
1 private and internal field
MemberWhat it is
private bool valueBacking field for Value.

Properties​

MemberWhat it is
string Name { get; private set; }The name the setting is registered under.
bool Value { get; set; }The current state. Setting a new value logs it and raises Toggled.

Events​

MemberWhat it is
event Action<bool> ToggledRaised with the new value when Value changes.

Methods​

MemberWhat it is
void Destroy()Removes this setting from toggleableSettings.
void Toggle()Flips Value.

Used in​

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