コード例 #1
0
        void OnGUI()
        {
            if (!CheckOperatingSystem())
            {
                EditorGUILayout.HelpBox("You must be running Windows build 14318 or later to use Holographic Simulation or Remoting.", MessageType.Warning);
                return;
            }

            if (!IsWindowsMixedRealityCurrentTarget())
            {
                EditorGUILayout.HelpBox("You must enable Virtual Reality support in settings and add Windows Mixed Reality to the devices to use Holographic Emulation.", MessageType.Warning);
                return;
            }

            EditorGUILayout.Space();

            EditorGUI.BeginDisabledGroup(m_InPlayMode);
            DrawRemotingMode();
            EditorGUI.EndDisabledGroup();

            switch (m_Mode)
            {
            case EmulationMode.RemoteDevice:
                EditorGUI.BeginDisabledGroup(IsConnectedToRemoteDevice());
                RemotingPreferencesOnGUI();
                EditorGUI.EndDisabledGroup();
                ConnectionStateGUI();
                break;

            case EmulationMode.Simulated:
                EditorGUI.BeginChangeCheck();
                m_RoomIndex = EditorGUILayout.Popup(s_RoomText, m_RoomIndex, s_RoomStrings);
                if (EditorGUI.EndChangeCheck() && m_InPlayMode)
                {
                    LoadCurrentRoom();
                }


                EditorGUI.BeginChangeCheck();
                m_InputType = (PlaymodeInputType)EditorGUILayout.Popup(s_InputText, (int)m_InputType, s_InputStrings);
                if (EditorGUI.EndChangeCheck())
                {
                    HolographicAutomation.SetPlaymodeInputType(m_InputType);
                }
                break;

            case EmulationMode.None:
                break;
            }
        }
コード例 #2
0
        void Update()
        {
            if (!IsWindowsMixedRealityCurrentTarget())
            {
                return;
            }

            switch (m_Mode)
            {
            case EmulationMode.None:
                break;

            case EmulationMode.Simulated:
                HolographicAutomation.SetPlaymodeInputType(m_InputType);
                break;

            case EmulationMode.RemoteDevice:
                HolographicStreamerConnectionState connectionState = PerceptionRemoting.GetConnectionState();
                if (connectionState != m_LastConnectionState)
                {
                    Repaint();
                }
                var lastConnectionFailureReason = PerceptionRemoting.CheckForDisconnect();
                if (lastConnectionFailureReason == HolographicStreamerConnectionFailureReason.Unreachable ||
                    lastConnectionFailureReason == HolographicStreamerConnectionFailureReason.ConnectionLost)
                {
                    Debug.LogWarning("Disconnected with failure reason " + lastConnectionFailureReason + ", attempting to reconnect.");
                    Connect();
                }
                else if (lastConnectionFailureReason != HolographicStreamerConnectionFailureReason.None)
                {
                    Debug.LogError("Disconnected with error " + lastConnectionFailureReason);
                }
                m_LastConnectionState = connectionState;
                break;
            }
        }