Skip to content

Commit e58ff6b

Browse files
Merge pull request #841 from StephenHodgson/HTK-Refactor
fixed cross platform support from last refactor PR
2 parents 92f5429 + e5a9862 commit e58ff6b

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

Assets/HoloToolkit/Input/Scripts/HandGuidance.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

4-
using UnityEngine;
54

65
#if UNITY_WSA
6+
using UnityEngine;
77
using UnityEngine.VR.WSA.Input;
88
#endif
99

@@ -14,6 +14,7 @@ namespace HoloToolkit.Unity.InputModule
1414
/// </summary>
1515
public class HandGuidance : Singleton<HandGuidance>
1616
{
17+
#if UNITY_WSA
1718
[Tooltip("The Cursor object the HandGuidanceIndicator will be positioned around.")]
1819
public GameObject Cursor;
1920

@@ -31,7 +32,6 @@ public class HandGuidance : Singleton<HandGuidance>
3132

3233
private uint? currentlyTrackedHand = null;
3334

34-
#if UNITY_WSA
3535
protected override void Awake()
3636
{
3737
base.Awake();

Assets/HoloToolkit/Input/Scripts/InputManager.cs

+5
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ public class InputManager : Singleton<InputManager>
4545
private ManipulationEventData manipulationEventData;
4646
private HoldEventData holdEventData;
4747
private NavigationEventData navigationEventData;
48+
49+
#if UNITY_WSA || UNITY_STANDALONE_WIN
4850
private SpeechKeywordRecognizedEventData speechKeywordRecognizedEventData;
4951
private DictationEventData dictationEventData;
52+
#endif
5053

5154
/// <summary>
5255
/// Indicates if input is currently enabled or not.
@@ -184,8 +187,10 @@ private void InitializeEventDatas()
184187
manipulationEventData = new ManipulationEventData(EventSystem.current);
185188
navigationEventData = new NavigationEventData(EventSystem.current);
186189
holdEventData = new HoldEventData(EventSystem.current);
190+
#if UNITY_WSA || UNITY_STANDALONE_WIN
187191
speechKeywordRecognizedEventData = new SpeechKeywordRecognizedEventData(EventSystem.current);
188192
dictationEventData = new DictationEventData(EventSystem.current);
193+
#endif
189194
}
190195

191196
#region Unity Methods

Assets/HoloToolkit/Input/Scripts/Microphone/DictationInputManager.cs

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

44
using System.Collections;
5-
using System.Text;
65
using UnityEngine;
76

87
#if UNITY_WSA || UNITY_STANDALONE_WIN
8+
using System.Text;
99
using UnityEngine.Windows.Speech;
1010
#endif
1111

@@ -17,6 +17,7 @@ namespace HoloToolkit.Unity.InputModule
1717
/// </summary>
1818
public class DictationInputManager : Singleton<DictationInputManager>, IInputSource
1919
{
20+
#if UNITY_WSA || UNITY_STANDALONE_WIN
2021
/// <summary>
2122
/// Caches the text currently being displayed in dictation display text.
2223
/// </summary>
@@ -47,12 +48,12 @@ public class DictationInputManager : Singleton<DictationInputManager>, IInputSou
4748
/// Audio clip of the last dictation session.
4849
/// </summary>
4950
private static AudioClip dictationAudioClip;
50-
#if UNITY_WSA || UNITY_STANDALONE_WIN
51+
5152
private static DictationRecognizer dictationRecognizer;
52-
#endif
53+
5354
private static bool isTransitioning;
54-
5555
private static bool hasFailed;
56+
#endif
5657

5758
#region Unity Methods
5859

@@ -187,6 +188,7 @@ public static IEnumerator StopRecording()
187188
}
188189

189190
#region Dictation Recognizer Callbacks
191+
#if UNITY_WSA || UNITY_STANDALONE_WIN
190192

191193
/// <summary>
192194
/// 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)
200202
InputManager.Instance.RaiseDictationHypothesis(Instance, 0, dictationResult);
201203
}
202204

203-
#if UNITY_WSA || UNITY_STANDALONE_WIN
204205
/// <summary>
205206
/// This event is fired after the user pauses, typically at the end of a sentence. The full recognized string is returned here.
206207
/// </summary>
@@ -234,7 +235,6 @@ private static void DictationRecognizer_DictationComplete(DictationCompletionCau
234235
textSoFar = null;
235236
dictationResult = string.Empty;
236237
}
237-
#endif
238238

239239
/// <summary>
240240
/// This event is fired when an error occurs.
@@ -249,7 +249,7 @@ private static void DictationRecognizer_DictationError(string error, int hresult
249249
textSoFar = null;
250250
dictationResult = string.Empty;
251251
}
252-
252+
#endif
253253
#endregion // Dictation Recognizer Callbacks
254254

255255
#region IInputSource Implementation

Assets/HoloToolkit/Input/Scripts/Voice/KeywordManager.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public enum RecognizerStartBehavior { AutoStart, ManualStart };
4747
[Tooltip("An array of string keywords and UnityEvents, to be set in the Inspector.")]
4848
public KeywordAndResponse[] KeywordsAndResponses;
4949

50-
private readonly Dictionary<string, UnityEvent> responses = new Dictionary<string, UnityEvent>();
5150
#if UNITY_WSA || UNITY_STANDALONE_WIN
51+
private readonly Dictionary<string, UnityEvent> responses = new Dictionary<string, UnityEvent>();
5252
private KeywordRecognizer keywordRecognizer;
5353

5454
void Start()

Assets/HoloToolkit/SpatialMapping/Scripts/RemoteMapping/RemoteMappingManager.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ public partial class RemoteMappingManager : Singleton<RemoteMappingManager>
3232
/// Used for voice commands.
3333
/// </summary>
3434
private KeywordRecognizer keywordRecognizer;
35-
#endif
3635

3736
/// <summary>
3837
/// Collection of supported keywords and their associated actions.
3938
/// </summary>
4039
private Dictionary<string, System.Action> keywordCollection;
40+
#endif
4141

4242
// Use this for initialization.
4343
private void Start()
4444
{
45+
#if UNITY_WSA || UNITY_STANDALONE_WIN
4546
// Create our keyword collection.
4647
keywordCollection = new Dictionary<string, System.Action> { { SendMeshesKeyword, SendMeshes } };
4748

48-
#if UNITY_WSA || UNITY_STANDALONE_WIN
4949
// Tell the KeywordRecognizer about our keywords.
5050
keywordRecognizer = new KeywordRecognizer(keywordCollection.Keys.ToArray());
5151
// Register a callback for the KeywordRecognizer and start recognizing.

0 commit comments

Comments
 (0)