Class BaseEventSystem
Base Event System that can be inherited from to give other system features event capabilities.
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit
Assembly: cs.temp.dll.dll
Syntax
public abstract class BaseEventSystem : BaseService, IMixedRealityEventSystem, IMixedRealityService, IDisposable
Fields
enableDanglingHandlerDiagnostics
Declaration
public static bool enableDanglingHandlerDiagnostics
Field Value
Type | Description |
---|---|
Boolean |
Properties
EventHandlersByType
List of all event handlers grouped by type that are registered to this Event System.
Declaration
public Dictionary<Type, List<BaseEventSystem.EventHandlerEntry>> EventHandlersByType { get; }
Property Value
Type | Description |
---|---|
Dictionary<Type, List<BaseEventSystem.EventHandlerEntry>> |
EventListeners
List of event listeners that are registered to this Event System.
Declaration
public List<GameObject> EventListeners { get; }
Property Value
Type | Description |
---|---|
List<GameObject> |
Remarks
This collection is obsolete and is replaced by handler-based internal storage. It will be removed in a future release.
Methods
Destroy()
Optional Destroy function to perform cleanup of the service before the Mixed Reality Toolkit is destroyed.
Declaration
public override void Destroy()
Overrides
HandleEvent<T>(BaseEventData, ExecuteEvents.EventFunction<T>)
The main function for handling and forwarding all events to their intended recipients.
Declaration
public virtual void HandleEvent<T>(BaseEventData eventData, ExecuteEvents.EventFunction<T> eventHandler)
where T : IEventSystemHandler
Parameters
Type | Name | Description |
---|---|---|
BaseEventData | eventData | Event Data |
ExecuteEvents.EventFunction<T> | eventHandler | Event Handler delegate |
Type Parameters
Name | Description |
---|---|
T | Event Handler Interface Type |
Remarks
Register(GameObject)
Registers a GameObject to listen for events from this Event System.
Declaration
public virtual void Register(GameObject listener)
Parameters
Type | Name | Description |
---|---|---|
GameObject | listener | GameObject to add to EventListeners. |
RegisterHandler<T>(IEventSystemHandler)
Registers the given handler as a global listener for all events handled via the T interface. T must be an interface type, not a class type, derived from IEventSystemHandler.
Declaration
public virtual void RegisterHandler<T>(IEventSystemHandler handler)
where T : IEventSystemHandler
Parameters
Type | Name | Description |
---|---|---|
IEventSystemHandler | handler | Handler to receive global input events of specified handler type. |
Type Parameters
Name | Description |
---|---|
T |
Remarks
If you want to register a single C# object as global handler for several event handling interfaces, you must call this function for each interface type.
Unregister(GameObject)
Unregisters a GameObject from listening for events from this Event System.
Declaration
public virtual void Unregister(GameObject listener)
Parameters
Type | Name | Description |
---|---|---|
GameObject | listener | GameObject to remove from EventListeners. |
UnregisterHandler<T>(IEventSystemHandler)
Unregisters the given handler as a global listener for all events handled via the T interface. T must be an interface type, not a class type, derived from IEventSystemHandler.
Declaration
public virtual void UnregisterHandler<T>(IEventSystemHandler handler)
where T : IEventSystemHandler
Parameters
Type | Name | Description |
---|---|---|
IEventSystemHandler | handler | Handler to stop receiving global input events of specified handler type. |
Type Parameters
Name | Description |
---|---|
T |
Remarks
If a single C# object listens to global input events for several event handling interfaces, you must call this function for each interface type.