示例#1
0
    private void SetSystemKey()
    {
        if (controllerlink.switchHomeKey)
        {
            if (Pvr_UnitySDKManager.SDK.HeadDofNum == HeadDofNum.ThreeDof || Pvr_UnitySDKManager.SDK.SixDofRecenter)
            {
                if (Controller.UPvr_GetKeyLongPressed(0, Pvr_KeyCode.HOME))
                {
                    if (Pvr_UnitySDKManager.SDK.IsViewerLogicFlow)
                    {
                        Pvr_UnitySDKManager.pvr_UnitySDKSensor.ResetUnitySDKSensorAll();
                    }
                    else
                    {
                        if (Pvr_UnitySDKManager.SDK.safeToast.activeSelf)
                        {
                            Pvr_UnitySDKManager.SDK.safeToast.SetActive(false);
                            Pvr_UnitySDKManager.pvr_UnitySDKSensor.OptionalResetUnitySDKSensor(1, 1);
                        }
                        else
                        {
                            Pvr_UnitySDKManager.pvr_UnitySDKSensor.OptionalResetUnitySDKSensor(1, 0);
                        }
                        if (Pvr_UnitySDKManager.SDK.HeadDofNum == HeadDofNum.SixDof && Pvr_UnitySDKManager.SDK.SixDofRecenter)
                        {
                            controllerlink.ResetHeadSensorForController();
                        }
                    }
                    ResetController(0);
                }
                if (Controller.UPvr_GetKeyLongPressed(1, Pvr_KeyCode.HOME))
                {
                    if (Pvr_UnitySDKManager.SDK.IsViewerLogicFlow)
                    {
                        Pvr_UnitySDKManager.pvr_UnitySDKSensor.ResetUnitySDKSensorAll();
                    }
                    else
                    {
                        if (Pvr_UnitySDKManager.SDK.safeToast.activeSelf)
                        {
                            Pvr_UnitySDKManager.SDK.safeToast.SetActive(false);
                            Pvr_UnitySDKManager.pvr_UnitySDKSensor.OptionalResetUnitySDKSensor(1, 1);
                        }
                        else
                        {
                            Pvr_UnitySDKManager.pvr_UnitySDKSensor.OptionalResetUnitySDKSensor(1, 0);
                        }
                        if (Pvr_UnitySDKManager.SDK.HeadDofNum == HeadDofNum.SixDof && Pvr_UnitySDKManager.SDK.SixDofRecenter)
                        {
                            controllerlink.ResetHeadSensorForController();
                        }
                    }
                    ResetController(1);
                }
            }
            else
            {
                if (Controller.UPvr_GetKeyLongPressed(0, Pvr_KeyCode.HOME))
                {
                    ResetController(0);
                }
                if (Controller.UPvr_GetKeyLongPressed(1, Pvr_KeyCode.HOME))
                {
                    ResetController(1);
                }
            }
        }


        if (controllerlink.picoDevice)
        {
            if (controllerlink.switchHomeKey)
            {
                if (!controllerlink.Controller0.HomeKey.LongPressedClock && Controller.UPvr_GetKeyUp(0, Pvr_KeyCode.HOME) || !controllerlink.Controller1.HomeKey.LongPressedClock && Controller.UPvr_GetKeyUp(1, Pvr_KeyCode.HOME) && !stopConnect)
                {
                    controllerlink.RebackToLauncher();
                }
            }
            if (!controllerlink.Controller0.VolumeUpKey.LongPressedClock && Controller.UPvr_GetKeyUp(0, Pvr_KeyCode.VOLUMEUP) || !controllerlink.Controller1.VolumeUpKey.LongPressedClock && Controller.UPvr_GetKeyUp(1, Pvr_KeyCode.VOLUMEUP))
            {
                controllerlink.TurnUpVolume();
            }
            if (!controllerlink.Controller0.VolumeDownKey.LongPressedClock && Controller.UPvr_GetKeyUp(0, Pvr_KeyCode.VOLUMEDOWN) || !controllerlink.Controller1.VolumeDownKey.LongPressedClock && Controller.UPvr_GetKeyUp(1, Pvr_KeyCode.VOLUMEDOWN))
            {
                controllerlink.TurnDownVolume();
            }
            if (!Controller.UPvr_GetKey(0, Pvr_KeyCode.VOLUMEUP) && !Controller.UPvr_GetKey(0, Pvr_KeyCode.VOLUMEDOWN) && !Controller.UPvr_GetKey(1, Pvr_KeyCode.VOLUMEUP) && !Controller.UPvr_GetKey(1, Pvr_KeyCode.VOLUMEDOWN))
            {
                cTime = 1.0f;
            }
            if (Controller.UPvr_GetKey(0, Pvr_KeyCode.VOLUMEUP) || Controller.UPvr_GetKey(1, Pvr_KeyCode.VOLUMEUP))
            {
                cTime -= Time.deltaTime;
                if (cTime <= 0)
                {
                    cTime = 0.2f;
                    controllerlink.TurnUpVolume();
                }
            }
            if (!Controller.UPvr_GetKey(0, Pvr_KeyCode.HOME) && !Controller.UPvr_GetKey(1, Pvr_KeyCode.HOME) && (Controller.UPvr_GetKey(0, Pvr_KeyCode.VOLUMEDOWN) || Controller.UPvr_GetKey(1, Pvr_KeyCode.VOLUMEDOWN)))
            {
                cTime -= Time.deltaTime;
                if (cTime <= 0)
                {
                    cTime = 0.2f;
                    controllerlink.TurnDownVolume();
                }
            }
        }
        if (controllerlink.goblinserviceStarted)
        {
            if (Controller.UPvr_GetKey(0, Pvr_KeyCode.HOME) && Controller.UPvr_GetKey(0, Pvr_KeyCode.VOLUMEDOWN) && !stopConnect)
            {
                disConnectTime += Time.deltaTime;
                if (disConnectTime > 1.0)
                {
                    DisConnectBLE();
                    controllerlink.hummingBirdMac = "";
                    stopConnect    = true;
                    disConnectTime = 0;
                }
            }
        }
    }
 private void SetSystemKey()
 {
     if (controllerlink.switchHomeKey)
     {
         if (Controller.UPvr_GetKeyLongPressed(0, Pvr_KeyCode.HOME) || Controller.UPvr_GetKeyLongPressed(1, Pvr_KeyCode.HOME))
         {
             if (Pvr_UnitySDKManager.SDK.HmdOnlyrot)
             {
                 Pvr_UnitySDKManager.pvr_UnitySDKSensor.OptionalResetUnitySDKSensor(1, 0);
             }
             else
             {
                 if (Pvr_UnitySDKManager.SDK.safeToast != null)
                 {
                     if (controllerlink.trackingmode == 4)
                     {
                         Pvr_UnitySDKManager.pvr_UnitySDKSensor.OptionalResetUnitySDKSensor(1, 1);
                     }
                     else
                     {
                         if (Pvr_UnitySDKManager.SDK.safeToast.activeSelf)
                         {
                             Pvr_UnitySDKManager.SDK.safeToast.SetActive(false);
                             Pvr_UnitySDKManager.pvr_UnitySDKSensor.OptionalResetUnitySDKSensor(1, 1);
                         }
                         else
                         {
                             Pvr_UnitySDKManager.pvr_UnitySDKSensor.OptionalResetUnitySDKSensor(1, 0);
                         }
                         controllerlink.ResetHeadSensorForController();
                     }
                 }
                 else
                 {
                     if (controllerlink.trackingmode == 0 || controllerlink.trackingmode == 1)
                     {
                         Pvr_UnitySDKManager.pvr_UnitySDKSensor.ResetUnitySDKSensor();
                     }
                 }
             }
             if (Pvr_UnitySDKManager.SDK.ControllerOnlyrot || controllerlink.controller0Connected && Controller.UPvr_GetControllerPOS(0).Equals(Vector3.zero) || controllerlink.controller1Connected && Controller.UPvr_GetControllerPOS(1).Equals(Vector3.zero))
             {
                 if (Controller.UPvr_GetKeyLongPressed(0, Pvr_KeyCode.HOME))
                 {
                     ResetController(0);
                 }
                 if (Controller.UPvr_GetKeyLongPressed(1, Pvr_KeyCode.HOME))
                 {
                     ResetController(1);
                 }
             }
         }
     }
     if (controllerlink.picoDevice)
     {
         if (controllerlink.switchHomeKey)
         {
             if (Controller.UPvr_GetKeyClick(0, Pvr_KeyCode.HOME) || Controller.UPvr_GetKeyClick(1, Pvr_KeyCode.HOME) && !stopConnect)
             {
                 controllerlink.RebackToLauncher();
             }
         }
         if (Controller.UPvr_GetKeyClick(0, Pvr_KeyCode.VOLUMEUP) || Controller.UPvr_GetKeyClick(1, Pvr_KeyCode.VOLUMEUP))
         {
             controllerlink.TurnUpVolume();
         }
         if (Controller.UPvr_GetKeyClick(0, Pvr_KeyCode.VOLUMEDOWN) || Controller.UPvr_GetKeyClick(1, Pvr_KeyCode.VOLUMEDOWN))
         {
             controllerlink.TurnDownVolume();
         }
         if (!Controller.UPvr_GetKey(0, Pvr_KeyCode.VOLUMEUP) && !Controller.UPvr_GetKey(0, Pvr_KeyCode.VOLUMEDOWN) && !Controller.UPvr_GetKey(1, Pvr_KeyCode.VOLUMEUP) && !Controller.UPvr_GetKey(1, Pvr_KeyCode.VOLUMEDOWN))
         {
             cTime = 1.0f;
         }
         if (Controller.UPvr_GetKey(0, Pvr_KeyCode.VOLUMEUP) || Controller.UPvr_GetKey(1, Pvr_KeyCode.VOLUMEUP))
         {
             cTime -= Time.deltaTime;
             if (cTime <= 0)
             {
                 cTime = 0.2f;
                 controllerlink.TurnUpVolume();
             }
         }
         if (!Controller.UPvr_GetKey(0, Pvr_KeyCode.HOME) && !Controller.UPvr_GetKey(1, Pvr_KeyCode.HOME) && (Controller.UPvr_GetKey(0, Pvr_KeyCode.VOLUMEDOWN) || Controller.UPvr_GetKey(1, Pvr_KeyCode.VOLUMEDOWN)))
         {
             cTime -= Time.deltaTime;
             if (cTime <= 0)
             {
                 cTime = 0.2f;
                 controllerlink.TurnDownVolume();
             }
         }
     }
     if (controllerlink.goblinserviceStarted)
     {
         if (Controller.UPvr_GetKey(0, Pvr_KeyCode.HOME) && Controller.UPvr_GetKey(0, Pvr_KeyCode.VOLUMEDOWN) && !stopConnect)
         {
             disConnectTime += Time.deltaTime;
             if (disConnectTime > 1.0)
             {
                 DisConnectBLE();
                 controllerlink.hummingBirdMac = "";
                 stopConnect    = true;
                 disConnectTime = 0;
             }
         }
     }
 }
