Exemplo n.º 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);
         }
     }
 }
Exemplo n.º 2
0
 void Start()
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         m_IsLeftHandMode = HvrApi.GetControllerHandle().IsLeftHandMode();
         HVRLogCore.LOGI(TAG, "Start m_IsLeftHandMode: " + m_IsLeftHandMode);
     }
 }
Exemplo n.º 3
0
 private void OnApplicationPause(bool pause)
 {
     if (!pause)
     {
         if (Application.platform == RuntimePlatform.Android)
         {
             m_IsLeftHandMode = HvrApi.GetControllerHandle().IsLeftHandMode();
             HVRLogCore.LOGI(TAG, "OnApplicationPause m_IsLeftHandMode: " + m_IsLeftHandMode);
         }
     }
 }
Exemplo n.º 4
0
    void Start()
    {
        ControllerPositionInit();
        ActivateAvailableController();
        GetControllerHandle();

        if (m_Controller != null)
        {
            m_ControllerType = m_Controller.GetControllerType();
            HVRLogCore.LOGI(TAG, "mControllerType: " + m_ControllerType);
        }
    }
Exemplo n.º 5
0
 void Update()
 {
     if (m_Image == null || m_Text == null)
     {
         HVRLogCore.LOGI(TAG, "Image or Text is null");
         return;
     }
     m_Msg = m_Text.text;
     if (m_IsControllerLeft)
     {
         if (m_LastTriggerMsg != m_Msg)
         {
             m_LastTriggerMsg = m_Msg;
             MsgCtrl(m_Anchor, m_DefaultEdge);
         }
         else if (m_LastBackLongMsg != m_Msg)
         {
             m_LastBackLongMsg = m_Msg;
             MsgCtrl(m_Anchor, m_DefaultEdge);
         }
         else if (m_LastBackShortMsg != m_Msg)
         {
             m_LastBackShortMsg = m_Msg;
             MsgCtrl(m_Anchor, m_DefaultEdge);
         }
         else if (m_LastConfirmMsg != m_Msg)
         {
             m_LastConfirmMsg = m_Msg;
             MsgCtrl(m_Anchor, m_DefaultEdge);
         }
     }
     if (m_IsControllerRight)
     {
         if (m_LastHomeLongMsg != m_Msg)
         {
             m_LastHomeLongMsg = m_Msg;
             MsgCtrl(m_Anchor, m_DefaultEdge);
         }
         else if (m_LastHomeShortMsg != m_Msg)
         {
             m_LastHomeShortMsg = m_Msg;
             MsgCtrl(m_Anchor, m_DefaultEdge);
         }
         else if (m_LastVolumeMsg != m_Msg)
         {
             m_LastVolumeMsg = m_Msg;
             MsgCtrl(m_Anchor, m_DefaultEdge);
         }
     }
 }
Exemplo n.º 6
0
    private void ArrowCtrl()
    {
        if (m_Arrow == null)
        {
            HVRLogCore.LOGI(TAG, "mArrow is null");
            return;
        }
        m_Arrow.color = HVRHelpMessage.m_ArrowColor;

        if (m_Spot != null)
        {
            m_Spot.GetComponent <Image>().color = HVRHelpMessage.m_ArrowColor;
        }

        if (m_ArrowAttach != null)
        {
            m_ArrowAttach.GetComponent <Image>().color = HVRHelpMessage.m_ArrowColor;
        }
    }
Exemplo n.º 7
0
    private void GetControllerHandle()
    {
        IControllerHandle ControllerHandle = HvrApi.GetControllerHandle();

        if (ControllerHandle == null)
        {
            HVRLogCore.LOGW(TAG, "ControllerHandle is null");
            return;
        }
        int[] indices = ControllerHandle.GetValidIndices();
        if (Application.platform == RuntimePlatform.Android)
        {
            if (gameObject.name.Equals("HVRLeftController"))
            {
                HVRLogCore.LOGI(TAG, "current is left controller");
                if (indices.Length >= 3)
                {
                    m_LeftController = ControllerHandle.GetControllerByIndex(indices[2]);
                }
                m_Controller        = m_LeftController;
                m_IsRightController = false;
                if (m_LeftController == null || !m_LeftController.IsAvailable())
                {
                    HVRLogCore.LOGI(TAG, "left controller is not available");
                    gameObject.SetActive(false);
                }
            }
            else
            {
                HVRLogCore.LOGI(TAG, "current is right controller");
                m_RightController   = ControllerHandle.GetControllerByIndex(indices[1]);
                m_Controller        = m_RightController;
                m_IsRightController = true;
            }
        }
        else
        {
            m_Controller      = ControllerHandle.GetControllerByIndex(indices[1]);
            m_RightController = m_Controller;
            m_LeftController  = m_Controller;
        }
    }
