Game.UI.Widgets.TimeBoundsSliderField
Assembly:
Namespace: Game.UI.Widgets
Type: public class
Base: TimeField
Summary:
A UI time field widget that operates on 1D bounds (Bounds1) and exposes a toggleable behavior allowing the minimum bound to be greater than the maximum bound. It extends the TimeField generic widget to provide serialization of the additional allowMinGreaterMax setting so the property is preserved when the UI writes its properties (for example during UI saving/serialization).
Fields
- None
Properties
public bool allowMinGreaterMax { get; set; }
Controls whether the minimum bound is allowed to be greater than the maximum bound. When true, the widget accepts and will serialize a bounds value where min > max. When false (default typical behavior), min is expected to be <= max.
Constructors
public TimeBoundsSliderField()
No explicit constructor is defined in the source file; the class uses the default parameterless constructor inherited/created by the compiler.
Methods
protected override void WriteProperties(IJsonWriter writer)
Overrides the base TimeField WriteProperties to include the allowMinGreaterMax flag in the serialized output. Implementation calls base.WriteProperties(writer) and then writes a JSON property named "allowMinGreaterMax" with the property's current boolean value.
Usage Example
// Create and configure the field somewhere in UI initialization:
var timeBoundsField = new TimeBoundsSliderField();
timeBoundsField.allowMinGreaterMax = true; // allow min > max if needed
// When the UI serializes this widget, WriteProperties will add:
// "allowMinGreaterMax": true
// alongside the properties written by the base TimeField implementation.
Notes:
- The class depends on Bounds1 from Colossal.Mathematics and the IJsonWriter from Colossal.UI.Binding for serialization.
- Behavior for enforcing min/max ordering (during user interaction) depends on TimeField