Game.Prefabs.IGradientInfomode
Assembly:
Assembly-CSharp (game's main assembly; the type is defined in the game's compiled assemblies, typically Assembly-CSharp.dll)
Namespace:
Game.Prefabs
Type:
interface
Base:
None (interface)
Summary:
Interface that describes a gradient-style info mode legend. Implementations provide the legend type, optional localized labels for low/medium/high ranges, and the corresponding colors for those ranges. Intended for UI components that render gradient legends in infomodes (heatmaps / choropleths) in Cities: Skylines 2.
Fields
- This interface declares no fields.
{{ This interface exposes only properties (no backing fields are specified here). }}
Properties
-
GradientLegendType legendType { get; }
{{ The legendType property identifies which predefined legend this implementation represents (enum GradientLegendType). Used by UI or systems to choose legend behavior or labeling conventions. }} -
LocalizedString? lowLabel { get; }
{{ Optional localized label for the "low" end of the gradient. Nullable; if null the UI may infer or omit the label. LocalizedString comes from Game.UI.Localization. }} -
LocalizedString? mediumLabel { get; }
{{ Optional localized label for the middle range of the gradient. Nullable. }} -
LocalizedString? highLabel { get; }
{{ Optional localized label for the "high" end of the gradient. Nullable. }} -
Color lowColor { get; }
{{ UnityEngine.Color used for the "low" range of the gradient. }} -
Color mediumColor { get; }
{{ UnityEngine.Color used for the middle range of the gradient. }} -
Color highColor { get; }
{{ UnityEngine.Color used for the "high" range of the gradient. }}
Constructors
- Interfaces do not define constructors.
{{ Implementing types provide constructors as needed. }}
Methods
- This interface does not declare methods (only property getters).
{{ All members are read-only properties; behavior is provided by implementers. }}
Usage Example
using Game.Prefabs;
using Game.UI.Localization;
using UnityEngine;
public class PopulationGradientInfomode : IGradientInfomode
{
public GradientLegendType legendType => GradientLegendType.Population;
// Example of providing localized strings; actual LocalizedString construction depends on game's localization API
public LocalizedString? lowLabel => new LocalizedString("info.population.low");
public LocalizedString? mediumLabel => new LocalizedString("info.population.medium");
public LocalizedString? highLabel => new LocalizedString("info.population.high");
public Color lowColor => Color.green;
public Color mediumColor => Color.yellow;
public Color highColor => Color.red;
}
{{Notes: GradientLegendType is an enum (not shown here) that categorizes legend semantics. LocalizedString is nullable in the interface — returning null indicates no label should be shown or that a default should be used. Colors use UnityEngine.Color.}}