Example #1
0
    public void OnSourceLost(SourceStateEventData eventData)
    {
        focused = false;
        pressed = false;
        if (currentlyInModal)
        {
            InputManager.Instance.PopModalInputHandler();
            currentlyInModal = false;
        }

        setCurrentColor();
    }
Example #2
0
    /// <summary>
    ///  On Source lost decrement hand count and set visiblity
    /// </summary>
    /// <param name="eventData"></param>
    public void OnSourceLost(SourceStateEventData eventData)
    {
        InteractionSourceInfo sourceInfo;

        if (eventData.InputSource.TryGetSourceKind(eventData.SourceId, out sourceInfo))
        {
            if (sourceInfo == InteractionSourceInfo.Hand)
            {
                _handCount--;
                _bHandVisible = _handCount <= 0;
            }
        }
    }
Example #3
0
    public void OnSourceLost(SourceStateEventData eventData)
    {
        //if the source lost is the current hand source
        if (currentInputEventData != null && eventData.SourceId == currentInputEventData.SourceId)
        {
            isScaling = false;
            mainCursor.OnInputUp(currentInputEventData);
            currentInputEventData = null;

            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();
        }
    }
Example #4
0
    /// <summary>
    /// On Source detected see if it is a hand and increment hand count and set visibility
    /// </summary>
    /// <param name="eventData"></param>
    public void OnSourceDetected(SourceStateEventData eventData)
    {
        InteractionSourceInfo sourceInfo;

        if (eventData.InputSource.TryGetSourceKind(eventData.SourceId, out sourceInfo))
        {
            if (sourceInfo == InteractionSourceInfo.Hand)
            {
                _handCount++;
                _bHandVisible = true;
            }
        }
    }
    public void OnSourceDetected(SourceStateEventData eventData)
    {
        //Debug.Log(gameObject.transform.GetChild(0));
        //Debug.Log("Before: " + gameObject.transform.GetChild(0).gameObject.activeInHierarchy);
        //Debug.Log("Hand detected");
        Vector3 position = Vector3.zero;
        uint    sourceId = eventData.SourceId;

        eventData.InputSource.TryGetGripPosition(sourceId, out position);
        gameObject.transform.GetChild(0).transform.position = position;
        gameObject.transform.GetChild(0).gameObject.SetActive(true);
        //Debug.Log("After: " + gameObject.transform.GetChild(0).gameObject.activeInHierarchy);
    }
 public void OnSourceDetected(SourceStateEventData eventData)
 {
     if (eventData.Controller?.ControllerHandedness == handedness)
     {
         if (eventData.Controller is IMixedRealityHand)
         {
         }
         else
         {
             AddControllerTransform(eventData.Controller);
         }
     }
 }
        // Add gesture source to gesture source dictionary when detected.
        public void OnSourceDetected(SourceStateEventData eventData)
        {
            IInputSource inputSource = eventData.InputSource;

            // If dictionary already contains source with this id, return.
            if (_gestureSources.ContainsKey(eventData.SourceId))
            {
                return;
            }

            var gestureSource = new GestureSource(inputSource, eventData.SourceId);

            _gestureSources.Add(eventData.SourceId, gestureSource);
        }
Example #8
0
        /// <inheritdoc />
        public void OnSourceDetected(SourceStateEventData eventData)
        {
            var hand = eventData.Controller;

            if (hand != null && IsApplicableController(hand) && !handStack.Contains(hand))
            {
                if (handStack.Count == 0)
                {
                    onFirstHandDetected?.Invoke();
                }

                handStack.Add(hand);
            }
        }
        /// <inheritdoc />
        public override void OnSourceDetected(SourceStateEventData eventData)
        {
            if (RayStabilizer != null)
            {
                RayStabilizer = null;
            }

            base.OnSourceDetected(eventData);

            if (eventData.SourceId == Controller?.InputSource.SourceId)
            {
                isInteractionEnabled = true;
            }
        }
        /// <inheritdoc />
        public void OnSourceLost(SourceStateEventData eventData)
        {
            var hand = eventData.Controller as IMixedRealityHand;

            if (hand != null)
            {
                handStack.Remove(hand);

                if (handStack.Count == 0)
                {
                    onLastHandLost.Invoke();
                }
            }
        }
        /// <inheritdoc />
        public void OnSourceDetected(SourceStateEventData eventData)
        {
            var hand = eventData.Controller as IMixedRealityHand;

            if (hand != null && !handStack.Contains(hand))
            {
                if (handStack.Count == 0)
                {
                    onFirstHandDetected.Invoke();
                }

                handStack.Add(hand);
            }
        }
