Game.UI.Widgets.Label
Assembly:
Game
Namespace: Game.UI.Widgets
Type:
class
Base:
NamedWidgetWithTooltip
Summary:
A UI widget representing a text label used by the game's UI system. It supports three visual levels (Title, SubTitle, GroupTitle) and a boolean "beta" flag. During serialization, the label writes its level (as an integer) and the beta flag to a JSON writer by overriding WriteProperties.
Fields
-
public Level level
Specifies the visual level of the label. Use one of the values from Label.Level (Title, SubTitle, GroupTitle). When serialized, this is written as an integer value. -
public bool beta
A flag indicating whether the label should be treated/marked as a beta label. Serialized as a boolean.
Properties
- This class does not declare any C# properties; it exposes public fields instead.
Constructors
public Label()
The default parameterless constructor is used to create an instance. No custom constructor is defined in the class; initialization is expected to be done by the caller after construction or by the owning UI/container.
Methods
protected override void WriteProperties(IJsonWriter writer) : System.Void
Overrides the base implementation to serialize the widget-specific properties. Implementation details:- Calls base.WriteProperties(writer) first to allow the base class to write its fields.
- Writes a "level" property name and then writes the integer value of the level field: writer.Write((int)level).
- Writes a "beta" property name and then writes the boolean value of the beta field.
Usage Example
// Example showing typical initialization of the Label widget inside a UI setup routine.
// WriteProperties is protected and is normally invoked by the UI serialization system,
// so you only set the public fields here.
[Preserve]
protected override void OnCreate()
{
base.OnCreate();
var label = new Game.UI.Widgets.Label();
label.level = Game.UI.Widgets.Label.Level.Title;
label.beta = true;
// Add the label to your UI container / parent widget here.
// e.g. parent.AddChild(label);
}