Skip to content

Game.UI.InGame.StringProperty

Assembly: Assembly-CSharp (game)
Namespace: Game.UI.InGame

Type: struct

Base: IJsonWritable

Summary:
Represents a simple UI string property carrying a label id, a value id and optional icon identifiers. Primarily used to serialize a small UI data object to the game's JSON writer via the IJsonWritable contract. When serialized it emits a type token "Game.UI.Common.StringProperty" and four string properties: labelId, valueId, icon and valueIcon.


Fields

  • public string labelId
    Identifier for the label text (usually a localization key).

  • public string valueId
    Identifier for the value text (usually a localization key).

  • public string icon
    Identifier or name of the icon shown next to the label.

  • public string valueIcon
    Identifier or name of the icon shown next to the value.

Properties

  • None. This is a simple struct with public fields.

Constructors

  • public StringProperty()
    Default parameterless struct constructor (auto-generated). Initialize fields directly or via object initializer.

Methods

  • public void Write(IJsonWriter writer)
    Serializes the struct into the provided IJsonWriter. The method emits a type begin with "Game.UI.Common.StringProperty" and writes the four properties in this order: labelId, valueId, icon, valueIcon, then ends the type. The IJsonWriter implementation must handle null string values if any fields are unset.

Remarks: - The JSON/type name used for serialization differs from the CLR namespace: the writer uses "Game.UI.Common.StringProperty". - The writer is expected to provide TypeBegin(string), PropertyName(string), Write(string), and TypeEnd() methods (as used by this method). - No validation or null-checking is performed before writing; ensure the writer can accept nulls or set fields before serialization.

Usage Example

var prop = new Game.UI.InGame.StringProperty
{
    labelId = "UI_Label_Population",
    valueId = "UI_Value_12345",
    icon = "population_icon",
    valueIcon = "value_icon"
};

IJsonWriter writer = /* obtain writer from context */;
prop.Write(writer);

Example of the conceptual JSON-like object produced (actual output depends on IJsonWriter implementation): { "type": "Game.UI.Common.StringProperty", "labelId": "UI_Label_Population", "valueId": "UI_Value_12345", "icon": "population_icon", "valueIcon": "value_icon" }