private void OnTappedEvent(InteractionSourceKind source, int tapCount, Ray headRay)
        {
            SourceClickEventArgs args = new SourceClickEventArgs(this, 0, tapCount);

            //args.InputSource.isRegistered = true;
            RaiseSourceClickedEvent(args);
        }
        /// <summary>
        /// Sends the events for hand state changes.
        /// </summary>
        /// <param name="editorHandData">Hand data for which events should be sent.</param>
        private void SendHandStateEvents(EditorHandData editorHandData)
        {
            // Hand moved event
            if (editorHandData.HandDelta.sqrMagnitude > 0)
            {
                HandMoved.RaiseEvent(this, editorHandData.HandId);
            }

            // Finger pressed/released events
            if (editorHandData.FingerStateChanged)
            {
                if (editorHandData.IsFingerDown)
                {
                    RaiseSourceDownEvent(editorHandData.InputSourceArgs);
                }
                else
                {
                    RaiseSourceUpEvent(editorHandData.InputSourceArgs);

                    // Also send click event when using this hands replacement input
                    if (Time.time - editorHandData.FingerDownStartTime < MaxClickDuration)
                    {
                        // We currently only support single taps in editor
                        SourceClickEventArgs args = new SourceClickEventArgs(this, editorHandData.HandId, 1);
                        RaiseSourceClickedEvent(args);
                    }
                }
            }
        }
        private void Update()
        {
            if (usingWiimote)// && !click_a)
            {
                Receive();
            }
            if (click_a)
            {
                // Manual implementation of a timeout--make sure a click isn't processed twice
                //if (waitCount < 10) { Debug.Log("No click: " + waitCount); click_a = false;  waitCount++; }
                //else
                //{
                click_a   = false;
                waitCount = 0;
                SourceClickEventArgs args = new SourceClickEventArgs(this, 0, 1); // manual tap count of 1

                RaiseSourceClickedEvent(args);
                //}
            }
            else if (press_b && send_b)
            {
                InputSourceEventArgs args = new InputSourceEventArgs(this, 0);
                RaiseSourceDownEvent(args);
                send_b = false;
            }
            else if (release_b)
            {
                release_b = false;
                InputSourceEventArgs args = new InputSourceEventArgs(this, 0);
                RaiseSourceUpEvent(args);
            }
        }
示例#4
0
        private void OnTappedEvent(InteractionSourceKind source, int tapCount, Ray headRay)
        {
            SourceClickEventArgs args = new SourceClickEventArgs(this, 0, tapCount);

            projectile = GameObject.FindGameObjectWithTag("projectilePrefab");
            projectile.SendMessage("OnSelect", SendMessageOptions.RequireReceiver);
            RaiseSourceClickedEvent(args);
        }
        protected void RaiseSourceClickedEvent(SourceClickEventArgs e)
        {
            EventHandler <SourceClickEventArgs> handler = SourceClicked;

            if (handler != null)
            {
                handler(this, e);
            }
        }
示例#6
0
        /// <summary>
        /// Sends the events for controller state changes.
        /// </summary>
        /// <param name="editorControllerData">Controller data for which events should be sent.</param>
        private void SendControllerStateEvents(Editor3DoFData editorControllerData)
        {
            // Select button pressed/released events
            if (editorControllerData.SelectButtonStateChanged)
            {
                SourceButtonEventArgs buttonArgs = new SourceButtonEventArgs(this, editorControllerData.ControllerId, InteractionSourcePressType.Select);

                if (editorControllerData.IsSelectButtonDown)
                {
                    inputManager.RaiseSourceDown(buttonArgs.InputSource, buttonArgs.SourceId);
                }
                else
                {
                    inputManager.RaiseSourceUp(buttonArgs.InputSource, buttonArgs.SourceId);

                    // Also send click event when using this controller replacement input
                    if (Time.time - editorControllerData.SelectButtonDownStartTime < MaxClickDuration)
                    {
                        // We currently only support single taps in editor
                        SourceClickEventArgs args = new SourceClickEventArgs(this, editorControllerData.ControllerId, 1);
                        inputManager.RaiseInputClicked(args.InputSource, args.SourceId, args.TapCount);
                    }
                }
            }

            if (editorControllerData.MenuButtonStateChanged)
            {
                SourceButtonEventArgs buttonArgs = new SourceButtonEventArgs(this, editorControllerData.ControllerId, InteractionSourcePressType.Menu);

                if (editorControllerData.IsMenuButtonDown)
                {
                    inputManager.RaiseSourceDown(buttonArgs.InputSource, buttonArgs.SourceId);
                }
                else
                {
                    inputManager.RaiseSourceUp(buttonArgs.InputSource, buttonArgs.SourceId);
                }
            }

            if (editorControllerData.GraspStateChanged)
            {
                SourceButtonEventArgs buttonArgs = new SourceButtonEventArgs(this, editorControllerData.ControllerId, InteractionSourcePressType.Grasp);

                if (editorControllerData.IsGrasped)
                {
                    inputManager.RaiseSourceDown(buttonArgs.InputSource, buttonArgs.SourceId);
                }
                else
                {
                    inputManager.RaiseSourceUp(buttonArgs.InputSource, buttonArgs.SourceId);
                }
            }
        }
