diff --git a/Assets/HoloToolkit/Input/Scripts/HandGuidance.cs b/Assets/HoloToolkit/Input/Scripts/HandGuidance.cs index 46b439edab6..3833d5172a1 100644 --- a/Assets/HoloToolkit/Input/Scripts/HandGuidance.cs +++ b/Assets/HoloToolkit/Input/Scripts/HandGuidance.cs @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -using UnityEngine; #if UNITY_WSA +using UnityEngine; using UnityEngine.VR.WSA.Input; #endif @@ -14,6 +14,7 @@ namespace HoloToolkit.Unity.InputModule /// public class HandGuidance : Singleton { +#if UNITY_WSA [Tooltip("The Cursor object the HandGuidanceIndicator will be positioned around.")] public GameObject Cursor; @@ -31,7 +32,6 @@ public class HandGuidance : Singleton private uint? currentlyTrackedHand = null; -#if UNITY_WSA protected override void Awake() { base.Awake(); diff --git a/Assets/HoloToolkit/Input/Scripts/InputManager.cs b/Assets/HoloToolkit/Input/Scripts/InputManager.cs index f653e78fb39..839fbc67fa4 100644 --- a/Assets/HoloToolkit/Input/Scripts/InputManager.cs +++ b/Assets/HoloToolkit/Input/Scripts/InputManager.cs @@ -45,8 +45,11 @@ public class InputManager : Singleton private ManipulationEventData manipulationEventData; private HoldEventData holdEventData; private NavigationEventData navigationEventData; + +#if UNITY_WSA || UNITY_STANDALONE_WIN private SpeechKeywordRecognizedEventData speechKeywordRecognizedEventData; private DictationEventData dictationEventData; +#endif /// /// Indicates if input is currently enabled or not. @@ -184,8 +187,10 @@ private void InitializeEventDatas() manipulationEventData = new ManipulationEventData(EventSystem.current); navigationEventData = new NavigationEventData(EventSystem.current); holdEventData = new HoldEventData(EventSystem.current); +#if UNITY_WSA || UNITY_STANDALONE_WIN speechKeywordRecognizedEventData = new SpeechKeywordRecognizedEventData(EventSystem.current); dictationEventData = new DictationEventData(EventSystem.current); +#endif } #region Unity Methods diff --git a/Assets/HoloToolkit/Input/Scripts/Microphone/DictationInputManager.cs b/Assets/HoloToolkit/Input/Scripts/Microphone/DictationInputManager.cs index f956e6c83f7..1f478a6a93c 100644 --- a/Assets/HoloToolkit/Input/Scripts/Microphone/DictationInputManager.cs +++ b/Assets/HoloToolkit/Input/Scripts/Microphone/DictationInputManager.cs @@ -2,10 +2,10 @@ // Licensed under the MIT License. See LICENSE in the project root for license information. using System.Collections; -using System.Text; using UnityEngine; #if UNITY_WSA || UNITY_STANDALONE_WIN +using System.Text; using UnityEngine.Windows.Speech; #endif @@ -17,6 +17,7 @@ namespace HoloToolkit.Unity.InputModule /// public class DictationInputManager : Singleton, IInputSource { +#if UNITY_WSA || UNITY_STANDALONE_WIN /// /// Caches the text currently being displayed in dictation display text. /// @@ -47,12 +48,12 @@ public class DictationInputManager : Singleton, IInputSou /// Audio clip of the last dictation session. /// private static AudioClip dictationAudioClip; -#if UNITY_WSA || UNITY_STANDALONE_WIN + private static DictationRecognizer dictationRecognizer; -#endif + private static bool isTransitioning; - private static bool hasFailed; +#endif #region Unity Methods @@ -187,6 +188,7 @@ public static IEnumerator StopRecording() } #region Dictation Recognizer Callbacks +#if UNITY_WSA || UNITY_STANDALONE_WIN /// /// This event is fired while the user is talking. As the recognizer listens, it provides text of what it's heard so far. @@ -200,7 +202,6 @@ private static void DictationRecognizer_DictationHypothesis(string text) InputManager.Instance.RaiseDictationHypothesis(Instance, 0, dictationResult); } -#if UNITY_WSA || UNITY_STANDALONE_WIN /// /// This event is fired after the user pauses, typically at the end of a sentence. The full recognized string is returned here. /// @@ -234,7 +235,6 @@ private static void DictationRecognizer_DictationComplete(DictationCompletionCau textSoFar = null; dictationResult = string.Empty; } -#endif /// /// This event is fired when an error occurs. @@ -249,7 +249,7 @@ private static void DictationRecognizer_DictationError(string error, int hresult textSoFar = null; dictationResult = string.Empty; } - +#endif #endregion // Dictation Recognizer Callbacks #region IInputSource Implementation diff --git a/Assets/HoloToolkit/Input/Scripts/Voice/KeywordManager.cs b/Assets/HoloToolkit/Input/Scripts/Voice/KeywordManager.cs index 4cc816ca49c..34e59aebb36 100644 --- a/Assets/HoloToolkit/Input/Scripts/Voice/KeywordManager.cs +++ b/Assets/HoloToolkit/Input/Scripts/Voice/KeywordManager.cs @@ -47,8 +47,8 @@ public enum RecognizerStartBehavior { AutoStart, ManualStart }; [Tooltip("An array of string keywords and UnityEvents, to be set in the Inspector.")] public KeywordAndResponse[] KeywordsAndResponses; - private readonly Dictionary responses = new Dictionary(); #if UNITY_WSA || UNITY_STANDALONE_WIN + private readonly Dictionary responses = new Dictionary(); private KeywordRecognizer keywordRecognizer; void Start() diff --git a/Assets/HoloToolkit/SpatialMapping/Scripts/RemoteMapping/RemoteMappingManager.cs b/Assets/HoloToolkit/SpatialMapping/Scripts/RemoteMapping/RemoteMappingManager.cs index 9230c51ebd1..76b12e69b28 100644 --- a/Assets/HoloToolkit/SpatialMapping/Scripts/RemoteMapping/RemoteMappingManager.cs +++ b/Assets/HoloToolkit/SpatialMapping/Scripts/RemoteMapping/RemoteMappingManager.cs @@ -32,20 +32,20 @@ public partial class RemoteMappingManager : Singleton /// Used for voice commands. /// private KeywordRecognizer keywordRecognizer; -#endif /// /// Collection of supported keywords and their associated actions. /// private Dictionary keywordCollection; +#endif // Use this for initialization. private void Start() { +#if UNITY_WSA || UNITY_STANDALONE_WIN // Create our keyword collection. keywordCollection = new Dictionary { { SendMeshesKeyword, SendMeshes } }; -#if UNITY_WSA || UNITY_STANDALONE_WIN // Tell the KeywordRecognizer about our keywords. keywordRecognizer = new KeywordRecognizer(keywordCollection.Keys.ToArray()); // Register a callback for the KeywordRecognizer and start recognizing.