void Awake()
    {
        VRInputMessageEngine.GetInstance().AppButtonPressCallback         += AppButtonPress;
        VRInputMessageEngine.GetInstance().HomeButtonUpCallback           += HomeButtonUp;
        VRInputMessageEngine.GetInstance().HoumeButtonLongPressCallback   += HoumeButtonLongPress;
        VRInputMessageEngine.GetInstance().RecenteredCallback             += Recentered;
        VRInputMessageEngine.GetInstance().TouchPadPosCenteredCallback    += TouchPadPosCentered;
        VRInputMessageEngine.GetInstance().TouchPadVector2Callback        += TouchPadVector2;
        VRInputMessageEngine.GetInstance().TouchPadStretchVector2Callback += TouchPadStretchVector2;
        VRInputMessageEngine.GetInstance().TouchPadTouchCallback          += TouchPadTouch;
        VRInputMessageEngine.GetInstance().TouchPadPressCallback          += TouchPadPress;
        VRInputMessageEngine.GetInstance().TouchPadPressDirCallback       += TouchPadPressDir;
        VRInputMessageEngine.GetInstance().PointerEnterCallback           += PointerEnter;
        VRInputMessageEngine.GetInstance().PointerExitCallback            += PointerExit;

        VRInputMessageEngine.GetInstance().TouchPadSlipUnifiedDirCallback         += TouchPadSlipUnifiedDirSlip;
        VRInputMessageEngine.GetInstance().TouchPadEveryoneSlipUnifiedDirCallback += TouchPadEveryoneSlipUnifiedDirSlip;
        VRInputMessageEngine.GetInstance().TouchPadSlipUnifiedDirEndCallback      += TouchPadSlipUnifiedDirEnd;

#if UD_XIMMERSE
        VRInputMessageEngine.GetInstance().TriggerPressCallback     += TriggerPress;
        VRInputMessageEngine.GetInstance().TriggerPressDirCallback  += TriggerPressDir;
        VRInputMessageEngine.GetInstance().TouchPadAnyClickCallback += TouchPadAnyClick;
#endif

#if UD_I3VR
        VRInputMessageEngine.GetInstance().TouchPadDirCallback += TouchPadDir;
#endif
    }
예제 #2
0
    //图标晃动
    void IconRock()
    {
        Vector3 pos = Vector3.zero;

#if UNITY_STANDALONE || UNITY_EDITOR
        Vector3 screenPos = Camera.main.WorldToScreenPoint(transform.position);
        screenPos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPos.z);
        pos       = Camera.main.ScreenToWorldPoint(screenPos);
#elif UNITY_ANDROID
#if UD_I3VR
        pos = I3vrPointerManager.Pointer.CurrentRaycastResult.worldPosition;
#elif UD_GVR
        //pos = VRInputMessageEngine.GetInstance().GvrPtInputModule.pointerData.pointerCurrentRaycast.worldPosition;
        pos = GvrPointerInputModule.CurrentRaycastResult.worldPosition;//by kevin.xie
#elif UD_XIMMERSE
        pos = VRInputMessageEngine.GetInstance().XimVRInputModule.subInputModules[0].pointerData.pointerCurrentRaycast.worldPosition;
#endif
#endif
        Vector3 localPos = this.transform.InverseTransformPoint(pos);
        Vector3 v        = localPos.normalized;

        float x = v.y * -IconRockLimitAngle;
        float y = v.x * IconRockLimitAngle;
        x = Mathf.Clamp(x, -IconRockLimitAngle, IconRockLimitAngle);
        y = Mathf.Clamp(y, -IconRockLimitAngle, IconRockLimitAngle);
        this.transform.localEulerAngles = new Vector3(x, y, 0);//目前采用鼠标实现
    }