void Update()
        {
            switch (m_Mode)
            {
            case EmulationMode.Simulated:
                HolographicEmulation.SetGestureHand(m_Hand);
                break;

            case EmulationMode.RemoteDevice:
                HolographicStreamerConnectionState connectionState = PerceptionRemotingPlugin.GetConnectionState();
                if (connectionState != m_LastConnectionState)
                {
                    Repaint();
                }
                var lastConnectionFailureReason = PerceptionRemotingPlugin.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;
            }
        }
Example #2
0
        private void Update()
        {
            EmulationMode mode = this.m_Mode;

            if (mode != EmulationMode.Simulated)
            {
                if (mode == EmulationMode.RemoteDevice)
                {
                    HolographicStreamerConnectionState connectionState = PerceptionRemotingPlugin.GetConnectionState();
                    if (connectionState != this.m_LastConnectionState)
                    {
                        base.Repaint();
                    }
                    HolographicStreamerConnectionFailureReason holographicStreamerConnectionFailureReason = PerceptionRemotingPlugin.CheckForDisconnect();
                    if (holographicStreamerConnectionFailureReason == HolographicStreamerConnectionFailureReason.Unreachable || holographicStreamerConnectionFailureReason == HolographicStreamerConnectionFailureReason.ConnectionLost)
                    {
                        Debug.LogWarning("Disconnected with failure reason " + holographicStreamerConnectionFailureReason + ", attempting to reconnect.");
                        this.Connect();
                    }
                    else if (holographicStreamerConnectionFailureReason != HolographicStreamerConnectionFailureReason.None)
                    {
                        Debug.LogError("Disconnected with error " + holographicStreamerConnectionFailureReason);
                    }
                    this.m_LastConnectionState = connectionState;
                }
            }
            else
            {
                HolographicEmulation.SetGestureHand(this.m_Hand);
            }
        }
        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_Hand = (GestureHand)EditorGUILayout.Popup(s_HandText, (int)m_Hand, s_HandStrings);
                if (EditorGUI.EndChangeCheck())
                {
                    HolographicEmulation.SetGestureHand(m_Hand);
                }

                break;
            }
        }
Example #4
0
 private void OnGUI()
 {
     if (!this.CheckOperatingSystem())
     {
         EditorGUILayout.HelpBox("You must be running Windows build 14318 or later to use Holographic Simulation or Remoting.", MessageType.Warning);
     }
     else if (!this.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);
     }
     else
     {
         EditorGUILayout.Space();
         EditorGUI.BeginDisabledGroup(this.m_InPlayMode);
         this.DrawRemotingMode();
         EditorGUI.EndDisabledGroup();
         EmulationMode mode = this.m_Mode;
         if (mode != EmulationMode.RemoteDevice)
         {
             if (mode == EmulationMode.Simulated)
             {
                 EditorGUI.BeginChangeCheck();
                 this.m_RoomIndex = EditorGUILayout.Popup(HolographicEmulationWindow.s_RoomText, this.m_RoomIndex, HolographicEmulationWindow.s_RoomStrings, new GUILayoutOption[0]);
                 if (EditorGUI.EndChangeCheck() && this.m_InPlayMode)
                 {
                     this.LoadCurrentRoom();
                 }
                 EditorGUI.BeginChangeCheck();
                 this.m_Hand = (GestureHand)EditorGUILayout.Popup(HolographicEmulationWindow.s_HandText, (int)this.m_Hand, HolographicEmulationWindow.s_HandStrings, new GUILayoutOption[0]);
                 if (EditorGUI.EndChangeCheck())
                 {
                     HolographicEmulation.SetGestureHand(this.m_Hand);
                 }
             }
         }
         else
         {
             EditorGUI.BeginDisabledGroup(this.IsConnectedToRemoteDevice());
             this.RemotingPreferencesOnGUI();
             EditorGUI.EndDisabledGroup();
             this.ConnectionStateGUI();
         }
     }
 }