using System; using System.Collections.Generic; using UnityEngine.Scripting.APIUpdating; using UnityEngine.XR.Interaction.Toolkit.Interactables; namespace UnityEngine.XR.Interaction.Toolkit.Interactors { /// /// An interface that represents an Interaction Group component that enforces that only one /// within the Group can interact at a time. /// /// /// [MovedFrom("UnityEngine.XR.Interaction.Toolkit")] public interface IXRInteractionGroup { /// /// Calls the methods in its invocation list when this Interaction Group is registered with an Interaction Manager. /// /// /// The passed to each listener is only valid while the event is invoked, /// do not hold a reference to it. /// /// event Action registered; /// /// Calls the methods in its invocation list when this Interaction Group is unregistered from an Interaction Manager. /// /// /// The passed to each listener is only valid while the event is invoked, /// do not hold a reference to it. /// /// event Action unregistered; /// /// The name of the interaction group, which can be used to retrieve it from the Interaction Manager. /// string groupName { get; } /// /// The Interactor in this Interaction Group or any of its member Groups that is currently performing interaction. /// IXRInteractor activeInteractor { get; } /// /// The Interactor in this Interaction Group or any of its member Groups that initiated the last focus event. /// IXRInteractor focusInteractor { get; } /// /// The Interactable that is currently being focused by an Interactor in this Interaction Group or any of its member Groups. /// IXRFocusInteractable focusInteractable { get; } /// /// The calls this method when this Interaction Group is registered with it. /// /// Event data containing the Interaction Manager that registered this Interaction Group. /// /// is only valid during this method call, do not hold a reference to it. /// /// void OnRegistered(InteractionGroupRegisteredEventArgs args); /// /// The calls this method just before this Interaction Group is unregistered from it. /// /// /// This is where the Group should re-register its members with the Interaction Manager so that they are registered /// as not belonging to a Group. /// /// void OnBeforeUnregistered(); /// /// The calls this method when this Interaction Group is unregistered from it. /// /// Event data containing the Interaction Manager that unregistered this Interaction Group. /// /// is only valid during this method call, do not hold a reference to it. /// /// void OnUnregistered(InteractionGroupUnregisteredEventArgs args); /// /// Adds the given Group member to the end of the ordered list of members in the Group. /// Causes no change if the Group member is already added. /// /// The Group member to add. /// /// must implement either or . /// void AddGroupMember(IXRGroupMember groupMember); /// /// Moves the given Group member to the specified index in the ordered list of members in the Group. /// If the member is not in the list, this can be used to insert the member at the specified index. /// /// The Group member to move or add. /// New index of the Group member. /// /// must implement either or . /// void MoveGroupMemberTo(IXRGroupMember groupMember, int newIndex); /// /// Removes the given Group member from the list of members. /// /// The Group member to remove. /// /// Returns if was removed from the list. /// Otherwise, returns if was not found in the list. /// bool RemoveGroupMember(IXRGroupMember groupMember); /// /// Removes all Group members from the list of members. /// void ClearGroupMembers(); /// /// Checks whether the given Group member exists in the list of members. /// /// The Group member to check for in the list. /// /// Returns if exists in the list. /// Otherwise, returns . /// bool ContainsGroupMember(IXRGroupMember groupMember); /// /// Returns all members in the ordered list of Group members into List . /// /// List to receive Group members. /// /// This method populates the list with the Group members at the time the method is called. It is not a live view, /// meaning Group members added or removed afterward will not be reflected in the results of this method. /// Clears before adding to it. /// void GetGroupMembers(List results); /// /// Checks whether the given Group is either the same as this Group or a dependency of any member Group. /// /// The Group to check for as a dependency. /// /// Returns if is either the same as this Group or a dependency /// of this Group. Otherwise, returns . /// bool HasDependencyOnGroup(IXRInteractionGroup group); /// /// The or containing calls this method to /// update the Group and its members before interaction events occur. /// /// The update phase during which this method is called. /// /// Please see the and documentation for more /// details on update order. /// /// /// void PreprocessGroupMembers(XRInteractionUpdateOrder.UpdatePhase updatePhase); /// /// The or containing calls this method to /// update the Group and its members after interaction events occur. /// /// The update phase during which this method is called. /// /// Please see the and documentation for more /// details on update order. /// /// /// void ProcessGroupMembers(XRInteractionUpdateOrder.UpdatePhase updatePhase); /// /// The calls this method to update interactions for this Group's members. /// This is where interaction events occur for any member. /// /// /// The implementation of this method should call . /// void UpdateGroupMemberInteractions(); /// /// Updates interactions for this Group's members, given an Interactor that has already been prioritized for interaction. /// This is where interaction events occur for any member. /// /// The Interactor that has already been prioritized for interaction. /// If not , this prevents all other members in this Group from interacting. /// The Interactor in this Group or any of its member Groups /// that performed interaction as a result of this method call. This will be if no /// Interactor performed interaction. /// /// The implementation of this method should call this method on each member that is an . /// After this method is called, should return the same reference as /// . /// void UpdateGroupMemberInteractions(IXRInteractor prePrioritizedInteractor, out IXRInteractor interactorThatPerformedInteraction); /// /// The calls this method /// right before the Interaction group first gains focus of an Interactable /// in a first pass. /// /// Event data containing the Interaction group that is initiating the focus. /// /// is only valid during this method call, do not hold a reference to it. /// /// void OnFocusEntering(FocusEnterEventArgs args); /// /// The calls this method /// right before the Interaction group loses focus of an Interactable /// in a first pass. /// /// Event data containing the Interaction group that is losing focus. /// /// is only valid during this method call, do not hold a reference to it. /// /// void OnFocusExiting(FocusExitEventArgs args); } }