コード例 #1
0
 private void UpdateControllerMode()
 {
     if (m_IsPhoneControllerMode && Application.platform == RuntimePlatform.Android)
     {
         if (!m_IsScreenOn && HVRPluginCore.IsScreenOn())
         {
             HVRLogCore.LOGI(TAG, "switch to screen on");
             m_IsScreenOn = true;
             SetControllerStatus(true);
         }
         else if (m_IsScreenOn && !HVRPluginCore.IsScreenOn())
         {
             HVRLogCore.LOGI(TAG, "switch to screen off");
             m_IsScreenOn = false;
             SetControllerStatus(false);
         }
         if (HVRPluginCore.IsSwitchToController())
         {
             m_IsScreenOn            = false;
             m_IsPhoneControllerMode = false;
             HVRLogCore.LOGI(TAG, "switch to controller mode");
             m_PhoneControllerObj.SetActive(false);
             m_ControllerObj = m_DefaultControllerObj;
             SetControllerStatus(true);
         }
     }
 }
コード例 #2
0
    void Update()
    {
        if (HVRControllerManager.m_IsLeftHandMode)
        {
            m_angleFront_z_min = -70;
            m_angleFront_z_max = 30;
        }
        else
        {
            m_angleFront_z_min = -30;
            m_angleFront_z_max = 70;
        }
        if (m_IsPhoneControllerMode)
        {
            if (Application.platform == RuntimePlatform.Android)
            {
                if (HVRPluginCore.IsSwitchToController())
                {
                    HVRLogCore.LOGI(TAG, "switch to show controller help msg");
                    m_IsPhoneControllerMode = false;
                    m_controllerHelpMessage.gameObject.SetActive(true);
                    m_phoneHelpMessage.gameObject.SetActive(false);
                    m_helpMessage = m_controllerHelpMessage;
                    InitDefaultControllerMsg();
                }
            }
        }
        else
        {
            m_confirm.gameObject.SetActive(isConfirmTrue);
            m_volume.gameObject.SetActive(isVolumeTrue);
        }
        DefaultOrCustomize();

        float   currentAlpha = m_CanvasGroup.alpha;
        Vector3 eulerAngles  = Vector3.zero;

        if (!m_IsRightController)
        {
            eulerAngles = HVRController.m_LeftContrllerRotation.eulerAngles;
        }
        else
        {
            eulerAngles = HVRController.m_RightContrllerRotation.eulerAngles;
        }
        if (eulerAngles.x < m_angleFront_x_max &&
            eulerAngles.x > m_angleFront_x_min &&
            CheckAngle(eulerAngles.z) < m_angleFront_z_max &&
            CheckAngle(eulerAngles.z) > m_angleFront_z_min)
        {
            ShowAlphaInc(currentAlpha);
        }
        else
        {
            ShowAlphaDec(currentAlpha);
        }

        if (m_CanvasGroup.alpha == 1)
        {
            string name = "CtrlHelp";
            int    len  = name.Length;
            HVRPluginCore.HVR_BDReport(name, len);
        }
    }