Esempio n. 1
0
        private void OnPlayModeChanged()
        {
            bool inPlayMode = this.m_InPlayMode;

            this.m_InPlayMode = EditorApplication.isPlayingOrWillChangePlaymode;
            if (this.m_InPlayMode && !inPlayMode)
            {
                PerceptionSimulation.SetEmulationMode(this.m_Mode);
                switch (this.m_Mode)
                {
                case EmulationMode.Simulated:
                    this.InitializeSimulation();
                    break;
                }
            }
            else if (!this.m_InPlayMode && inPlayMode)
            {
                switch (this.m_Mode)
                {
                case EmulationMode.Simulated:
                    PerceptionSimulation.Shutdown();
                    break;
                }
            }
        }
Esempio n. 2
0
        private void Update()
        {
            switch (this.m_Mode)
            {
            case EmulationMode.Simulated:
                PerceptionSimulation.SetGestureHand(this.m_Hand);
                break;

            case EmulationMode.RemoteDevice:
            {
                HolographicStreamerConnectionState connectionState = this.m_ConnectionState;
                this.m_ConnectionState = PerceptionRemotingPlugin.GetConnectionState();
                if (connectionState != this.m_ConnectionState)
                {
                    base.Repaint();
                }
                HolographicStreamerConnectionFailureReason reason = PerceptionRemotingPlugin.CheckForDisconnect();
                if ((reason == HolographicStreamerConnectionFailureReason.Unreachable) || (reason == HolographicStreamerConnectionFailureReason.ConnectionLost))
                {
                    Debug.LogWarning("Disconnected with failure reason " + reason + ", attempting to reconnect.");
                    this.Connect();
                }
                else if (reason != HolographicStreamerConnectionFailureReason.None)
                {
                    Debug.LogError("Disconnected with error " + reason);
                }
                break;
            }
            }
        }
        private void Update()
        {
            EmulationMode mode = this.m_Mode;

            if (mode != EmulationMode.Simulated)
            {
                if (mode == EmulationMode.RemoteDevice)
                {
                    HolographicStreamerConnectionState connectionState = this.m_ConnectionState;
                    this.m_ConnectionState = PerceptionRemotingPlugin.GetConnectionState();
                    if (connectionState != this.m_ConnectionState)
                    {
                        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);
                    }
                }
            }
            else
            {
                PerceptionSimulation.SetGestureHand(this.m_Hand);
            }
        }
        private void OnPlayModeChanged()
        {
            bool inPlayMode = this.m_InPlayMode;

            this.m_InPlayMode = EditorApplication.isPlayingOrWillChangePlaymode;
            if (this.m_InPlayMode && !inPlayMode)
            {
                PerceptionSimulation.SetEmulationMode(this.m_Mode);
                EmulationMode mode = this.m_Mode;
                if (mode != EmulationMode.Simulated)
                {
                    if (mode != EmulationMode.RemoteDevice)
                    {
                    }
                }
                else
                {
                    this.InitializeSimulation();
                }
            }
            else if (!this.m_InPlayMode && inPlayMode)
            {
                EmulationMode mode2 = this.m_Mode;
                if (mode2 != EmulationMode.Simulated)
                {
                    if (mode2 != EmulationMode.RemoteDevice)
                    {
                    }
                }
                else
                {
                    PerceptionSimulation.Shutdown();
                }
            }
        }
Esempio n. 5
0
 private void InitializeSimulation()
 {
     if (this.m_ConnectionState != HolographicStreamerConnectionState.Disconnected)
     {
         this.Disconnect();
     }
     PerceptionSimulation.Initialize();
     this.LoadCurrentRoom();
 }
 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.IsHoloLensCurrentTarget())
     {
         EditorGUILayout.HelpBox("You must enable Virtual Reality support in settings and add Windows Holographic 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())
                 {
                     PerceptionSimulation.SetGestureHand(this.m_Hand);
                 }
             }
         }
         else
         {
             EditorGUI.BeginDisabledGroup(this.m_ConnectionState != HolographicStreamerConnectionState.Disconnected);
             this.RemotingPreferencesOnGUI();
             EditorGUI.EndDisabledGroup();
             this.ConnectionStateGUI();
         }
     }
 }
Esempio n. 7
0
 internal static void SetGestureHand(GestureHand hand)
 {
     PerceptionSimulation.SetGestureHand_Internal(hand);
 }
Esempio n. 8
0
 internal static void SetEmulationMode(EmulationMode mode)
 {
     PerceptionSimulation.SetEmulationMode_Internal(mode);
 }
Esempio n. 9
0
 private void LoadCurrentRoom()
 {
     PerceptionSimulation.LoadRoom((EditorApplication.applicationContentsPath + "/UnityExtensions/Unity/VR/HolographicSimulation/Rooms/") + s_RoomStrings[this.m_RoomIndex].text + ".xef");
 }