Beispiel #1
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);
            }
        }
Beispiel #2
0
        internal static Vector3 GetBodyPosition_Internal()
        {
            Vector3 result;

            HolographicEmulation.INTERNAL_CALL_GetBodyPosition_Internal(out result);
            return(result);
        }
Beispiel #3
0
        internal static Vector3 GetHandPosition_Internal(GestureHand hand)
        {
            Vector3 result;

            HolographicEmulation.INTERNAL_CALL_GetHandPosition_Internal(hand, out result);
            return(result);
        }
        private void OnPlayModeChanged()
        {
            bool inPlayMode = this.m_InPlayMode;

            this.m_InPlayMode = EditorApplication.isPlayingOrWillChangePlaymode;
            if (this.m_InPlayMode && !inPlayMode)
            {
                HolographicEmulation.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
                {
                    HolographicEmulation.Shutdown();
                }
            }
        }
        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;
            }
        }
        private void InitializeSimulation()
        {
            Disconnect();

            HolographicEmulation.Initialize();

            LoadCurrentRoom();
        }
Beispiel #7
0
 private void LoadCurrentRoom()
 {
     if (this.m_RoomIndex != 0)
     {
         string str = EditorApplication.applicationContentsPath + "/UnityExtensions/Unity/VR/HolographicSimulation/Rooms/";
         HolographicEmulation.LoadRoom(str + HolographicEmulationWindow.s_RoomStrings[this.m_RoomIndex].text + ".xef");
     }
 }
 private void InitializeSimulation()
 {
     if (this.m_ConnectionState != HolographicStreamerConnectionState.Disconnected)
     {
         this.Disconnect();
     }
     HolographicEmulation.Initialize();
     this.LoadCurrentRoom();
 }
        private void LoadCurrentRoom()
        {
            if (m_RoomIndex == 0)
            {
                return;
            }

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

            HolographicEmulation.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_Hand = (GestureHand)EditorGUILayout.Popup(s_HandText, (int)m_Hand, s_HandStrings);
                if (EditorGUI.EndChangeCheck())
                {
                    HolographicEmulation.SetGestureHand(m_Hand);
                }

                break;
            }
        }
Beispiel #11
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();
         }
     }
 }
        private void OnPlayModeStateChanged(PlayModeStateChange state)
        {
            if (!IsWindowsMixedRealityCurrentTarget())
            {
                return;
            }

            bool wasPlaying = m_InPlayMode;

            m_InPlayMode = EditorApplication.isPlayingOrWillChangePlaymode;

            if (m_InPlayMode && !wasPlaying)
            {
                HolographicEmulation.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:
                    HolographicEmulation.Shutdown();
                    break;

                case EmulationMode.RemoteDevice:
                    break;
                }
            }
        }
Beispiel #13
0
 public void PerformGesture(SimulatedGesture gesture)
 {
     HolographicEmulation.PerformGesture_Internal(this.m_Hand, gesture);
 }
Beispiel #14
0
 internal static void SetHandPosition_Internal(GestureHand hand, Vector3 position)
 {
     HolographicEmulation.INTERNAL_CALL_SetHandPosition_Internal(hand, ref position);
 }
Beispiel #15
0
 internal static void SetHeadRotation_Internal(Vector3 rotation)
 {
     HolographicEmulation.INTERNAL_CALL_SetHeadRotation_Internal(ref rotation);
 }
Beispiel #16
0
 internal static void SetBodyPosition_Internal(Vector3 position)
 {
     HolographicEmulation.INTERNAL_CALL_SetBodyPosition_Internal(ref position);
 }
Beispiel #17
0
 public void EnsureVisible()
 {
     HolographicEmulation.EnsureHandVisible_Internal(this.m_Hand);
 }