Class FloatOption
- Namespace
- ConfigurableWarning.API.Options
- Assembly
- RedstoneWizard08.ContentLibrary.dll
A float option. This must be inherited from to use. Its state is stored in the OptionsState class.
public class FloatOption : FloatSetting, IDisposable, IOption<float>, ICustomSetting, IExposedSetting, IUntypedOption, IHasStateHolder<float>
- Inheritance
-
FloatOption
- Implements
- Inherited Members
Constructors
FloatOption(string, float, string, float, float, Action<FloatOption>[], bool)
Initialize a IOption<T> with the float type.
protected FloatOption(string name, float defaultValue, string displayName, float min, float max, Action<FloatOption>[] actions, bool doClamp = true)
Parameters
name
stringThe option's name.
defaultValue
floatThe default value.
displayName
stringThe option's displayed name.
min
floatThe minimum value.
max
floatThe maximum value.
actions
Action<FloatOption>[]Functions to run when the value is applied.
doClamp
boolWhether to clamp the value when changed.
FloatOption(string, float, string, float, float, bool)
Initialize a IOption<T> with the float type.
protected FloatOption(string name, float defaultValue, string displayName, float min, float max, bool doClamp = true)
Parameters
name
stringThe option's name.
defaultValue
floatThe default value.
displayName
stringThe option's displayed name.
min
floatThe minimum value.
max
floatThe maximum value.
doClamp
boolWhether to clamp the value when changed.
Properties
State
Get or set this option's state.
public float State { get; set; }
Property Value
StateHolder
Get this object's state holder.
public StateHolder<float> StateHolder { get; }
Property Value
- StateHolder<float>
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<float> AsOption()
Returns
- IOption<float>
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 float GetDefaultValue()
Returns
- float
The option's default value.
GetDisplayName()
Get the display name of this option.
public string GetDisplayName()
Returns
- string
The option's display name.
GetMinMaxValue()
public override float2 GetMinMaxValue()
Returns
- float2
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 float GetValue()
Returns
- float
The (potential) value of this option.
Instance(string)
Get an instance of an option.
public static FloatOption? Instance(string name)
Parameters
name
stringThe option's name.
Returns
- FloatOption
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(object)
Sets the option's value. This will NOT update it in the state!
public void SetValue(object value)
Parameters
value
objectThe new value.
SetValue(float)
Sets the option's value. This will NOT update it in the state!
public void SetValue(float value)
Parameters
value
floatThe new value.