Skip to content

Commit a5c4efa

Browse files
author
Andrei Borodin
authored
Merge pull request #4019 from andreiborodin/features/correctingNamespaces
Correcting some Namespaces
2 parents 74f238f + d04f00c commit a5c4efa

File tree

20 files changed

+582
-576
lines changed

20 files changed

+582
-576
lines changed

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_ScrollPanZoom/Scripts/BaseClasses/PanZoomBase.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
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 Microsoft.MixedReality.Toolkit.Core.Interfaces.InputSystem;
54
using Microsoft.MixedReality.Toolkit.Input;
65
using Microsoft.MixedReality.Toolkit.Utilities;
76
using System.Collections;
Lines changed: 112 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,61 @@
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 Microsoft.MixedReality.Toolkit;
54
using Microsoft.MixedReality.Toolkit.Input;
65
using UnityEngine;
76

8-
public class GestureTester : MonoBehaviour, IMixedRealityGestureHandler<Vector3>
7+
namespace Microsoft.MixedReality.Toolkit.Examples
98
{
10-
public GameObject HoldIndicator = null;
11-
public GameObject ManipulationIndicator = null;
12-
public GameObject NavigationIndicator = null;
13-
14-
public Material DefaultMaterial = null;
15-
public Material HoldMaterial = null;
16-
public Material ManipulationMaterial = null;
17-
public Material NavigationMaterial = null;
18-
19-
public GameObject RailsAxisX = null;
20-
public GameObject RailsAxisY = null;
21-
public GameObject RailsAxisZ = null;
22-
23-
void OnEnable()
9+
public class GestureTester : MonoBehaviour, IMixedRealityGestureHandler<Vector3>
2410
{
25-
HideRails();
26-
}
11+
public GameObject HoldIndicator = null;
12+
public GameObject ManipulationIndicator = null;
13+
public GameObject NavigationIndicator = null;
2714

28-
public void OnGestureStarted(InputEventData eventData)
29-
{
30-
Debug.Log($"OnGestureStarted [{Time.frameCount}]: {eventData.MixedRealityInputAction.Description}");
15+
public Material DefaultMaterial = null;
16+
public Material HoldMaterial = null;
17+
public Material ManipulationMaterial = null;
18+
public Material NavigationMaterial = null;
3119

32-
var action = eventData.MixedRealityInputAction.Description;
33-
if (action == "Hold Action")
34-
{
35-
SetIndicator(HoldIndicator, "Hold: started", HoldMaterial);
36-
}
37-
else if (action == "Manipulate Action")
20+
public GameObject RailsAxisX = null;
21+
public GameObject RailsAxisY = null;
22+
public GameObject RailsAxisZ = null;
23+
24+
void OnEnable()
3825
{
39-
SetIndicator(ManipulationIndicator, $"Manipulation: started {Vector3.zero}", ManipulationMaterial, Vector3.zero);
26+
HideRails();
4027
}
41-
else if (action == "Navigation Action")
28+
29+
public void OnGestureStarted(InputEventData eventData)
4230
{
43-
SetIndicator(NavigationIndicator, $"Navigation: started {Vector3.zero}", NavigationMaterial, Vector3.zero);
44-
ShowRails(Vector3.zero);
45-
}
46-
}
31+
Debug.Log($"OnGestureStarted [{Time.frameCount}]: {eventData.MixedRealityInputAction.Description}");
4732

48-
public void OnGestureUpdated(InputEventData eventData)
49-
{
50-
Debug.Log($"OnGestureUpdated [{Time.frameCount}]: {eventData.MixedRealityInputAction.Description}");
33+
var action = eventData.MixedRealityInputAction.Description;
34+
if (action == "Hold Action")
35+
{
36+
SetIndicator(HoldIndicator, "Hold: started", HoldMaterial);
37+
}
38+
else if (action == "Manipulate Action")
39+
{
40+
SetIndicator(ManipulationIndicator, $"Manipulation: started {Vector3.zero}", ManipulationMaterial, Vector3.zero);
41+
}
42+
else if (action == "Navigation Action")
43+
{
44+
SetIndicator(NavigationIndicator, $"Navigation: started {Vector3.zero}", NavigationMaterial, Vector3.zero);
45+
ShowRails(Vector3.zero);
46+
}
47+
}
5148

52-
var action = eventData.MixedRealityInputAction.Description;
53-
if (action == "Hold Action")
49+
public void OnGestureUpdated(InputEventData eventData)
5450
{
55-
SetIndicator(HoldIndicator, "Hold: updated", DefaultMaterial);
51+
Debug.Log($"OnGestureUpdated [{Time.frameCount}]: {eventData.MixedRealityInputAction.Description}");
52+
53+
var action = eventData.MixedRealityInputAction.Description;
54+
if (action == "Hold Action")
55+
{
56+
SetIndicator(HoldIndicator, "Hold: updated", DefaultMaterial);
57+
}
5658
}
57-
}
5859

