void OnGizmoEnabledChanged(bool data)
        {
            m_GizmoCube.SetActive(data);

            /*
             * TODO: Temporary fix till next MARS Update. This code will make sure that the cube stay hidden in AR mode.
             */
            GizmoController gizmoController = GetComponent <GizmoController>();

            if (!data)
            {
                gizmoController.HideGizmo();
            }
            else
            {
                gizmoController.ShowGizmo();
            }
        }
Esempio n. 2
0
        void OnStateDataChanged(UIStateData stateData)
        {
            if (m_ToolbarsEnabled != stateData.toolbarsEnabled)
            {
                if (stateData.toolbarsEnabled)
                {
                    if (stateData.navigationState.navigationMode == NavigationMode.Orbit)
                    {
                        m_Camera.enabled = true;
                        m_InputActionAsset.Enable();
                    }
                    else
                    {
                        m_Camera.enabled = false;
                        m_InputActionAsset.Disable();
                    }
                }
                else
                {
                    m_Camera.enabled = false;
                    m_InputActionAsset.Disable();
                }

                m_ResetButton.button.interactable = stateData.toolbarsEnabled;

                m_ToolbarsEnabled = stateData.toolbarsEnabled;
            }

            if (m_CachedNavigationState != stateData.navigationState)
            {
                m_Camera.enabled      = stateData.navigationState.freeFlyCameraEnabled;
                m_FocusButton.enabled = stateData.navigationState.freeFlyCameraEnabled;

                if (stateData.navigationState.orbitEnabled)
                {
                    m_InputActionAsset["Orbit Action"].Enable();
                }
                else
                {
                    m_InputActionAsset["Orbit Action"].Disable();
                }

                if (stateData.navigationState.panEnabled)
                {
                    m_InputActionAsset["Pan Mode Action"].Enable();
                    m_InputActionAsset["Pan Gesture Action"].Enable();
                    m_InputActionAsset["Pan Gesture Action"].Enable();
                    m_InputActionAsset["Pan Action"].Enable();
                    m_InputActionAsset["Quick Pan Action"].Enable();
                }
                else
                {
                    m_InputActionAsset["Pan Mode Action"].Disable();
                    m_InputActionAsset["Pan Gesture Action"].Disable();
                    m_InputActionAsset["Pan Gesture Action"].Disable();
                    m_InputActionAsset["Pan Action"].Disable();
                    m_InputActionAsset["Quick Pan Action"].Disable();
                }

                if (stateData.navigationState.zoomEnabled)
                {
                    m_InputActionAsset["Zoom Mode Action"].Enable();
                    m_InputActionAsset["Zoom Gesture Action"].Enable();
                    m_InputActionAsset["Zoom Gesture Action"].Enable();
                    m_InputActionAsset["Zoom Action"].Enable();
                    m_InputActionAsset["Quick Zoom Action"].Enable();
                }
                else
                {
                    m_InputActionAsset["Zoom Mode Action"].Disable();
                    m_InputActionAsset["Zoom Gesture Action"].Disable();
                    m_InputActionAsset["Zoom Gesture Action"].Disable();
                    m_InputActionAsset["Zoom Action"].Disable();
                    m_InputActionAsset["Quick Zoom Action"].Disable();
                }

                if (stateData.navigationState.moveEnabled)
                {
                    m_InputActionAsset["Moving Action"].Enable();
                }
                else
                {
                    m_InputActionAsset["Moving Action"].Disable();
                }

                if (stateData.navigationState.worldOrbitEnabled)
                {
                    m_InputActionAsset["Quick WorldOrbit Action"].Enable();
                }
                else
                {
                    m_InputActionAsset["Quick WorldOrbit Action"].Disable();
                }

                if (stateData.navigationState.teleportEnabled)
                {
                    m_InputActionAsset["Teleport Action"].Enable();
                }
                else
                {
                    m_InputActionAsset["Teleport Action"].Disable();
                }

                if (m_CachedNavigationMode != stateData.navigationState.navigationMode)
                {
                    if (stateData.navigationState.navigationMode == NavigationMode.Orbit)
                    {
                        StartCoroutine(ResetHomeView());
                    }
                    m_CachedNavigationMode = stateData.navigationState.navigationMode;
                }

                m_GizmoCube.SetActive(stateData.navigationState.gizmoEnabled);

                /*
                 * TODO: Temporary fix till next MARS Update. This code will make sure that the cube stay hidden in AR mode.
                 */
                GizmoController gizmoController = GetComponent <GizmoController>();
                if (!stateData.navigationState.gizmoEnabled)
                {
                    gizmoController.HideGizmo();
                }
                else
                {
                    gizmoController.ShowGizmo();
                }

                m_CachedNavigationState = stateData.navigationState;
            }

            if (m_CachedToolType == null || m_CachedToolType != stateData.toolState.activeTool)
            {
                m_CachedToolType = stateData.toolState.activeTool;
            }

            if (m_CachedCameraOptionData != stateData.cameraOptionData)
            {
                switch (stateData.cameraOptionData.cameraViewType)
                {
                case CameraViewType.Top:
                    OnTopView();
                    break;

                case CameraViewType.Left:
                    OnLeftView();
                    break;

                case CameraViewType.Right:
                    OnRightView();
                    break;
                }

                m_CachedCameraOptionData = stateData.cameraOptionData;
            }

            if (m_CachedInfoType != stateData.toolState.infoType)
            {
                m_CachedInfoType = stateData.toolState.infoType;
            }
        }