Ejemplo n.º 1
0
        /// <inheritdoc />
        public override void OnSourceDetected(SourceStateEventData eventData)
        {
            using (OnSourceDetectedPerfMarker.Auto())
            {
                base.OnSourceDetected(eventData);

                if (eventData.InputSource.SourceId == Controller.InputSource.SourceId)
                {
                    isInteractionEnabled = true;
                }
            }
        }
        /// <inheritdoc />
        public virtual void OnSourceLost(SourceStateEventData eventData)
        {
            if (eventData.SourceId == Controller?.InputSource.SourceId &&
                eventData.Controller?.ControllerHandedness == Handedness)
            {
                TrackingState = TrackingState.NotTracked;

                if (destroyOnSourceLost)
                {
                    GameObjectExtensions.DestroyGameObject(gameObject);
                }
            }
        }
Ejemplo n.º 3
0
        /// <inheritdoc />
        public override void OnSourceDetected(SourceStateEventData eventData)
        {
            if (RayStabilizer != null)
            {
                RayStabilizer = null;
            }

            base.OnSourceDetected(eventData);

            if (eventData.SourceId == Controller?.InputSource.SourceId)
            {
                isInteractionEnabled = true;
            }
        }
Ejemplo n.º 4
0
        /// <inheritdoc />
        public override void OnSourceLost(SourceStateEventData eventData)
        {
            using (OnSourceLostPerfMarker.Auto())
            {
                base.OnSourceLost(eventData);

                if (Controller != null &&
                    eventData.Controller != null &&
                    eventData.Controller.InputSource.SourceId == Controller.InputSource.SourceId)
                {
                    isInteractionEnabled = false;
                }
            }
        }
        /// <inheritdoc />
        public override void OnSourceLost(SourceStateEventData eventData)
        {
            base.OnSourceLost(eventData);

            if (eventData.SourceId == InputSourceParent.SourceId)
            {
                if (requiresHoldAction)
                {
                    IsHoldPressed = false;
                }

                if (IsSelectPressed)
                {
                    MixedRealityToolkit.InputSystem.RaisePointerUp(this, pointerAction, Handedness);
                }

                IsSelectPressed = false;
            }
        }
        /// <inheritdoc />
        public virtual void OnSourceLost(SourceStateEventData eventData)
        {
            if (eventData.SourceId == Controller?.InputSource.SourceId &&
                eventData.Controller?.ControllerHandedness == Handedness)
            {
                IsTracked     = false;
                TrackingState = TrackingState.NotTracked;

                if (destroyOnSourceLost)
                {
                    if (!Application.isPlaying)
                    {
                        DestroyImmediate(gameObject);
                    }
                    else
                    {
                        Destroy(gameObject);
                    }
                }
            }
        }
Ejemplo n.º 7
0
        /// <inheritdoc />
        public virtual void OnSourceDetected(SourceStateEventData eventData)
        {
            if (eventData.Controller != null)
            {
                for (int i = 0; i < eventData.InputSource.Pointers.Length; i++)
                {
                    // If a source is detected that's using this cursor's pointer, we increment the count to set the cursor state properly.
                    if (eventData.InputSource.Pointers[i].PointerId == Pointer.PointerId)
                    {
                        visibleSourcesCount++;

                        if (SetVisibilityOnSourceDetected && visibleSourcesCount == 1)
                        {
                            SetVisibility(true);
                        }

                        return;
                    }
                }
            }
        }
        /// <inheritdoc />
        public void OnSourceLost(SourceStateEventData eventData)
        {
            // If the input source does not have pointers, then skip.
            if (eventData.InputSource.Pointers == null)
            {
                return;
            }

            // Let the pointer behavior know that the pointer has been lost
            IMixedRealityPointerMediator mediator;

            if (pointerMediators.TryGetValue(eventData.SourceId, out mediator))
            {
                mediator.UnregisterPointers(eventData.InputSource.Pointers);
            }

            pointerMediators.Remove(eventData.SourceId);

            for (var i = 0; i < eventData.InputSource.Pointers.Length; i++)
            {
                // Special unregistration for Gaze
                if (gazeProviderPointingData != null && eventData.InputSource.Pointers[i].PointerId == gazeProviderPointingData.Pointer.PointerId)
                {
                    // If the source lost is the gaze input source, then reset it.
                    if (eventData.InputSource.SourceId == ((IMixedRealityInputSystem)Service).GazeProvider?.GazeInputSource.SourceId)
                    {
                        gazeProviderPointingData.ResetFocusedObjects();
                        gazeProviderPointingData = null;
                    }
                    // Otherwise, don't unregister the gaze pointer, since the gaze input source is still active.
                    else
                    {
                        continue;
                    }
                }

                UnregisterPointer(eventData.InputSource.Pointers[i]);
            }
        }
