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
stringThe option's name.
defaultValue
intThe default value.
displayName
stringThe option's displayed name.
min
intThe minimum value.
max
intThe maximum value.
actions
Action<IntOption>[]Functions to run when the value is applied.
doClamp
boolWhether 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
stringThe option's name.
defaultValue
intThe default value.
displayName
stringThe option's displayed name.
min
intThe minimum value.
max
intThe maximum value.
doClamp
boolWhether to clamp the value when changed.
Properties
State
Get or set this option's state.
public int State { get; set; }
Property Value
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
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
stringThe 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
SetValue(int)
Sets the option's value. This will NOT update it in the state!
public void SetValue(int value)
Parameters
value
intThe new value.
SetValue(object)
Sets the option's value. This will NOT update it in the state!
public void SetValue(object value)
Parameters
value
objectThe new value.