示例#3
0
 private void SetSystemKey()
 {
     if (Pvr_UnitySDKManager.SDK.HeadDofNum == HeadDofNum.ThreeDof || Pvr_UnitySDKManager.SDK.SixDofRecenter)
     {
         if (Controller.UPvr_GetKeyLongPressed(0, Pvr_KeyCode.HOME))
         {
             Pvr_UnitySDKManager.pvr_UnitySDKSensor.OptionalResetUnitySDKSensor(1, 0);
             if (Pvr_UnitySDKManager.SDK.HeadDofNum == HeadDofNum.SixDof && Pvr_UnitySDKManager.SDK.SixDofRecenter)
             {
                 controllerlink.ResetHeadSensorForController();
             }
             ResetController(0);
         }
         if (Controller.UPvr_GetKeyLongPressed(1, Pvr_KeyCode.HOME))
         {
             Pvr_UnitySDKManager.pvr_UnitySDKSensor.OptionalResetUnitySDKSensor(1, 0);
             if (Pvr_UnitySDKManager.SDK.HeadDofNum == HeadDofNum.SixDof && Pvr_UnitySDKManager.SDK.SixDofRecenter)
             {
                 controllerlink.ResetHeadSensorForController();
             }
             ResetController(1);
         }
     }
     else
     {
         if (Controller.UPvr_GetKeyLongPressed(0, Pvr_KeyCode.HOME))
         {
             ResetController(0);
         }
         if (Controller.UPvr_GetKeyLongPressed(1, Pvr_KeyCode.HOME))
         {
             ResetController(1);
         }
     }
     //pico device支持的系统按键
     if (controllerlink.picoDevice)
     {
         if (!longPressclock && (Controller.UPvr_GetKeyUp(0, Pvr_KeyCode.HOME) || Controller.UPvr_GetKeyUp(1, Pvr_KeyCode.HOME)) && !stopConnect)
         {
             controllerlink.RebackToLauncher();
         }
         if (!longPressclock && (Controller.UPvr_GetKeyUp(0, Pvr_KeyCode.VOLUMEUP) || Controller.UPvr_GetKeyUp(1, Pvr_KeyCode.VOLUMEUP)))
         {
             controllerlink.TurnUpVolume();
         }
         if (!longPressclock && (Controller.UPvr_GetKeyUp(0, Pvr_KeyCode.VOLUMEDOWN) || Controller.UPvr_GetKeyUp(1, Pvr_KeyCode.VOLUMEDOWN)))
         {
             controllerlink.TurnDownVolume();
         }
         if (!Controller.UPvr_GetKey(0, Pvr_KeyCode.VOLUMEUP) && !Controller.UPvr_GetKey(0, Pvr_KeyCode.VOLUMEDOWN) && !Controller.UPvr_GetKey(1, Pvr_KeyCode.VOLUMEUP) && !Controller.UPvr_GetKey(1, Pvr_KeyCode.VOLUMEDOWN))
         {
             cTime = 1.0f;
         }
         if (Controller.UPvr_GetKey(0, Pvr_KeyCode.VOLUMEUP) || Controller.UPvr_GetKey(1, Pvr_KeyCode.VOLUMEUP))
         {
             cTime -= Time.deltaTime;
             if (cTime <= 0)
             {
                 cTime = 0.2f;
                 controllerlink.TurnUpVolume();
             }
         }
         if (Controller.UPvr_GetKey(0, Pvr_KeyCode.VOLUMEDOWN) || Controller.UPvr_GetKey(1, Pvr_KeyCode.VOLUMEDOWN))
         {
             cTime -= Time.deltaTime;
             if (cTime <= 0)
             {
                 cTime = 0.2f;
                 controllerlink.TurnDownVolume();
             }
         }
     }
     if (controllerlink.trackingmode == 1 || controllerlink.trackingmode == 0)
     {
         //phone和pico device都支持解绑
         if (Controller.UPvr_GetKey(0, Pvr_KeyCode.HOME) && Controller.UPvr_GetKey(0, Pvr_KeyCode.VOLUMEDOWN) && !stopConnect)
         {
             disConnectTime += Time.deltaTime;
             if (disConnectTime > 1.0)
             {
                 DisConnectBLE();
                 controllerlink.hummingBirdMac = "";
                 stopConnect    = true;
                 disConnectTime = 0;
             }
         }
     }
 }