Example #12
0
        /// <inheritdoc />
        public void OnSourceLost(SourceStateEventData eventData)
        {
            var hand = eventData.Controller;

            if (hand != null && IsApplicableController(hand))
            {
                handStack.Remove(hand);

                if (handStack.Count == 0)
                {
                    onLastHandLost?.Invoke();
                }
            }
        }
Example #13
0
    public void OnSourceLost(SourceStateEventData eventData)
    {
        if (currentInputSource != null && eventData.SourceId == currentInputSourceId)
        {
            Debug.Log("sourceLost");
            isRotating = false;

            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();

            mainCursor.OnInputUp(inputEventData);
            inputEventData     = null;
            currentInputSource = null;
        }
    }
Example #14
0
 public void OnSourceDetected(SourceStateEventData eventData)
 {
     if (playing)
     {
         if (!handRecognized)
         {
             handRecognized = true;
             StartCoroutine(WaitForSecondSource());
         }
         else
         {
             SetMenuVisible();
         }
     }
 }
Example #15
0
 /// <summary>
 /// Hololens检测到手的事件
 /// </summary>
 /// <param name="eventData"></param>
 public void OnSourceDetected(SourceStateEventData eventData)
 {
     if (CapturePhotoManager.Instance.GetCurrentStatus() == CurrentStatus.Ready ||
         CapturePhotoManager.Instance.GetCurrentStatus() == CurrentStatus.WaitingTakingPhoto)
     {
         CapturePhotoManager.Instance.SetCurrentStatus(CurrentStatus.WaitingTakingPhoto);
         ModelManager.Instance.ResetCropBoxTransform();
         ModelManager.Instance.SetPhotoImageActive(false);
         ModelManager.Instance.SetCropBoxActive(false);
         ModelManager.Instance.HideResult();
         ToolManager.Instance.HideMenu();
         ModelManager.Instance.SetTipText("点击进行拍照");
         ModelManager.Instance.PlayAnimation("IdleAnimation");
     }
 }
 public void OnSourceLost(SourceStateEventData eventData)
 {
     if (currentInputSource != null && eventData.SourceId == currentInputSourceId)
     {
         StopDragging();
     }
     else if (eventData.SourceId == handASourceId)
     {
         handAHolding = false;
     }
     else if (eventData.SourceId == handBSourceId)
     {
         handBHolding = false;
     }
 }
 /// <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++;
                 return;
             }
         }
     }
 }
