Game.UI.Widgets.UIntSliderField
Assembly: Assembly-CSharp
Namespace: Game.UI.Widgets
Type: class
Base: UIntField
Summary:
A UI field that represents an unsigned integer value with slider behavior. Extends UIntField to add an optional unit string that can be displayed along the value and a boolean to enable scaled drag sensitivity when the user drags the slider or value. The class serializes these extra properties when writing JSON via IJsonWriter.
Fields
- This type does not declare any private fields in the source file.
{{ The class relies on inherited state from UIntField and does not introduce backing fields itself. }}
Properties
-
public string unit { get; set; }
{{ Optional unit label shown alongside the value (for example "km/h", "%", etc.). Marked [CanBeNull] in the source — null means no unit text will be written or displayed. }} -
public bool scaleDragVolume { get; set; }
{{ When true, dragging behavior sensitivity is scaled (i.e., drag volume/sensitivity is adjusted based on context/range). When false, dragging uses a constant sensitivity. This flag is serialized so UI definitions can preserve the behavior. }}
Constructors
public UIntSliderField()
{{ The default parameterless constructor is used. The class does not define custom constructor logic in the source file, so initialization is inherited or performed elsewhere (e.g., in Unity/UIView lifecycle). }}
Methods
protected override void WriteProperties(IJsonWriter writer) : System.Void
{{ Writes the instance properties to the provided IJsonWriter. This override calls base.WriteProperties(writer) first, then writes the "unit" and "scaleDragVolume" properties as JSON:- writer.PropertyName("unit"); writer.Write(unit);
- writer.PropertyName("scaleDragVolume"); writer.Write(scaleDragVolume); This allows UI serialization systems using IJsonWriter to capture the extra state of the UIntSliderField. }}
Usage Example
// Create a UIntSliderField and configure its extra properties
var slider = parent.AddUIComponent<UIntSliderField>();
slider.unit = "km/h"; // Optional unit label (nullable)
slider.scaleDragVolume = true; // Enable scaled drag sensitivity
// Use inherited members from UIntField to set range and value
slider.minValue = 0u;
slider.maxValue = 200u;
slider.value = 50u;