Skip to content

Game.UI.Tooltip.StringTooltip

Assembly:
Namespace: Game.UI.Tooltip

Type: class

Base: IconTooltip

Summary:
A tooltip component that extends IconTooltip to display a localized string value. The class exposes a LocalizedString-backed property (value) and ensures the UI is marked dirty when the value changes so it will be re-serialized / re-rendered. It also participates in the UI JSON serialization by writing its value via WriteProperties.


Fields

  • private LocalizedString m_Value
    Backs the public value property. The field stores the localized text to display in the tooltip.

Properties

  • public LocalizedString value { get; set; }
    Gets or sets the tooltip text as a LocalizedString. The setter compares the incoming value with the current m_Value using object.Equals; when the value changes it assigns the new value to m_Value and calls SetPropertiesChanged() to notify the UI system that this component needs to be updated/serialized.

Constructors

  • public StringTooltip()
    No explicit constructor is defined in the source; the class uses the default parameterless constructor inherited from its base class. No extra initialization is performed by this class itself.

Methods

  • protected override void WriteProperties(IJsonWriter writer) : System.Void
    Overrides the base WriteProperties to include the localized string value in JSON serialization. Implementation steps:
  • Calls base.WriteProperties(writer) to let the base class write its properties.
  • Writes a property named "value".
  • Writes the current LocalizedString (value) using writer.Write(value). This is used by the UI system to serialize this tooltip's state (including the localized text) to JSON for the UI layer.

Usage Example

// Create and set the tooltip's localized value. When the value changes,
// SetPropertiesChanged() is invoked internally which marks the UI element
// for update/serialization.
var tooltip = new StringTooltip();

// How to create a LocalizedString depends on the localization API in use.
// This is an illustrative example; replace with the actual LocalizedString
// construction or retrieval method used in your project.
tooltip.value = new LocalizedString("UI_TOOLTIP_SAMPLE_KEY");

// The UI system will pick up the change (via SetPropertiesChanged) and
// WriteProperties will include the "value" property when serializing.