Game.UI.Tooltip.LabelIconTooltip
Assembly:
Game (Assembly containing Game.UI.* types; may appear in Assembly-CSharp depending on build)
Namespace: Game.UI.Tooltip
Type:
abstract class
Base:
IconTooltip
Summary:
LabelIconTooltip is an abstract tooltip component that extends IconTooltip by adding an optional localized text label. It stores the label as a LocalizedString, detects changes to the label value and marks the component as needing property synchronization. When serialized via WriteProperties, the label is written to the provided IJsonWriter under the "label" property name.
Fields
private Game.UI.Localization.LocalizedString m_Label
Backing field that holds the label value. Marked as nullable ([CanBeNull]) — a null value means no label will be written or shown.
Properties
public Game.UI.Localization.LocalizedString label { get; private set }
Public property exposing the localized label. The getter returns m_Label. The setter uses object.Equals to detect change; when the value changes it updates m_Label and calls SetPropertiesChanged() (inherited from a base class) to mark the component for update/serialization.
Constructors
- No explicit constructors are declared.
The class relies on the default constructor and any initialization performed by the base IconTooltip class.
Methods
protected override void WriteProperties(IJsonWriter writer) : void
Overrides the base WriteProperties to add serialization of the label. It calls base.WriteProperties(writer), then writes a "label" property and serializes the current label value via writer.Write(label). If label is null, the writer behavior depends on the IJsonWriter implementation (commonly writes null or omits the value).
Notes: - SetPropertiesChanged() is called in the label setter to ensure the tooltip system knows to re-send or re-render updated properties. - The class uses Game.UI.Localization.LocalizedString to support localization; ensure proper creation/population of that value when assigning.
Usage Example
// Subclassing the abstract LabelIconTooltip to provide a concrete tooltip implementation.
public class MyLabelIconTooltip : LabelIconTooltip
{
public MyLabelIconTooltip()
{
// Assign a localized label. Replace the constructor call with your localization API if needed.
label = new Game.UI.Localization.LocalizedString("tooltip.my_label_key");
// Additional icon/text setup inherited from IconTooltip...
}
// Optionally override additional behavior or rendering from IconTooltip.
}
Notes on usage: - Assigning a different LocalizedString to the label property will call SetPropertiesChanged() automatically, causing the system to include the updated label in the next property sync/serialization. - Because LabelIconTooltip is abstract, create a concrete subclass (or use an existing concrete implementation) before instantiating.