// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; namespace Microsoft.MixedReality.Toolkit { /// /// Interface used to implement an Event System that is compatible with the Mixed Reality Toolkit. /// public interface IMixedRealityEventSystem : IMixedRealityService { /// /// List of event listeners that are registered to this Event System. /// /// /// This collection is obsolete and is replaced by handler-based internal storage. It will be removed in a future release. /// List EventListeners { get; } /// /// The main function for handling and forwarding all events to their intended recipients. /// /// See: https://docs.unity3d.com/Manual/MessagingSystem.html /// Event Handler Interface Type /// Event Data /// Event Handler delegate void HandleEvent(BaseEventData eventData, ExecuteEvents.EventFunction eventHandler) where T : IEventSystemHandler; /// /// Registers a GameObject to listen for events from this Event System. /// /// GameObject to add to . [Obsolete("Register using a game object causes all components of this object to receive global events of all types. " + "Use RegisterHandler<> methods instead to avoid unexpected behavior.")] void Register(GameObject listener); /// /// Unregisters a GameObject from listening for events from this Event System. /// /// GameObject to remove from . [Obsolete("Unregister using a game object will disable listening of global events for all components of this object. " + "Use UnregisterHandler<> methods instead to avoid unexpected behavior.")] void Unregister(GameObject listener); /// /// 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. /// /// /// 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. /// /// Handler to receive global input events of specified handler type. void RegisterHandler(IEventSystemHandler handler) where 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. /// /// /// If a single C# object listens to global input events for several event handling interfaces, /// you must call this function for each interface type. /// /// Handler to stop receiving global input events of specified handler type. void UnregisterHandler(IEventSystemHandler handler) where T : IEventSystemHandler; } }