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 registersHandleCommandon the command bus duringInit. - It receives
Registercommands 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
Keyparam.
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 byUIRoot. It exposesRegistrationKeyandRegister.ICommandProcessor: implemented by components that want to receive routed commands.UIFlowControllercallsProcessCommandon 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
UICommandFactorycallsCommand.CreatewithDomain.UIand sends the result withBusUtility.Send.UIEventFactorycreatesEventobjects and sends them withBusUtility.Raise.UIFlowControllerextendsFlowController, which handles bus registration.UICommandFactoryandUIEventFactoryuseCoreParamKeysfor shared keys, such asKey,Tag,RegistrationKey, andDomainContext.