Skip to content

Game.UI.InGame.IntProperty

Assembly:
Assembly-CSharp (game code / inferred)

Namespace: Game.UI.InGame

Type:
struct

Base:
Colossal.UI.Binding.IJsonWritable

Summary:
Represents a simple integer-valued UI property used in the in-game UI. This struct is a lightweight data container (public fields) that implements IJsonWritable so it can serialize itself to a JSON writer expected by the game's UI system. When serialized it uses the type name "Game.UI.Common.NumberProperty" and emits the fields: labelId, value, unit, signed, icon, and valueIcon in that order.


Fields

  • public string labelId
    Identifier (usually a localization key) for the label shown next to the numeric value. Can be null if no label is required.

  • public int value
    The integer numeric value displayed.

  • public string unit
    Unit text appended or shown alongside the numeric value (e.g., "km", "citizens"). Can be null or empty.

  • public bool signed
    If true, indicates the value should be displayed with an explicit sign for positive/negative values.

  • public string icon
    Path or identifier of an icon associated with the property (main icon).

  • public string valueIcon
    Path or identifier of an icon shown next to the numeric value itself.

Properties

  • None (this struct exposes public fields and has no C# properties)

Constructors

  • public IntProperty()
    Default parameterless struct constructor provided by the runtime. All fields default to their default values (labelId/unit/icon/valueIcon = null, value = 0, signed = false). There is no explicit constructor defined in the source.

Methods

  • public void Write(Colossal.UI.Binding.IJsonWriter writer) : System.Void
    Serializes this IntProperty to the provided IJsonWriter. The implementation:
  • Calls writer.TypeBegin("Game.UI.Common.NumberProperty")
  • Writes the property name "labelId" and the labelId value
  • Writes the property name "value" and the integer value
  • Writes the property name "unit" and the unit string
  • Writes the property name "signed" and the signed boolean
  • Writes the property name "icon" and the icon string
  • Writes the property name "valueIcon" and the valueIcon string
  • Calls writer.TypeEnd()

This produces a JSON object shaped like: { "type": "Game.UI.Common.NumberProperty", // conceptual — actual output depends on writer implementation "labelId": "...", "value": 123, "unit": "...", "signed": true|false, "icon": "...", "valueIcon": "..." }

Note: string fields may be null — behavior depends on the IJsonWriter implementation (it may emit null or omit fields).

Usage Example

// create and populate an IntProperty
var prop = new Game.UI.InGame.IntProperty {
    labelId = "UI_LABEL_POPULATION",
    value = 12500,
    unit = "citizens",
    signed = false,
    icon = "Icons/Population",
    valueIcon = "Icons/PopulationSmall"
};

// write it to an IJsonWriter
Colossal.UI.Binding.IJsonWriter writer = /* obtain writer from context */;
prop.Write(writer);