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