Table of Contents

Class EnumOption<T>

Namespace
ConfigurableWarning.API.Options
Assembly
RedstoneWizard08.ContentLibrary.dll

An enum option. This must be inherited from to use. Its state is stored in the OptionsState class.

public class EnumOption<T> : EnumSetting, IDisposable, IOption<T>, ICustomSetting, IExposedSetting, IUntypedOption, IHasStateHolder<T> where T : struct

Type Parameters

T
Inheritance
EnumOption<T>
Implements
Inherited Members

Constructors

EnumOption(string, T, string)

Initialize a IOption<T> with the T type.

protected EnumOption(string name, T defaultValue, string displayName)

Parameters

name string

The option's name.

defaultValue T

The default value.

displayName string

The option's displayed name.

EnumOption(string, T, string, Action<EnumOption<T>>[])

Initialize a IOption<T> with the T type.

protected EnumOption(string name, T defaultValue, string displayName, Action<EnumOption<T>>[] actions)

Parameters

name string

The option's name.

defaultValue T

The default value.

displayName string

The option's displayed name.

actions Action<EnumOption<T>>[]

Functions to run when the value is applied.

Properties

State

Get or set this option's state.

public T State { get; set; }

Property Value

T

StateHolder

Get this object's state holder.

public StateHolder<T> StateHolder { get; }

Property Value

StateHolder<T>

The state holder.

WrappedValue

The wrapped (string) value of this option.

public string WrappedValue { get; set; }

Property Value

string

Methods

ApplyValue()

Applies the value. This is run when the user changes the value. This will sync it, update the state, and run any apply actions.

public override void ApplyValue()

AsOption()

Get this as an IOption<T>. This is used for accessing default methods.

public IOption<T> AsOption()

Returns

IOption<T>

This as an IOption<T>.

AsUntyped()

Get this option as an IUntypedOption

public IUntypedOption AsUntyped()

Returns

IUntypedOption

The IUntypedOption form of this.

GetChoices()

Get the choices for this option.

public override List<string> GetChoices()

Returns

List<string>

A list of choices

GetDefaultValue()

public override int GetDefaultValue()

Returns

int

GetDisplayName()

Get the display name of this option.

public string GetDisplayName()

Returns

string

The option's display name.

GetName()

Gets this option's name. This is its name in the registry and in the state holder.

public string GetName()

Returns

string

The option's name.

GetValue()

Gets the current value of the option. WARNING! THIS MAY NOT ALWAYS BE CORRECT! USE THE STATE HOLDER INSTEAD!

public T GetValue()

Returns

T

The (potential) value of this option.

Instance(string)

Get an instance of an option.

public static EnumOption<T>? Instance(string name)

Parameters

name string

The option's name.

Returns

EnumOption<T>

The option.

RegisterSetting(string, string)

Registers this setting with Content Settings. You probably want to use Register(string, string) instead.

public void RegisterSetting(string tab, string category)

Parameters

tab string

The tab to register to.

category string

The category this option belongs to.

SetValue(object)

Sets the option's value. This will NOT update it in the state!

public void SetValue(object value)

Parameters

value object

The new value.

SetValue(T)

Sets the option's value. This will NOT update it in the state!

public void SetValue(T value)

Parameters

value T

The new value.