Game.Prefabs.PolicySliderUnit
Assembly:
Assembly-CSharp
Namespace:
Game.Prefabs
Type:
public enum
Base:
System.Enum (underlying type: System.Int32)
Summary:
Defines the unit/format type used by policy sliders (or other UI elements) to determine how a numeric policy value should be interpreted and displayed. Typical uses include formatting labels, applying clamping/step logic, and choosing appropriate input controls for the value.
Fields
-
money
Represents a currency value. UI should display with a currency format (or city-specific money symbol) and usually allow fractional or whole monetary amounts depending on slider setup. -
percentage
Represents a percentage value. UI should display with a trailing percent sign (%) and usually clamp values to a 0–100 range or another percentage range. -
integer
Represents a plain integer value. UI should display as a whole number and typically use integer step increments.
Properties
- This enum type has no properties.
{ No instance or static properties are defined for an enum. }
Constructors
- This enum type has no explicit constructors.
{ Enum values are created by the runtime; you cannot define constructors for enum members. }
Methods
- This enum type has no instance methods.
{ You can use standard System.Enum methods (ToString, Parse, TryParse, etc.) as applicable. }
Usage Example
// Example: formatting a policy slider value for display
string FormatPolicyValue(Game.Prefabs.PolicySliderUnit unit, float value)
{
switch (unit)
{
case Game.Prefabs.PolicySliderUnit.money:
// Use game/culture-specific formatting as needed
return string.Format("${0:N0}", value); // example: $1,000
case Game.Prefabs.PolicySliderUnit.percentage:
return string.Format("{0:0}%", value); // example: 75%
case Game.Prefabs.PolicySliderUnit.integer:
default:
return ((int)value).ToString(); // example: 42
}
}
// Example usage
var unit = Game.Prefabs.PolicySliderUnit.percentage;
float currentValue = 45f;
UnityEngine.Debug.Log(FormatPolicyValue(unit, currentValue)); // "45%"