Skip to content

Game.Settings.InterfaceSettings

Assembly: Assembly-CSharp
Namespace: Game.Settings

Type: class

Base: Setting

Summary:
InterfaceSettings holds user-configurable interface options for Cities: Skylines 2 (language, UI style, popup behavior, hint/input preferences, and unit/time/temperature systems). It exposes settings with attributes used by the game's settings UI (e.g., SettingsUISection, SettingsUIDropdown, SettingsUISlider). The class provides defaults, persistence hooks (Apply), helpers to populate UI dropdowns (GetLanguageValues, GetInterfaceStyleValues), and logic to resolve the final input-hints/gamepad type (GetFinalInputHintsType).


Fields

  • public const string kName = "Interface"
    Identifier/name for this settings group.

  • public const string kLanguageGroup = "Language"
    UI group name used by settings UI for language-related settings.

  • public const string kStyleGroup = "Style"
    UI group name used by settings UI for style-related settings.

  • public const string kPopupGroup = "Popup"
    UI group name used by settings UI for popup-related settings.

  • public const string kHintGroup = "Hint"
    UI group name used by settings UI for hint/input-related settings.

  • public const string kUnitGroup = "Unit"
    UI group name used by settings UI for unit/time/temperature settings.

  • public const string kBlockGroup = "Block"
    UI group name reserved for block-related settings grouping.

(There are no private backing fields declared explicitly in this file aside from auto-implemented properties and constants above.)

Properties

  • public string currentLocale { get; set; }
  • Attributes: [Exclude], [SettingsUISection("Language")], [SettingsUIDropdown(typeof(InterfaceSettings), "GetLanguageValues")]
  • Custom getter: returns GameManager.instance.localizationManager.activeLocaleId when the stored locale is "os"; otherwise returns the stored locale.
  • Custom setter: stores the value into locale. This property is intended to be shown in the settings UI as a language dropdown, while locale is the actual stored value.

  • public string locale { get; set; }

  • Attributes: [SettingsUIHidden]
  • The underlying stored locale ID. Default is "os" (meaning use OS/active locale). Used by Apply() to set active locale.

  • public string interfaceStyle { get; set; }

  • Attributes: [SettingsUISection("Style")], [SettingsUIDropdown(typeof(InterfaceSettings), "GetInterfaceStyleValues")]
  • Holds the theme/style id for UI (e.g., "default", "bright-blue", "dark-grey-orange").

  • public float interfaceTransparency { get; set; }

  • Attributes: [SettingsUISection("Style")], [SettingsUISlider(min = 0f, max = 100f, step = 1f, unit = "percentage", scalarMultiplier = 100f)]
  • Controls UI transparency (stored as 0..1, with UI shown as percentage).

  • public bool interfaceScaling { get; set; }

  • Attributes: [SettingsUIDeveloper], [SettingsUISection("Style")]
  • Developer-visible toggle for interface scaling.

  • public float textScale { get; set; }

  • Attributes: [SettingsUISection("Style")], [SettingsUISlider(min = 100f, max = 150f, step = 10f, unit = "percentage", scalarMultiplier = 100f)]
  • Text scaling multiplier (stored as 1.0 == 100%).

  • public bool unlockHighlightsEnabled { get; set; }

  • Attributes: [SettingsUISection("Popup")]
  • Toggle for unlock/highlight popups.

  • public bool chirperPopupsEnabled { get; set; }

  • Attributes: [SettingsUISection("Popup")]
  • Toggle for Chirper/popups.

  • public bool blockingPopupsEnabled { get; set; }

  • Attributes: [SettingsUISection("Popup")]
  • Toggle for blocking popups.

  • public bool showWhatsNewPanel { get; set; }

  • Attributes: [SettingsUISection("Popup")]
  • Toggle to show the "What's New" panel.

  • public bool resetDismissedConfirmations { set }

  • Attributes: [SettingsUISection("Popup")]
  • Write-only property: setting any value causes the dismissedConfirmations set to be cleared and ApplyAndSave() to be called (effectively resetting stored dismissed confirmations).

  • public InputHintsType inputHintsType { get; set; }

  • Attributes: [SettingsUIPlatform(Platform.PC, false)], [SettingsUISection("Hint")]
  • Enum controlling input hints display type (AutoDetect / Xbox / PS).

  • public KeyboardLayout keyboardLayout { get; set; }

  • Attributes: [SettingsUIPlatform(Platform.PC, false)], [SettingsUISection("Hint")]
  • Enum for keyboard layout preference (AutoDetect / International).

  • public bool shortcutHints { get; set; }

  • Attributes: [SettingsUIPlatform(Platform.PC, false)], [SettingsUISection("Hint")]
  • Toggle to show shortcut hints.

  • public TimeFormat timeFormat { get; set; }

  • Attributes: [SettingsUISection("Unit")]
  • Enum: 24-hour or 12-hour clock.

  • public TemperatureUnit temperatureUnit { get; set; }

  • Attributes: [SettingsUISection("Unit")]
  • Enum: Celsius, Fahrenheit, Kelvin.

  • public UnitSystem unitSystem { get; set; }

  • Attributes: [SettingsUISection("Unit")]
  • Enum for metric vs. imperial ("Freedom") units.

  • public HashSet<string> dismissedConfirmations { get; set; }

  • Attributes: [SettingsUIHidden]
  • A set of string identifiers representing confirmations the user has dismissed. Managed by AddDismissedConfirmation and the resetDismissedConfirmations setter.