5960
public void OnGestureUpdated(InputEventData<Vector3> eventData)
6061
{
@@ -72,16 +73,16 @@ public void OnGestureUpdated(InputEventData<Vector3> eventData)
7273
}
7374
}
7475

75-
public void OnGestureCompleted(InputEventData eventData)
76-
{
77-
Debug.Log($"OnGestureCompleted [{Time.frameCount}]: {eventData.MixedRealityInputAction.Description}");
78-
79-
var action = eventData.MixedRealityInputAction.Description;
80-
if (action == "Hold Action")
76+
public void OnGestureCompleted(InputEventData eventData)
8177
{
82-
SetIndicator(HoldIndicator, "Hold: completed", DefaultMaterial);
78+
Debug.Log($"OnGestureCompleted [{Time.frameCount}]: {eventData.MixedRealityInputAction.Description}");
79+
80+
var action = eventData.MixedRealityInputAction.Description;
81+
if (action == "Hold Action")
82+
{
83+
SetIndicator(HoldIndicator, "Hold: completed", DefaultMaterial);
84+
}
8385
}
84-
}
8586

8687
public void OnGestureCompleted(InputEventData<Vector3> eventData)
8788
{
@@ -99,84 +100,85 @@ public void OnGestureCompleted(InputEventData<Vector3> eventData)
99100
}
100101
}
101102

102-
public void OnGestureCanceled(InputEventData eventData)
103-
{
104-
Debug.Log($"OnGestureCanceled [{Time.frameCount}]: {eventData.MixedRealityInputAction.Description}");
105-
106-
var action = eventData.MixedRealityInputAction.Description;
107-
if (action == "Hold Action")
108-
{
109-
SetIndicator(HoldIndicator, "Hold: canceled", DefaultMaterial);
110-
}
111-
else if (action == "Manipulate Action")
103+
public void OnGestureCanceled(InputEventData eventData)
112104
{
113-
SetIndicator(ManipulationIndicator, "Manipulation: canceled", DefaultMaterial);
114-
}
115-
else if (action == "Navigation Action")
116-
{
117-
SetIndicator(NavigationIndicator, "Navigation: canceled", DefaultMaterial);
118-
HideRails();
119-
}
120-
}
105+
Debug.Log($"OnGestureCanceled [{Time.frameCount}]: {eventData.MixedRealityInputAction.Description}");
121106

