Table of Contents

Class OnixSettingFloat

Namespace
OnixRuntime.Api.OnixClient.Settings
Assembly
OnixRuntime.dll

Represents a float setting in Onix, allowing configuration of value, default, min, and max.

public sealed class OnixSettingFloat : OnixSetting, IDisposable
Inheritance
OnixSettingFloat
Implements
Inherited Members

Constructors

OnixSettingFloat(OnixModule?, string, float, float, float, string, SettingChangedDelegate?)

Initializes a new instance of the OnixSettingFloat class with the specified module, name, default value, min, max, description, and change callback.

public OnixSettingFloat(OnixModule? mod, string name, float defaultValue, float min, float max, string description = "", OnixSetting.SettingChangedDelegate? changeCallback = null)

Parameters

mod OnixModule

The Onix module.

name string

The name of the setting.

defaultValue float

The default float value.

min float

The minimum allowed value.

max float

The maximum allowed value.

description string

The description of the setting.

changeCallback OnixSetting.SettingChangedDelegate

The callback to invoke when the setting changes.

OnixSettingFloat(OnixModule?, string, string, float, float, float, string, SettingChangedDelegate?)

Initializes a new instance of the OnixSettingFloat class with the specified module, name, default value, min, max, description, and change callback.

public OnixSettingFloat(OnixModule? mod, string name, string saveName, float defaultValue, float min, float max, string description = "", OnixSetting.SettingChangedDelegate? changeCallback = null)

Parameters

mod OnixModule

The Onix module.

name string

The name of the setting.

saveName string

The save name of the setting, this allows the name to change without losing user settings.

defaultValue float

The default float value.

min float

The minimum allowed value.

max float

The maximum allowed value.

description string

The description of the setting.

changeCallback OnixSetting.SettingChangedDelegate

The callback to invoke when the setting changes.

Properties

Default

Gets or sets the default value of the setting.

public float Default { get; set; }

Property Value

float

Max

Gets or sets the maximum allowed value for the setting.

public float Max { get; set; }

Property Value

float

Min

Gets or sets the minimum allowed value for the setting.

public float Min { get; set; }

Property Value

float

Value

Gets or sets the current value of the setting.

public float Value { get; set; }

Property Value

float

ValueInit

Gets or sets the current value of the setting. This variant will call the on setting changed with the isInit flag set to true.

public float ValueInit { get; set; }

Property Value

float

Methods

Load(JsonNode)

Loads the setting from json. If the value was null this will not get called so what you're getting is whatever the last value you returned in Save() was. Read it lazily like there is no tomorrow, every setting is in its own try-catch. If you change what you save make sure to have migration code in place.

public override void Load(JsonNode root)

Parameters

root JsonNode

The json you last saved.

Save()

Saves the setting to json for persistent storage.

public override JsonNode? Save()

Returns

JsonNode

The json or null if there is nothing to save.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.