Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        IVRHandlerInputModule inputModule = EventSystem.current.currentInputModule
                                            as IVRHandlerInputModule;
        IVRInputModule test = EventSystem.current.currentInputModule as IVRInputModule;

        //Debug.Log(test);
        if (inputModule != null)
        {
            TouchPad.color = IVR.IVRInputHandler.GetKey(IVR.ControllerButton.CONTROLLER_BUTTON_TP_CLICK) ?
                             ClickColor : Color.white;
            HomeButton.color = IVR.IVRInputHandler.GetKey(IVR.ControllerButton.CONTROLLER_BUTTON_HOME) ?
                               ClickColor : Color.white;
            AppButton.color = IVR.IVRInputHandler.GetKey(IVR.ControllerButton.CONTROLLER_BUTTON_APP) ?
                              ClickColor : Color.white;
            MinusButton.color = IVR.IVRInputHandler.GetKey(IVR.ControllerButton.CONTROLLER_BUTTON_VOL_DOWN) ?
                                ClickColor : Color.white;
            AddButton.color = IVR.IVRInputHandler.GetKey(IVR.ControllerButton.CONTROLLER_BUTTON_VOL_UP) ?
                              ClickColor : Color.white;
            TriggerButton.color = IVR.IVRInputHandler.GetKey(IVR.ControllerButton.CONTROLLER_BUTTON_TRIGGER) ? ClickColor : Color.white;
            if (IVR.IVRInputHandler.GetKey(IVR.ControllerButton.CONTROLLER_BUTTON_HOME))
            {
                IVR.IVRInputHandler.SendVibrateCmd(1);
            }
            if (IVR.IVRInputHandler.GetKey(IVR.ControllerButton.CONTROLLER_BUTTON_APP))
            {
                IVR.IVRInputHandler.SendVibrateCmd(2);
            }
            if (IVR.IVRInputHandler.GetKey(IVR.ControllerButton.CONTROLLER_BUTTON_TP_CLICK))
            {
                IVR.IVRInputHandler.SendVibrateCmd(3);
            }
        }
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
#if !UNITY_EDITOR
        Vector3 pos = Vector3.zero;
        IVRHandlerInputModule inputModule = EventSystem.current.currentInputModule
                                            as IVRHandlerInputModule;
        if (inputModule != null)
        {
            pos   = IVR.IVRInputHandler.GetPosition();
            pos.y = -pos.y;
        }
#else
        Vector3 pos = Input.mousePosition;
#endif //!UNITY_EDITOR
        if (pos == Vector3.zero)
        {
            m_Pointer.enabled = false;
        }
        else
        {
            m_Pointer.enabled = true;
            m_Pointer.transform.localPosition = pos + new Vector3(-147, 147, 0);
            //m_Pointer.rectTransform.anchoredPosition3D = pos + new Vector3(-26, 26, 0);
        }
    }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        IVRHandlerInputModule inputModule = EventSystem.current.currentInputModule
                                            as IVRHandlerInputModule;

        if (inputModule != null)
        {
            mText.text = IVR.IVRInputHandler.GetPosition().ToString() + swipString;
        }
    }
Exemplo n.º 4
0
    void IPointerDownHandler.OnPointerDown(PointerEventData eventData)
    {
        IVRHandlerInputModule input       = EventSystem.current.currentInputModule as IVRHandlerInputModule;
        IVRHandlerEventData   pointerData = eventData as IVRHandlerEventData;

        if (null != input && null != pointerData)
        {
            IVRManager.Instance.Show("Hold the button to move cube");
            transform.parent = input.handlerPointer.transform;
        }
    }
Exemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
#if !UNITY_EDITOR
        IVRHandlerInputModule inputModule = EventSystem.current.currentInputModule
                                            as IVRHandlerInputModule;
        Vector3 touchPosition = Vector3.zero;
        if (inputModule != null)
        {
            touchPosition   = IVR.IVRInputHandler.GetPosition();
            touchPosition.y = -touchPosition.y;
        }
        if (touchPosition == Vector3.zero)
        {
            if (bTouch)
            {
                bTouch = false;
            }
            //Draw();
        }
        else
        {
            touchPosition = touchPosition + new Vector3(-147, 147, 0);
            if (!bTouch)
            {
                bTouch = true; Reset();
            }
            int iTouchPostCount = mTouchPosList.Count;
            if (iTouchPostCount == 0 || mTouchPosList[iTouchPostCount - 1] != touchPosition)
            {
                if (iTouchPostCount > 0)
                {
                    AddLine(ml, MakeQuad(mTouchPosList[iTouchPostCount - 1],
                                         touchPosition, lineWidth), false);
                }
                mTouchPosList.Add(touchPosition);
                AddPointer(touchPosition);
            }
        }
        Graphics.DrawMesh(ml, transform.localToWorldMatrix, lmat, 0);
#endif //!UNITY_EDITOR
    }