122-
private void SetIndicator(GameObject indicator, string label, Material material)
123-
{
124-
if (indicator)
125-
{
126-
var renderer = indicator.GetComponentInChildren<Renderer>();
127-
if (material && renderer)
107+
var action = eventData.MixedRealityInputAction.Description;
108+
if (action == "Hold Action")
128109
{
129-
renderer.material = material;
110+
SetIndicator(HoldIndicator, "Hold: canceled", DefaultMaterial);
130111
}
131-
var text = indicator.GetComponentInChildren<TextMesh>();
132-
if (text)
112+
else if (action == "Manipulate Action")
133113
{
134-
text.text = label;
114+
SetIndicator(ManipulationIndicator, "Manipulation: canceled", DefaultMaterial);
115+
}
116+
else if (action == "Navigation Action")
117+
{
118+
SetIndicator(NavigationIndicator, "Navigation: canceled", DefaultMaterial);
119+
HideRails();
135120
}
136121
}
137-
}
138122

139-
private void SetIndicator(GameObject indicator, string label, Material material, Vector3 position)
140-
{
141-
SetIndicator(indicator, label, material);
142-
if (indicator)
123+
private void SetIndicator(GameObject indicator, string label, Material material)
143124
{
144-
indicator.transform.localPosition = position;
125+
if (indicator)
126+
{
127+
var renderer = indicator.GetComponentInChildren<Renderer>();
128+
if (material && renderer)
129+
{
130+
renderer.material = material;
131+
}
132+
var text = indicator.GetComponentInChildren<TextMesh>();
133+
if (text)
134+
{
135+
text.text = label;
136+
}
137+
}
145138
}
146-
}
147-
148-
private void ShowRails(Vector3 position)
149-
{
150-
var gestureProfile = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.GesturesProfile;
151-
var useRails = gestureProfile.UseRailsNavigation;
152139

153-
if (RailsAxisX)
154-
{
155-
RailsAxisX.SetActive(!useRails || position.x != 0.0f);
156-
}
157-
if (RailsAxisY)
158-
{
159-
RailsAxisY.SetActive(!useRails || position.y != 0.0f);
160-
}
161-
if (RailsAxisZ)
140+
private void SetIndicator(GameObject indicator, string label, Material material, Vector3 position)
162141
{
163-
RailsAxisZ.SetActive(!useRails || position.z != 0.0f);
142+
SetIndicator(indicator, label, material);
143+
if (indicator)
144+
{
145+
indicator.transform.localPosition = position;
146+
}
164147
}
165-
}
166148

167-
private void HideRails()
168-
{
169-
if (RailsAxisX)
170-
{
171-
RailsAxisX.SetActive(false);
172-
}
173-
if (RailsAxisY)
149+
private void ShowRails(Vector3 position)
174150
{
175-
RailsAxisY.SetActive(false);
151+
var gestureProfile = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.GesturesProfile;
152+
var useRails = gestureProfile.UseRailsNavigation;
153+
154+
if (RailsAxisX)
155+
{
156+
RailsAxisX.SetActive(!useRails || position.x != 0.0f);
157+
}
158+
if (RailsAxisY)
159+
{
160+
RailsAxisY.SetActive(!useRails || position.y != 0.0f);
161+
}
162+
if (RailsAxisZ)
163+
{
164+
RailsAxisZ.SetActive(!useRails || position.z != 0.0f);
165+
}
176166
}
177-
if (RailsAxisZ)
167+
168+
private void HideRails()
178169
{
179-
RailsAxisZ.SetActive(false);
170+
if (RailsAxisX)
171+
{
172+
RailsAxisX.SetActive(false);
173+
}
174+
if (RailsAxisY)
175+
{
176+
RailsAxisY.SetActive(false);
177+
}
178+
if (RailsAxisZ)
179+
{
180+
RailsAxisZ.SetActive(false);
181+
}
180182
}
181183
}
182-
}
184+
}

Assets/MixedRealityToolkit.Examples/Demos/HandTracking/Script/GrabTouchExample.cs

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,56 @@
44
using Microsoft.MixedReality.Toolkit.Input;
55
using UnityEngine;
66