Enums (nested types) exposed by this class: - InputHintsType: AutoDetect, Xbox, PS - KeyboardLayout: AutoDetect, International - TimeFormat: TwentyFourHours, TwelveHours - TemperatureUnit: Celsius, Fahrenheit, Kelvin - UnitSystem: Metric, Freedom

Constructors

  • public InterfaceSettings()
  • Calls SetDefaults() to initialize all properties to default values.

Methods

  • public void AddDismissedConfirmation(string name)
  • Adds the given confirmation identifier to dismissedConfirmations and calls ApplyAndSave() to persist the change.

  • public override void SetDefaults()

  • Initializes all settings to their default values:

    • locale = "os"
    • interfaceStyle = "default"
    • interfaceTransparency = 0.5f
    • interfaceScaling = true
    • textScale = 1f
    • unlockHighlightsEnabled = true
    • chirperPopupsEnabled = true
    • showWhatsNewPanel = true
    • blockingPopupsEnabled = true
    • inputHintsType = InputHintsType.AutoDetect
    • keyboardLayout = KeyboardLayout.AutoDetect
    • shortcutHints = true
    • timeFormat = TimeFormat.TwentyFourHours
    • temperatureUnit = TemperatureUnit.Celsius
    • unitSystem = UnitSystem.Metric
    • dismissedConfirmations = new HashSet()
  • public override void Apply()

  • Applies settings. Calls the base Apply() and sets the game's active locale via: GameManager.instance.localizationManager.SetActiveLocale(locale)

  • [Preserve] public static DropdownItem<string>[] GetLanguageValues()

  • Builds and returns an array of DropdownItem for all supported locales. Uses GameManager.instance.localizationManager.GetSupportedLocales() and maps each locale id to a localized display name.

  • [Preserve] public static DropdownItem<string>[] GetInterfaceStyleValues()

  • Returns a fixed list of supported interface style dropdown entries:

    • "default" -> "Options.INTERFACE_STYLE[default]"
    • "bright-blue" -> "Options.INTERFACE_STYLE[bright-blue]"
    • "dark-grey-orange" -> "Options.INTERFACE_STYLE[dark-grey-orange]"
  • public InputManager.GamepadType GetFinalInputHintsType()

  • Resolves the final GamepadType to use for input hints:
    • If inputHintsType == AutoDetect: returns InputManager.instance.GetActiveGamepadType()
    • If inputHintsType == Xbox: returns InputManager.GamepadType.Xbox
    • If inputHintsType == PS: returns InputManager.GamepadType.PS
    • Default fallback returns Xbox

Usage Example

// Create or retrieve settings instance (example shows construction; in-game settings
// are typically managed by the game's settings system).
InterfaceSettings settings = new InterfaceSettings();

// Change language to English and apply (if you want to force a specific locale)
settings.locale = "en";
settings.Apply(); // Apply will call LocalizationManager.SetActiveLocale(locale)

// Change UI style and save via Apply (Apply may be followed by Save depending on the settings system)
settings.interfaceStyle = "bright-blue";
settings.Apply();

// Add a dismissed confirmation so it won't show again
settings.AddDismissedConfirmation("BuildingDemolishConfirm");

// Reset all dismissed confirmations via the write-only setter
settings.resetDismissedConfirmations = true;

// Get the effective gamepad type for hints (resolves AutoDetect via InputManager)
InputManager.GamepadType hintType = settings.GetFinalInputHintsType();

Notes and tips: - Many properties are annotated with settings UI attributes: those control how the option is presented in the in-game settings dialog (sections, dropdown population methods, sliders, platform visibility, and developer-only visibility). - locale default "os" means "use the active/OS locale". currentLocale exposes that resolved value for presentation in the UI. - Apply() updates the runtime localization immediately; persistence (saving to disk) is handled by the broader settings system (e.g., ApplyAndSave or base class behavior).