Skip to content

Commit d6b3829

Browse files
committed
format debug, logging, connector, and unit tests
1 parent f0e55f0 commit d6b3829

30 files changed

+6232
-6252
lines changed

Scripts/Camera/CameraTarget.cs

100644100755
Lines changed: 317 additions & 318 deletions
Large diffs are not rendered by default.

Scripts/Camera/HotCorner.cs

100644100755
Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -21,82 +21,82 @@
2121

2222
namespace IBM.Watson.DeveloperCloud.Camera
2323
{
24-
/// <summary>
25-
/// Hot corners to handle Three Tap on corners and middle points of the current device screen.
26-
/// </summary>
27-
public class HotCorner : MonoBehaviour
24+
/// <summary>
25+
/// Hot corners to handle Three Tap on corners and middle points of the current device screen.
26+
/// </summary>
27+
public class HotCorner : MonoBehaviour
28+
{
29+
#region Private Members
30+
[SerializeField]
31+
private float m_NormalizedThresholdWidth = 0.1f;
32+
[SerializeField]
33+
private float m_NormalizedThresholdHeight = 0.1f;
34+
#endregion
35+
36+
#region TapThreeTimes Event Handles
37+
38+
void OnEnable()
39+
{
40+
EventManager.Instance.RegisterEventReceiver("OnTripleTap", TapThreeTimes);
41+
}
42+
43+
void OnDisable()
2844
{
29-
#region Private Members
30-
[SerializeField]
31-
private float m_NormalizedThresholdWidth = 0.1f;
32-
[SerializeField]
33-
private float m_NormalizedThresholdHeight = 0.1f;
34-
#endregion
45+
EventManager.Instance.UnregisterEventReceiver("OnTripleTap", TapThreeTimes);
46+
}
3547

36-
#region TapThreeTimes Event Handles
48+
void TapThreeTimes(System.Object[] args = null)
49+
{
50+
if (args != null && args.Length > 0 && args[0] is TouchScript.Gestures.TapGesture)
51+
{
52+
//Got three tap gesture, now checking the corners
53+
TouchScript.Gestures.TapGesture tapGesture = args[0] as TouchScript.Gestures.TapGesture;
3754

38-
void OnEnable()
55+
if (tapGesture.NormalizedScreenPosition.x < m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y < m_NormalizedThresholdHeight)
3956
{
40-
EventManager.Instance.RegisterEventReceiver("OnTripleTap", TapThreeTimes);
57+
EventManager.Instance.SendEvent("OnTripleTapBottomLeft");
4158
}
42-
43-
void OnDisable()
59+
else if (tapGesture.NormalizedScreenPosition.x < m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y > 1.0f - m_NormalizedThresholdHeight)
4460
{
45-
EventManager.Instance.UnregisterEventReceiver("OnTripleTap", TapThreeTimes);
61+
EventManager.Instance.SendEvent("OnTripleTapTopLeft");
4662
}
47-
48-
void TapThreeTimes(System.Object[] args = null)
63+
else if (tapGesture.NormalizedScreenPosition.x > 1.0f - m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y < m_NormalizedThresholdHeight)
4964
{
50-
if (args != null && args.Length > 0 && args[0] is TouchScript.Gestures.TapGesture)
51-
{
52-
//Got three tap gesture, now checking the corners
53-
TouchScript.Gestures.TapGesture tapGesture = args[0] as TouchScript.Gestures.TapGesture;
54-
55-
if (tapGesture.NormalizedScreenPosition.x < m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y < m_NormalizedThresholdHeight)
56-
{
57-
EventManager.Instance.SendEvent("OnTripleTapBottomLeft");
58-
}
59-
else if (tapGesture.NormalizedScreenPosition.x < m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y > 1.0f - m_NormalizedThresholdHeight)
60-
{
61-
EventManager.Instance.SendEvent("OnTripleTapTopLeft");
62-
}
63-
else if (tapGesture.NormalizedScreenPosition.x > 1.0f - m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y < m_NormalizedThresholdHeight)
64-
{
65-
EventManager.Instance.SendEvent("OnTripleTapBottomRight");
66-
}
67-
else if (tapGesture.NormalizedScreenPosition.x > 1.0f - m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y > 1.0f - m_NormalizedThresholdHeight)
68-
{
69-
EventManager.Instance.SendEvent("OnTripleTapTopRight");
70-
}
71-
else if (tapGesture.NormalizedScreenPosition.x < m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y > 0.5f - (m_NormalizedThresholdHeight / 2.0f) && tapGesture.NormalizedScreenPosition.y < 0.5f + (m_NormalizedThresholdHeight / 2.0f))
72-
{
73-
EventManager.Instance.SendEvent("OnTripleTapMiddleLeft");
74-
}
75-
else if (tapGesture.NormalizedScreenPosition.x > 1.0f - m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y > 0.5f - (m_NormalizedThresholdHeight / 2.0f) && tapGesture.NormalizedScreenPosition.y < 0.5f + (m_NormalizedThresholdHeight / 2.0f))
76-
{
77-
EventManager.Instance.SendEvent("OnTripleTapMiddleRight");
78-
}
79-
else if (tapGesture.NormalizedScreenPosition.x > 0.5f - (m_NormalizedThresholdWidth / 2.0f) && tapGesture.NormalizedScreenPosition.x < 0.5f + (m_NormalizedThresholdWidth / 2.0f) && tapGesture.NormalizedScreenPosition.y < m_NormalizedThresholdHeight)
80-
{
81-
EventManager.Instance.SendEvent("OnTripleTapMiddleBottom");
82-
}
83-
else if (tapGesture.NormalizedScreenPosition.x > 0.5f - (m_NormalizedThresholdWidth / 2.0f) && tapGesture.NormalizedScreenPosition.x < 0.5f + (m_NormalizedThresholdWidth / 2.0f) && tapGesture.NormalizedScreenPosition.y > 1.0f - m_NormalizedThresholdHeight)
84-
{
85-
EventManager.Instance.SendEvent("OnTripleTapMiddleTop");
86-
}
87-
else
88-
{
89-
// do nothing
90-
}
91-
92-
}
93-
else
94-
{
95-
Log.Warning("WatsonCamera", "TapThreeTimes has invalid arguments.");
96-
}
65+
EventManager.Instance.SendEvent("OnTripleTapBottomRight");
66+
}
67+
else if (tapGesture.NormalizedScreenPosition.x > 1.0f - m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y > 1.0f - m_NormalizedThresholdHeight)
68+
{
69+
EventManager.Instance.SendEvent("OnTripleTapTopRight");
70+
}
71+
else if (tapGesture.NormalizedScreenPosition.x < m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y > 0.5f - (m_NormalizedThresholdHeight / 2.0f) && tapGesture.NormalizedScreenPosition.y < 0.5f + (m_NormalizedThresholdHeight / 2.0f))
72+
{
73+
EventManager.Instance.SendEvent("OnTripleTapMiddleLeft");
74+
}
75+
else if (tapGesture.NormalizedScreenPosition.x > 1.0f - m_NormalizedThresholdWidth && tapGesture.NormalizedScreenPosition.y > 0.5f - (m_NormalizedThresholdHeight / 2.0f) && tapGesture.NormalizedScreenPosition.y < 0.5f + (m_NormalizedThresholdHeight / 2.0f))
76+
{
77+
EventManager.Instance.SendEvent("OnTripleTapMiddleRight");
78+
}
79+
else if (tapGesture.NormalizedScreenPosition.x > 0.5f - (m_NormalizedThresholdWidth / 2.0f) && tapGesture.NormalizedScreenPosition.x < 0.5f + (m_NormalizedThresholdWidth / 2.0f) && tapGesture.NormalizedScreenPosition.y < m_NormalizedThresholdHeight)
80+
{
81+
EventManager.Instance.SendEvent("OnTripleTapMiddleBottom");
82+
}
83+
else if (tapGesture.NormalizedScreenPosition.x > 0.5f - (m_NormalizedThresholdWidth / 2.0f) && tapGesture.NormalizedScreenPosition.x < 0.5f + (m_NormalizedThresholdWidth / 2.0f) && tapGesture.NormalizedScreenPosition.y > 1.0f - m_NormalizedThresholdHeight)
84+
{
85+
EventManager.Instance.SendEvent("OnTripleTapMiddleTop");
86+
}
87+
else
88+
{
89+
// do nothing
9790
}
9891

99-
#endregion
92+
}
93+
else
94+
{
95+
Log.Warning("WatsonCamera", "TapThreeTimes has invalid arguments.");
96+
}
10097
}
10198

99+
#endregion
100+
}
101+
102102
}

0 commit comments

Comments
 (0)