7-
public class GrabTouchExample : MonoBehaviour, IMixedRealityTouchHandler, IMixedRealityInputHandler
7+
namespace Microsoft.MixedReality.Toolkit.Examples
88
{
9-
[SerializeField]
10-
private MixedRealityInputAction grabAction = MixedRealityInputAction.None;
11-
12-
public void OnInputDown(InputEventData eventData)
9+
public class GrabTouchExample : MonoBehaviour, IMixedRealityTouchHandler, IMixedRealityInputHandler
1310
{
14-
if (eventData.MixedRealityInputAction == grabAction)
11+
[SerializeField]
12+
private MixedRealityInputAction grabAction = MixedRealityInputAction.None;
13+
14+
public void OnInputDown(InputEventData eventData)
1515
{
16-
GetComponent<Renderer>().material.color = new Color(0.0f, 1.0f, 0.0f);
16+
if (eventData.MixedRealityInputAction == grabAction)
17+
{
18+
GetComponent<Renderer>().material.color = new Color(0.0f, 1.0f, 0.0f);
19+
}
1720
}
18-
}
1921

20-
public void OnInputUp(InputEventData eventData)
21-
{
22-
if (eventData.MixedRealityInputAction == grabAction)
22+
public void OnInputUp(InputEventData eventData)
2323
{
24-
GetComponent<Renderer>().material.color = new Color(1.0f, 1.0f, 1.0f);
24+
if (eventData.MixedRealityInputAction == grabAction)
25+
{
26+
GetComponent<Renderer>().material.color = new Color(1.0f, 1.0f, 1.0f);
27+
}
2528
}
26-
}
2729

28-
public void OnInputPressed(InputEventData<float> eventData) { }
29-
30-
public void OnPositionInputChanged(InputEventData<Vector2> eventData) { }
31-
32-
/// <summary>
33-
/// This Handler is called by a HandTrackingInputSource when a Touch action for that hand starts.
34-
/// </summary>
35-
/// <remarks>
36-
/// A Touch action requires a target. a Touch action must occur inside the bounds of a gameObject.
37-
/// The eventData argument contains.
38-
/// </remarks>
39-
/// <param name="eventData">
40-
/// The argument passed contains information about the InputSource, the point in space where
41-
/// the Touch action occurred and the status of the Touch action.
42-
/// </param>
43-
public void OnTouchCompleted(HandTrackingInputEventData eventData)
44-
{
45-
GetComponent<Renderer>().material.color = new Color(1.0f, 1.0f, 1.0f);
46-
}
30+
public void OnInputPressed(InputEventData<float> eventData) { }
31+
32+
public void OnPositionInputChanged(InputEventData<Vector2> eventData) { }
33+
34+
/// <summary>
35+
/// This Handler is called by a HandTrackingInputSource when a Touch action for that hand starts.
36+
/// </summary>
37+
/// <remarks>
38+
/// A Touch action requires a target. a Touch action must occur inside the bounds of a gameObject.
39+
/// The eventData argument contains.
40+
/// </remarks>
41+
/// <param name="eventData">
42+
/// The argument passed contains information about the InputSource, the point in space where
43+
/// the Touch action occurred and the status of the Touch action.
44+
/// </param>
45+
public void OnTouchCompleted(HandTrackingInputEventData eventData)
46+
{
47+
GetComponent<Renderer>().material.color = new Color(1.0f, 1.0f, 1.0f);
48+
}
4749

48-
public void OnTouchStarted(HandTrackingInputEventData eventData)
49-
{
50-
GetComponent<Renderer>().material.color = new Color(0.0f, 1.0f, 0.0f);
51-
}
50+
public void OnTouchStarted(HandTrackingInputEventData eventData)
51+
{
52+
GetComponent<Renderer>().material.color = new Color(0.0f, 1.0f, 0.0f);
53+
}
5254

53-
public void OnTouchUpdated(HandTrackingInputEventData eventData)
54-
{
55+
public void OnTouchUpdated(HandTrackingInputEventData eventData)
56+
{
57+
}
5558
}
56-
}
59+
}

0 commit comments

Comments
 (0)