Skip to content

Game.UI.Editor.EditorScreenUISystem

Assembly:
Namespace: Game.UI.Editor

Type: class

Base: UISystemBase

Summary:
EditorScreenUISystem is a UI system used by the editor UI to track and change the currently active editor screen. It exposes an EditorScreen enum (Main, PauseMenu, Options, FreeCamera) and keeps a ValueBinding to synchronize the active screen with the UI binding system. It also registers a TriggerBinding to allow external systems to request a screen change via the "editor" binding group.


Fields

  • private const string kGroup = "editor"
    This constant defines the binding group name used for the UI bindings registered by this system. All bindings are created under the "editor" group.

  • private ValueBinding<EditorScreen> m_ActiveScreenBinding
    The ValueBinding holds the current EditorScreen value and synchronizes it with the Colossal UI binding system. It is used by the activeScreen property and updated by SetScreen or external trigger bindings.

Properties

  • public EditorScreen activeScreen { get; private set }
    Property that exposes the currently active editor screen via the m_ActiveScreenBinding. The getter reads the binding's value; the setter updates the binding, ensuring the change propagates to any bound UI elements or listeners.

Constructors

  • public EditorScreenUISystem()
    Parameterless constructor marked with [Preserve]. The constructor does not perform special initialization beyond what the base class does; binding initialization is done in OnCreate.

Methods

  • protected override void OnCreate() : System.Void
    Called when the UI system is created. This override:
  • Calls base.OnCreate().
  • Initializes m_ActiveScreenBinding as a new ValueBinding using group "editor", key "activeScreen", default EditorScreen.Main, and an EnumWriter for serialization.
  • Adds a TriggerBinding under the same group with key "setActiveScreen" that uses SetScreen as the handler and an EnumReader to parse incoming values. This registers the necessary bindings so UI code or scripts can read/set the active screen via the binding system.

  • public void SetScreen(EditorScreen screen) : System.Void
    Updates the active screen by calling m_ActiveScreenBinding.Update(screen). This method is also used as the handler for the TriggerBinding "setActiveScreen", allowing external triggers to change the editor screen.

Usage Example

[Preserve]
protected override void OnCreate()
{
    base.OnCreate();

    // The system registers bindings in OnCreate; you can read or set the active screen like this:
    // Read:
    var current = activeScreen;

    // Set directly:
    activeScreen = EditorScreenUISystem.EditorScreen.FreeCamera;

    // Or via the explicit method (also used by trigger binding):
    SetScreen(EditorScreenUISystem.EditorScreen.Options);
}