Example #18
0
    public void OnSourceLost(SourceStateEventData eventData)
    {
        //Debug.Log("Source Lost");
        //if the source lost is the current hand source
        if (currentInputSource != null && eventData.SourceId == currentInputSourceId)
        {
            //get the main cursor back if not the case
            mainCursor.SetVisiblity(true);
            mainCursor.OnInputUp(currentInputEventData);
            drawingCursor.SetActive(false);

            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();
        }
    }
        public void OnSourceLost(SourceStateEventData eventData)
        {
            if (!OurInput(eventData.SourceId))
            {
                return;
            }

            if (isManipulating)
            {
                StopManipulation(false);
            }
            if (isHolding)
            {
                StopHold(false);
            }
        }
 public void OnSourceLost(SourceStateEventData eventData)
 {
     if (eventData.SourceId == handASourceId)
     {
         handAHolding = false;
         Debug.Log("Lost Hand A");
     }
     else if (eventData.SourceId == handBSourceId)
     {
         handBHolding = false;
         Debug.Log("Lost Hand B");
     }
     else
     {
         Debug.Log("Unrecognized lost hand");
     }
 }
        public void OnSourceLost(SourceStateEventData eventData)
        {
            if (!handDictionary.ContainsKey(eventData.SourceId))
            {
                Debug.LogError("handDictonary does not contain key: " + eventData.SourceId + " / OnSourceDetected, HandIndicatorManager");
                return;
            }

            Hand lostHand;

            handDictionary.TryGetValue(eventData.SourceId, out lostHand);
            Destroy(lostHand.indicator);

            handDictionary.Remove(eventData.SourceId);

            ExperimentManager.Instance.AddEventLog(LogEvent.HAND_LOST);
        }
        public void OnSourceDetected(SourceStateEventData eventData)
        {
            if (handDictionary.ContainsKey(eventData.SourceId))
            {
                Debug.LogError("handDictonary already contains key: " + eventData.SourceId + " / OnSourceDetected, HandIndicatorManager");
                return;
            }

            if (HandIndicatorPrefab == null)
            {
                return;
            }

            GameObject indicator = Instantiate(HandIndicatorPrefab);

            handDictionary.Add(eventData.SourceId, new Hand(eventData.InputSource, eventData.SourceId, indicator));

            ExperimentManager.Instance.AddEventLog(LogEvent.HAND_FOUND);
        }
 public void OnSourceLost(SourceStateEventData eventData)
 {
     if (currentInputSource != null && eventData.SourceId == currentInputSourceId)
     {
         if (logging) Debug.Log("Translate: Hand Lost at " + Time.time);
         StopDragging();
     }
     else if (eventData.SourceId == handASourceId)
     {
         handAHolding = false;
         Debug.Log("Rotate: Lost Hand A at " + Time.time);
     }
     else if (eventData.SourceId == handBSourceId)
     {
         handBHolding = false;
         Debug.Log("Rotate: Lost Hand B at " + Time.time);
     }
     else if (logging) Debug.Log("Lost Hand Unrecognized at " + Time.time);
 }
        private void InitializeEventDatas()
        {
            inputEventData           = new InputEventData(EventSystem.current);
            sourceClickedEventData   = new InputClickedEventData(EventSystem.current);
            sourceStateEventData     = new SourceStateEventData(EventSystem.current);
            manipulationEventData    = new ManipulationEventData(EventSystem.current);
            navigationEventData      = new NavigationEventData(EventSystem.current);
            holdEventData            = new HoldEventData(EventSystem.current);
            pointerSpecificEventData = new PointerSpecificEventData(EventSystem.current);
            inputPositionEventData   = new InputPositionEventData(EventSystem.current);
            selectPressedEventData   = new SelectPressedEventData(EventSystem.current);
            sourceRotationEventData  = new SourceRotationEventData(EventSystem.current);
            sourcePositionEventData  = new SourcePositionEventData(EventSystem.current);
            xboxControllerEventData  = new XboxControllerEventData(EventSystem.current);
#if UNITY_WSA || UNITY_STANDALONE_WIN
            speechEventData    = new SpeechEventData(EventSystem.current);
            dictationEventData = new DictationEventData(EventSystem.current);
#endif
        }
        // Remove gesture source from gesture source dictionary when lost.
        public void OnSourceLost(SourceStateEventData eventData)
        {
            // If dictionary contains no source with this id, return.
            if (!_gestureSources.ContainsKey(eventData.SourceId))
            {
                return;
            }

            // If the lost gesture source was currently manipulating invoke a
            // ManipulationEnd event.
            if (_gestureSources[eventData.SourceId].IsManipulating)
            {
                GestureSource[] gestureSources = new GestureSource[_gestureSources.Count];
                _gestureSources.Values.CopyTo(gestureSources, 0);

                var eventArgs = new GestureInputEventArgs(gestureSources);
                ManipulationEnd(eventArgs);
            }

            _gestureSources.Remove(eventData.SourceId);
        }
        /// <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.isEditor)
                    {
                        DestroyImmediate(gameObject);
                    }
                    else
                    {
                        Destroy(gameObject);
                    }
                }
            }
        }
        public void OnSourceLost(SourceStateEventData eventData)
        {
            // event not used in TapToPlace
            if (DraggingMethod == DraggingMethods.TapToPlaceWithGaze)
            {
                return;
            }

            if (currentInputSource != null && eventData.SourceId == currentInputSourceId)
            {
                if (IsBeingPlaced == IsBeingPlacedStates.ByHand)
                {
                    // if hand is lost, replace by gaze
                    if (DraggingMethod == DraggingMethods.TapToPlaceWithGazePlusPreciseHandDrag)
                    {
                        IsBeingPlaced = IsBeingPlacedStates.ByGaze;
                    }
                    else
                    {
                        StopDragging();
                    }
                }
            }
        }
Example #28
0
 public void OnSourceLost(SourceStateEventData eventData)
 {
     isDrag = false;
     Debug.Log("Lost");
 }
Example #29
0
 public void OnSourceDetected(SourceStateEventData eventData)
 {
     Debug.Log("Detected");
 }
 public void OnSourceLost(SourceStateEventData eventData)
 {
     Debug.LogFormat("OnSourceLost\r\nSource: {0}  SourceId: {1}", eventData.InputSource, eventData.SourceId);
 }
 public void OnSourceDetected(SourceStateEventData eventData)
 {
 }