Class EventSystem
public class EventSystem : MonoEventCoordinator, IEventCoordinator
- Inheritance
-
EventSystem
- Implements
- Inherited Members
Constructors
EventSystem()
public EventSystem()
Properties
EventHandler
Get event system CallbackEventHandler
public static CallbackEventHandler EventHandler { get; }
Property Value
Instance
public static EventSystem Instance { get; }
Property Value
Methods
Awake()
protected override void Awake()
GetCallbackEventHandler()
Get coordinator's default event handler
public override sealed CallbackEventHandler GetCallbackEventHandler()
Returns
RegisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
Adds an event handler to the instance. If the event handler has already been registered for the same phase (either TrickleDown or BubbleUp) then this method has no effect.
public static void RegisterCallback<TEventType>(EventCallback<TEventType> callback, TrickleDown useTrickleDown = TrickleDown.NoTrickleDown) where TEventType : EventBase<TEventType>, new()
Parameters
callbackEventCallback<TEventType>The event handler to add.
useTrickleDownTrickleDown
Type Parameters
TEventType
SendEvent(EventBase, DispatchMode, MonoDispatchType)
Sends an event to the event handler.
public static void SendEvent(EventBase eventBase, DispatchMode dispatchMode = DispatchMode.Default, MonoDispatchType monoDispatchType = MonoDispatchType.Update)
Parameters
eventBaseEventBaseThe event to send.
dispatchModeDispatchModeThe event dispatch mode.
monoDispatchTypeMonoDispatchTypeDispatch event on which MonoBehaviour tick frame。
UnregisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
Remove callback from the instance.
public static void UnregisterCallback<TEventType>(EventCallback<TEventType> callback, TrickleDown useTrickleDown = TrickleDown.NoTrickleDown) where TEventType : EventBase<TEventType>, new()
Parameters
callbackEventCallback<TEventType>The callback to remove. If this callback was never registered, nothing happens.
useTrickleDownTrickleDownSet this parameter to true to remove the callback from the TrickleDown phase. Set this parameter false to remove the callback from the BubbleUp phase.
Type Parameters
TEventType