Skip to main content

EventBusLocator

A class in Root.Township, ATT.EventBus.

Static lookup for event buses by interface type. ProjectLifetimeScope registers the ITownshipEventBus, and game code gets it with Get to broadcast events.

Constructors​

MemberWhat it is
EventBusLocator()Creates an EventBusLocator with default values.

Fields​

2 private and internal fields
MemberWhat it is
private static readonly Dictionary<Type, IEventBus> instancesRegistered event buses, keyed by type.
private static readonly Logger loggerNLog logger for this class.

Methods​

MemberWhat it is
static T Get<T>()Returns the event bus registered for T. Logs an error and returns null if none is registered.
static void Register<T>(IEventBus eventBus)Registers an event bus under the type T, replacing any earlier one.