Skip to content

Game.UI.Unit

Assembly: Assembly-CSharp
Namespace: Game.UI

Type: static class

Base: System.Object

Summary:
A collection of string constants representing unit identifiers used by the game's UI for formatting and localization. These keys indicate how numerical values should be displayed (integer, percentage, length, area, money per month, etc.) and are referenced by UI formatters, localized strings, and widgets when showing values to the player. Use these constants to ensure the UI formatting system selects the correct unit/format and localization entry for a value.


Fields

  • public const string kInteger
    Used for whole-number values without fractional parts (e.g., counts, people).

  • public const string kIntegerPerMonth
    Integer values that represent a per-month rate (e.g., income per month).

  • public const string kIntegerPerHour
    Integer values representing a per-hour rate.

  • public const string kFloatSingleFraction
    Floating-point values formatted with a single fractional digit (e.g., 1.2).

  • public const string kFloatTwoFractions
    Floating-point values formatted with two fractional digits (e.g., 1.23).

  • public const string kFloatThreeFractions
    Floating-point values formatted with three fractional digits (e.g., 1.234).

  • public const string kPercentage
    Values shown as percentages without fractional digits (e.g., 50%).

  • public const string kPercentageSingleFraction
    Percentage values shown with a single fractional digit (e.g., 12.3%).

  • public const string kAngle
    Angle values (degrees or other angle units as handled by the UI).

  • public const string kLength
    Length/distance units (meters, kilometers, or localized equivalent).

  • public const string kArea
    Area units (square meters, hectares, etc., depending on localization).

  • public const string kVolume
    Volume units (cubic meters, liters, etc., as appropriate).

  • public const string kVolumePerMonth
    Volume flow or consumption per month.

  • public const string kWeight
    Weight/mass units.

  • public const string kWeightPerCell
    Weight value normalized per cell (game-specific).

  • public const string kWeightPerMonth
    Weight per month.

  • public const string kPower
    Power units (watts, kilowatts, megawatts depending on UI/localization).

  • public const string kEnergy
    Energy units (joules, kWh, etc., as handled by the UI).

  • public const string kDataRate
    Data rate units (bytes/s, KB/s, etc.).

  • public const string kDataBytes
    Data size in bytes.

  • public const string kDataMegabytes
    Data size displayed in megabytes.

  • public const string kMoney
    Monetary values (currency formatting, localized currency symbol).

  • public const string kMoneyPerCell
    Money normalized per cell.

  • public const string kMoneyPerMonth
    Money per month (income/expense rate).

  • public const string kMoneyPerHour
    Money per hour.

  • public const string kMoneyPerDistance
    Money normalized per distance (game-specific).

  • public const string kMoneyPerDistancePerMonth
    Money per distance per month.

  • public const string kXP
    Experience points unit.

  • public const string kTemperature
    Temperature unit (°C, °F depending on locale).

  • public const string kNetElevation
    Net elevation values (height units used by the game).

  • public const string kScreenFrequency
    Screen refresh/frequency unit (Hz).

  • public const string kCustom
    A generic key for custom unit handling—used when a bespoke or mod-defined unit is required.

Properties

  • None.
    This static class exposes only constant fields used as identifiers; it does not define properties.

Constructors

  • None.
    As a static class, Unit has no constructors and cannot be instantiated.

Methods

  • None.
    Unit only provides string constants; formatting behavior is provided elsewhere in the UI/formatting system.

Usage Example

// Simple concatenation (not localized/units-aware)
float income = 1234.5f;
string text = $"{income} {Game.UI.Unit.kMoneyPerMonth}"; // "1234.5 moneyPerMonth"

// Preferred: use the game's UI formatter/localization system that recognizes these keys.
// Hypothetical example — actual API may differ in the game:
float powerOutput = 2500f;
string formatted = UIFormatter.Format(powerOutput, Game.UI.Unit.kPower); // "2.5 MW" or localized result
myLabel.text = formatted;