示例#7
0
        private void InputSource_SourceClicked(object sender, SourceClickEventArgs e)
        {
            // Create input event
            inputEventData.Initialize(e.InputSource, e.SourceId);

            // Pass handler through HandleEvent to perform modal/fallback logic
            HandleEvent(inputEventData, OnInputClickedEventHandler);

            // UI events
            if (ShouldSendUnityUiEvents)
            {
                PointerEventData unityUIPointerEvent = GazeManager.Instance.UnityUIPointerEvent;
                HandleEvent(unityUIPointerEvent, ExecuteEvents.pointerClickHandler);
            }
        }
示例#8
0
        private void OnTappedEvent(InteractionSourceKind source, int tapCount, Ray headRay)
        {
            if (logging)
            {
                if (GazeManager.Instance.HitObject != null)
                {
                    Debug.Log("Click " + GazeManager.Instance.HitObject.name + " at " + Time.time);
                }
                else
                {
                    Debug.Log("Click Null Object at " + Time.time);
                }
            }
            SourceClickEventArgs args = new SourceClickEventArgs(this, 0, tapCount);

            RaiseSourceClickedEvent(args);
        }
 private void OnTappedEvent(InteractionSourceKind source, int tapCount, Ray headRay)
 {
     SourceClickEventArgs args = new SourceClickEventArgs(this, 0, tapCount);
     RaiseSourceClickedEvent(args);
 }
 protected void RaiseSourceClickedEvent(SourceClickEventArgs e)
 {
     EventHandler<SourceClickEventArgs> handler = SourceClicked;
     if (handler != null)
     {
         handler(this, e);
     }
 }
示例#11
0
        private void OnTappedEvent(InteractionSourceKind source, int tapCount, Ray headRay)
        {
            SourceClickEventArgs args = new SourceClickEventArgs(this, 0, tapCount);

            RaiseSourceClickedEvent(args);
        }
        /// <summary>
        /// Sends the events for hand state changes.
        /// </summary>
        /// <param name="editorHandData">Hand data for which events should be sent.</param>
        private void SendHandStateEvents(EditorHandData editorHandData)
        {
            // Hand moved event
            if (editorHandData.HandDelta.sqrMagnitude > 0)
            {
                HandMoved.RaiseEvent(this, editorHandData.HandId);
            }

            // Finger pressed/released events
            if (editorHandData.FingerStateChanged)
            {
                if (editorHandData.IsFingerDown)
                {
                    RaiseSourceDownEvent(editorHandData.InputSourceArgs);
                }
                else
                {
                    RaiseSourceUpEvent(editorHandData.InputSourceArgs);

                    // Also send click event when using this hands replacement input
                    if (Time.time - editorHandData.FingerDownStartTime < MaxClickDuration)
                    {
                        // We currently only support single taps in editor
                        SourceClickEventArgs args = new SourceClickEventArgs(this, editorHandData.HandId, 1);
                        RaiseSourceClickedEvent(args);
                    }
                }
            }
        }