Table of Contents

Class IntOption

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

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

public class IntOption : IntSetting, IDisposable, IOption<int>, ICustomSetting, IExposedSetting, IUntypedOption, IHasStateHolder<int>
Inheritance
IntOption
Implements
Inherited Members

Constructors

IntOption(string, int, string, int, int, Action<IntOption>[], bool)

Initialize a IOption<T> with the int type.

protected IntOption(string name, int defaultValue, string displayName, int min, int max, Action<IntOption>[] actions, bool doClamp = true)

Parameters

name string

The option's name.

defaultValue int

The default value.

displayName string

The option's displayed name.

min int

The minimum value.

max int

The maximum value.

actions Action<IntOption>[]

Functions to run when the value is applied.

doClamp bool

Whether to clamp the value when changed.

IntOption(string, int, string, int, int, bool)

Initialize a IOption<T> with the int type.

protected IntOption(string name, int defaultValue, string displayName, int min, int max, bool doClamp = true)

Parameters

name string

The option's name.

defaultValue int

The default value.

displayName string

The option's displayed name.

min int

The minimum value.

max int

The maximum value.

doClamp bool

Whether to clamp the value when changed.

Properties

State

Get or set this option's state.

public int State { get; set; }

Property Value

int

StateHolder

Get this object's state holder.

public StateHolder<int> StateHolder { get; }

Property Value

StateHolder<int>

The state holder.

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<int> AsOption()

Returns

IOption<int>

This as an IOption<T>.

AsUntyped()

Get this option as an IUntypedOption

public IUntypedOption AsUntyped()

Returns

IUntypedOption

The IUntypedOption form of this.

GetDefaultValue()

Get this option's default value.

public override int GetDefaultValue()

Returns

int

The option's default value.

GetDisplayName()

Get the display name of this option.

public string GetDisplayName()

Returns

string

The option's display name.

GetMinMaxValue()

Gets the minimum and maximum value of the setting.

protected override (int, int) GetMinMaxValue()

Returns

(int, int)

A tuple containing the minimum and maximum value of the setting.

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 int GetValue()

Returns

int

The (potential) value of this option.

Instance(string)

Get an instance of an option.

public static IntOption? Instance(string name)

Parameters

name string

The option's name.

Returns

IntOption

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(int)

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

public void SetValue(int value)

Parameters

value int

The new value.

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.