docs
Systems
Presentation
UISystem
Key Components

Manager and coordinator classes

UIFlowController

The project-level coordinator for the UI domain. Subclass it in each project to add project-specific UI behavior.

  • It inherits the registration step from FlowController, which registers HandleCommand on the command bus during Init.
  • It receives Register commands and stores each component in a registry keyed by its registration key.
  • It keeps a second registry for components that also implement ICommandProcessor.
  • It routes all other commands to the processor registered under the command's Key param.

UIRoot

The base class for UI MonoBehaviours that need to receive routed commands. A derived class provides a RegistrationKey. On Start, UIRoot registers itself through UICommandFactory. Derived classes that also implement ICommandProcessor will be found by the flow controller and receive commands.

Factories

UICommandFactory

Builds UI commands and sends them. The only method is RegisterFlowControllable, which UIRoot calls. Other UI commands are not built by this class in the current code.

UIEventFactory

Builds UI events and sends them to the event bus. Each method corresponds to one UI interaction: pointer clicks, double clicks, button clicks, and page open or close notices. It is declared partial, so other files can add methods to it.

Key event and data classes

UIEventVerb

Identifies what happened in a UI event. Listeners switch on this value to decide how to react.

UISubjects

Identifies which UI element an event is about. It is stored under UIParamKeys.UISubject on events that carry a subject.

UICommandVerb

Identifies the action a UI command asks for. Register is used by UICommandFactory. Other values are defined but not sent by code in this system.

UIRequestVerb

Defined for requests in the UI domain. This system does not use it.

UIParamKeys and UIParamKeyNames

UIParamKeys holds the typed keys. UIParamKeyNames holds the strings behind them. Callers should use UIParamKeys, not the string names.

Handler and listener interfaces

This system defines no interfaces of its own. It relies on two interfaces from the Commands dependency:

  • IFlowControllable: implemented by UIRoot. It exposes RegistrationKey and Register.
  • ICommandProcessor: implemented by components that want to receive routed commands. UIFlowController calls ProcessCommand on the registered component when a command's key matches.

Event listeners are not defined in this system. Any system that subscribes to the event bus for Domain.UI receives the events raised by UIEventFactory.

Interaction with dependency classes

  • UICommandFactory calls Command.Create with Domain.UI and sends the result with BusUtility.Send.
  • UIEventFactory creates Event objects and sends them with BusUtility.Raise.
  • UIFlowController extends FlowController, which handles bus registration.
  • UICommandFactory and UIEventFactory use CoreParamKeys for shared keys, such as Key, Tag, RegistrationKey, and DomainContext.