Exemplo n.º 8
0
    void Update()
    {
        if (m_Controller == null)
        {
            HVRLogCore.LOGW(TAG, "m_Controller is null");
            return;
        }
        bool isControllerDataValid = false;

        ControllerStatus controllerStatus = m_Controller.GetControllerStatus();

        switch (controllerStatus)
        {
        case ControllerStatus.ControllerStatusDisconnected:
            HVRLogCore.LOGW(TAG, "Controller Disconnected");
            break;

        case ControllerStatus.ControllerStatusScanning:
            HVRLogCore.LOGI(TAG, "Controller Scanning");
            break;

        case ControllerStatus.ControllerStatusConnecting:
            HVRLogCore.LOGI(TAG, "Controller Connecting");
            break;

        case ControllerStatus.ControllerStatusConnected:
            isControllerDataValid = true;
            break;

        case ControllerStatus.ControllerStatusError:
            break;
        }

        if (!isControllerDataValid)
        {
            return;
        }
        UpdateControllerMode();
        UpdateControllerPos();
    }
Exemplo n.º 9
0
 private void ActivateAvailableController()
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         if (HVRPluginCore.IsPhoneController())
         {
             HVRLogCore.LOGI(TAG, "on phonecontroller mode");
             m_IsPhoneControllerMode = true;
             m_DefaultControllerObj.SetActive(false);
             m_PhoneControllerObj.SetActive(true);
             m_ControllerObj = m_PhoneControllerObj;
         }
         else
         {
             m_IsPhoneControllerMode = false;
             HVRLogCore.LOGI(TAG, "on controller mode");
             m_DefaultControllerObj.SetActive(true);
             m_PhoneControllerObj.SetActive(false);
             m_ControllerObj = m_DefaultControllerObj;
         }
     }
 }
Exemplo n.º 10
0
 void Start()
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         if (HVRPluginCore.IsPhoneController())
         {
             HVRLogCore.LOGI(TAG, "show phoneController help msg");
             m_IsPhoneControllerMode = true;
             m_phoneHelpMessage.gameObject.SetActive(true);
             m_controllerHelpMessage.gameObject.SetActive(false);
             m_helpMessage = m_phoneHelpMessage;
             InitPhoneControllerMsg();
         }
         else
         {
             HVRLogCore.LOGI(TAG, "show controller help msg");
             m_IsPhoneControllerMode = false;
             m_controllerHelpMessage.gameObject.SetActive(true);
             m_phoneHelpMessage.gameObject.SetActive(false);
             m_helpMessage = m_controllerHelpMessage;
             InitDefaultControllerMsg();
         }
     }
     else
     {
         InitDefaultControllerMsg();
     }
     if (transform.parent.name == "HVRLeftController")
     {
         m_IsRightController = false;
     }
     else
     {
         m_IsRightController = true;
     }
 }
Exemplo n.º 11
0
    private void InitPhoneControllerMsg()
    {
        FindObj();

        m_PhoneVolumeMsg = HVRPluginCore.GetDialogueContent("Hvr_phone_volume_short");
        if (m_PhoneVolumeMsg == null)
        {
            HVRLogCore.LOGI(TAG, "mPhoneVolumeMsg is null");
            m_phoneHelpMessage.gameObject.SetActive(false);
            return;
        }
        m_PhoneBasckShortMsg = HVRPluginCore.GetDialogueContent("Hvr_phone_back_short");
        m_PhoneBackLongMsg   = HVRPluginCore.GetDialogueContent("Hvr_phone_back_long");
        m_PhoneHomeShortMsg  = HVRPluginCore.GetDialogueContent("Hvr_phone_home_short");
        m_PhoneHomeLongMsg   = HVRPluginCore.GetDialogueContent("Hvr_phone_home_long");
        m_PhoneConfirmMsg    = HVRPluginCore.GetDialogueContent("Hvr_phone_confirm");

        m_VolumeMsg     = m_PhoneVolumeMsg;
        m_BasckShortMsg = m_PhoneBasckShortMsg;
        m_BackLongMsg   = m_PhoneBackLongMsg;
        m_HomeShortMsg  = m_PhoneHomeShortMsg;
        m_HomeLongMsg   = m_PhoneHomeLongMsg;
        m_ConfirmMsg    = m_PhoneConfirmMsg;
    }
Exemplo n.º 12
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);
        }
    }