Skip to content

Game.City.StatisticUnitType

Assembly:
Game

Namespace: Game.City

Type: public enum

Base: System.Enum

Summary: Represents the unit type associated with a city statistic. Used to indicate how a numeric value should be interpreted and displayed (no unit, currency, percentage, or weight). Mods can use this enum to decide formatting, unit conversion and UI labels when presenting statistic values.


Fields

  • None
    Indicates no specific unit or that the unit is not applicable.

  • Money
    Values represent currency. Display/format using the game's currency conventions (currency symbol, separators, rounding).

  • Percent
    Values are percentages. Typically formatted as 0–100% for presentation (may be stored as 0–100 or 0–1 depending on context — check calling code).

  • Weight
    Values represent a weight/mass unit. The exact measurement (kg, t, etc.) depends on the context where the enum is used.

Properties

  • This enum defines no properties. Use System.Enum methods (e.g., ToString, Parse) if needed.

Constructors

  • Enums have no explicit constructors defined in user code. Values are the defined named constants (None, Money, Percent, Weight).

Methods

  • No methods are defined on this enum type itself. Common operations are provided by System.Enum (e.g., Enum.TryParse, GetValues, ToString).

Usage Example

using Game.City;
using UnityEngine;

public class StatDisplay
{
    public void ShowStatistic(StatisticUnitType unit, float value)
    {
        switch (unit)
        {
            case StatisticUnitType.Money:
                Debug.Log(string.Format("{0:C}", value)); // format as currency
                break;
            case StatisticUnitType.Percent:
                Debug.Log(string.Format("{0:0.##}%", value)); // formatted percent (assumes value is 0-100)
                break;
            case StatisticUnitType.Weight:
                Debug.Log(value + " kg"); // context-dependent unit
                break;
            case StatisticUnitType.None:
            default:
                Debug.Log(value.ToString());
                break;
        }
    }
}