Ejemplo n.º 9
0
        /// <inheritdoc />
        public virtual void OnSourceLost(SourceStateEventData eventData)
        {
            if (IsPointerValid && eventData.Controller != null)
            {
                for (int i = 0; i < eventData.InputSource.Pointers.Length; i++)
                {
                    // If a source is lost that's using this cursor's pointer, we decrement the count to set the cursor state properly.
                    if (eventData.InputSource.Pointers[i].PointerId == Pointer.PointerId)
                    {
                        visibleSourcesCount--;
                        break;
                    }
                }
            }

            SourceDownIds.Remove(eventData.SourceId);

            if (!IsSourceDetected && SetVisibilityOnSourceDetected)
            {
                SetVisibility(false);
            }
        }
        void IMixedRealitySourceStateHandler.OnSourceLost(SourceStateEventData eventData)
        {
            var inputSource = eventData.InputSource;

            for (int i = 0; i < inputSource.Pointers.Length; i++)
            {
                var pointer = inputSource.Pointers[i];
                if (pointer.InputSourceParent == inputSource)
                {
                    int pointerId = (int)pointer.PointerId;
                    Debug.Assert(pointerDataToUpdate.ContainsKey(pointerId));

                    PointerData pointerData = null;
                    if (pointerDataToUpdate.TryGetValue(pointerId, out pointerData))
                    {
                        Debug.Assert(!pointerDataToRemove.Contains(pointerData));
                        pointerDataToRemove.Add(pointerData);

                        pointerDataToUpdate.Remove(pointerId);
                    }
                }
            }
        }
        /// <inheritdoc />
        public void OnSourceLost(SourceStateEventData eventData)
        {
            if (eventData.SourceId == InputSourceParent.SourceId)
            {
                BaseCursor c = gazeProvider.GazePointer.BaseCursor as BaseCursor;
                if (c != null)
                {
                    c.SourceDownIds.Remove(eventData.SourceId);
                }

                if (isSelectPressed)
                {
                    // Raise OnInputUp if pointer is lost while select is pressed
                    CoreServices.InputSystem.RaisePointerUp(this, selectAction, lastControllerHandedness);

                    // For GGV, the gaze pointer does not set this value itself.
                    // See comment in OnInputDown for more details.
                    gazeProvider.GazePointer.IsFocusLocked = false;
                }

                // Destroy the pointer since nobody else is destroying us
                GameObjectExtensions.DestroyGameObject(gameObject);
            }
        }
 /// <inheritdoc />
 public void OnSourceDetected(SourceStateEventData eventData)
 {
 }
Ejemplo n.º 13
0
 void IMixedRealitySourceStateHandler.OnSourceDetected(SourceStateEventData eventData)
 {
 }
 void IMixedRealitySourceStateHandler.OnSourceDetected(SourceStateEventData eventData)
 {
     OnSourceDetected(eventData.InputSource);
 }
 void IMixedRealitySourceStateHandler.OnSourceLost(SourceStateEventData eventData)
 {
     OnSourceLost(eventData.InputSource);
 }
        /// <inheritdoc />
        public override void OnSourceLost(SourceStateEventData eventData)
        {
            TryRaisePokeUp();

            base.OnSourceLost(eventData);
        }
 /// <inheritdoc />
 public void OnSourceDetected(SourceStateEventData eventData)
 {
     RegisterPointers(eventData.InputSource);
 }
 /// <inheritdoc />
 public override void OnSourceDetected(SourceStateEventData eventData)
 {
     base.OnSourceDetected(eventData);
     PreviousPosition = Position;
 }