Exemplo n.º 1
0
        private void InitializeSimulation()
        {
            Disconnect();

            HolographicAutomation.Initialize();

            LoadCurrentRoom();
        }
 private void Connect()
 {
     HolographicAutomation.SetEmulationMode(m_Mode);
     PerceptionRemoting.SetRemoteDeviceVersion(m_DeviceVersion);
     PerceptionRemoting.SetVideoEncodingParameters(m_MaxBitrateKbps);
     PerceptionRemoting.SetEnableVideo(m_EnableVideo);
     PerceptionRemoting.SetEnableAudio(m_EnableAudio);
     PerceptionRemoting.Connect(m_RemoteMachineAddress);
 }
Exemplo n.º 3
0
        private void LoadCurrentRoom()
        {
            if (m_RoomIndex == 0)
            {
                return;
            }

            string roomPath = System.IO.Path.GetFullPath("Packages/com.unity.xr.windowsmr.metro") + "/Plugins/HolographicSimulation/Rooms/";

            HolographicAutomation.LoadRoom(roomPath + s_RoomStrings[m_RoomIndex].text + ".xef");
        }
        private void LoadCurrentRoom()
        {
            if (m_RoomIndex == 0)
            {
                return;
            }

            string roomPath = EditorApplication.applicationContentsPath + "/UnityExtensions/Unity/VR/HolographicSimulation/Rooms/";

            HolographicAutomation.LoadRoom(roomPath + s_RoomStrings[m_RoomIndex].text + ".xef");
        }
        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;
            }
        }
Exemplo n.º 6
0
        private void DrawRemotingMode()
        {
            EditorGUI.BeginChangeCheck();
            EmulationMode previousMode = m_Mode;

            m_Mode = (EmulationMode)EditorGUILayout.Popup(s_EmulationModeText, (int)m_Mode, s_ModeStrings);
            if (EditorGUI.EndChangeCheck())
            {
                if (previousMode == EmulationMode.RemoteDevice)
                {
                    Disconnect();
                }
                HolographicAutomation.SetEmulationMode(m_Mode);
            }
        }
Exemplo n.º 7
0
        private void OnPlayModeStateChanged(PlayModeStateChange state)
        {
            if (!IsWindowsMixedRealityCurrentTarget())
            {
                return;
            }

            bool wasPlaying = m_InPlayMode;

            m_InPlayMode = EditorApplication.isPlayingOrWillChangePlaymode;

            if (m_InPlayMode && !wasPlaying)
            {
                HolographicAutomation.SetEmulationMode(m_Mode);
                switch (m_Mode)
                {
                case EmulationMode.Simulated:
                    InitializeSimulation();
                    break;

                case EmulationMode.RemoteDevice:
                    break;
                }
            }
            else if (!m_InPlayMode && wasPlaying)
            {
                switch (m_Mode)
                {
                case EmulationMode.Simulated:
                    HolographicAutomation.Shutdown();
                    break;

                case EmulationMode.RemoteDevice:
                    break;
                }
            }
        }
        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;
            }
        }
Exemplo n.º 9
0
 public void PerformControllerPress(SimulatedControllerPress button)
 {
     HolographicAutomation.PerformButtonPress(m_ControllerHandednss, button);
 }
Exemplo n.º 10
0
 public void EnsureVisible()
 {
     HolographicAutomation.TryEnsureControllerVisible(m_ControllerHandednss);
 }
Exemplo n.º 11
0
 public void PerformGesture(SimulatedGesture gesture)
 {
     HolographicAutomation.PerformGesture(m_Hand, gesture);
 }
Exemplo n.º 12
0
 public void EnsureVisible()
 {
     HolographicAutomation.EnsureHandVisible(m_Hand);
 }