Skip to content

Commit cc35e14

Browse files
author
Richard Lyle
committed
Merge branch 'develop' of https://hub.jazz.net/git/sanjayko/unity-sdk into develop
2 parents 90133c8 + b7d65a6 commit cc35e14

File tree

12 files changed

+1526
-52
lines changed

12 files changed

+1526
-52
lines changed

Prefabs/NlcWidget.prefab

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,8 @@ MonoBehaviour:
4545
m_ClassifierName: ${NLC_CLASSIFIER_NAME}
4646
m_ClassifierId: ${NLC_CLASSIFIER_ID}
4747
m_MinWordConfidence: 0
48-
m_MinWordConfidenceDelta: 0
4948
m_IgnoreWordConfidence: 0
50-
m_IgnoreWordConfidenceDelta: 0
5149
m_MinClassEventConfidence: 0
52-
m_MinClassEventConfidenceDelta: 0
5350
m_Language: en
5451
m_ClassEventList:
5552
- m_Class: wakeup
@@ -85,17 +82,17 @@ MonoBehaviour:
8582
- m_Class: question-numerati_woodside
8683
m_Event: 401
8784
- m_Class: pan_left
88-
m_Event: -1
85+
m_Event: 309
8986
- m_Class: pan_right
90-
m_Event: -1
87+
m_Event: 310
9188
- m_Class: pan_up
92-
m_Event: -1
89+
m_Event: 311
9390
- m_Class: pan_down
94-
m_Event: -1
91+
m_Event: 312
9592
- m_Class: zoom_in
96-
m_Event: -1
93+
m_Event: 307
9794
- m_Class: zoom_out
98-
m_Event: -1
95+
m_Event: 308
9996
- m_Class: show_next_passage
10097
m_Event: 415
10198
- m_Class: show_next_answer
@@ -115,7 +112,7 @@ MonoBehaviour:
115112
- m_Class: repeat_last_action
116113
m_Event: 419
117114
- m_Class: personnel
118-
m_Event: 515
115+
m_Event: 423
119116
- m_Class: confirm_update
120117
m_Event: 700
121118
- m_Class: cancel_update
@@ -146,6 +143,10 @@ MonoBehaviour:
146143
m_Event: 906
147144
- m_Class: about_xray
148145
m_Event: 907
146+
- m_Class: ship_tracking
147+
m_Event: 424
148+
- m_Class: procurement
149+
m_Event: 425
149150
m_TopClassText: {fileID: 0}
150151
--- !u!1001 &100100000
151152
Prefab:
@@ -156,7 +157,7 @@ Prefab:
156157
m_Modifications:
157158
- target: {fileID: 0}
158159
propertyPath: m_ClassEventList.Array.size
159-
value: 47
160+
value: 49
160161
objectReference: {fileID: 0}
161162
- target: {fileID: 0}
162163
propertyPath: m_ClassifierId
@@ -212,15 +213,15 @@ Prefab:
212213
objectReference: {fileID: 0}
213214
- target: {fileID: 0}
214215
propertyPath: m_ClassEventList.Array.data[16].m_Event
215-
value: -1
216+
value: 309
216217
objectReference: {fileID: 0}
217218
- target: {fileID: 0}
218219
propertyPath: m_ClassEventList.Array.data[17].m_Class
219220
value: pan_right
220221
objectReference: {fileID: 0}
221222
- target: {fileID: 0}
222223
propertyPath: m_ClassEventList.Array.data[17].m_Event
223-
value: -1
224+
value: 310
224225
objectReference: {fileID: 0}
225226
- target: {fileID: 0}
226227
propertyPath: m_ClassEventList.Array.data[18].m_Class
@@ -232,11 +233,11 @@ Prefab:
232233
objectReference: {fileID: 0}
233234
- target: {fileID: 0}
234235
propertyPath: m_ClassEventList.Array.data[18].m_Event
235-
value: -1
236+
value: 311
236237
objectReference: {fileID: 0}
237238
- target: {fileID: 0}
238239
propertyPath: m_ClassEventList.Array.data[19].m_Event
239-
value: -1
240+
value: 312
240241
objectReference: {fileID: 0}
241242
- target: {fileID: 0}
242243
propertyPath: m_ClassEventList.Array.data[20].m_Class
@@ -248,11 +249,11 @@ Prefab:
248249
objectReference: {fileID: 0}
249250
- target: {fileID: 0}
250251
propertyPath: m_ClassEventList.Array.data[20].m_Event
251-
value: -1
252+
value: 307
252253
objectReference: {fileID: 0}
253254
- target: {fileID: 0}
254255
propertyPath: m_ClassEventList.Array.data[21].m_Event
255-
value: -1
256+
value: 308
256257
objectReference: {fileID: 0}
257258
- target: {fileID: 0}
258259
propertyPath: m_ClassEventList.Array.data[22].m_Class
@@ -336,7 +337,7 @@ Prefab:
336337
objectReference: {fileID: 0}
337338
- target: {fileID: 0}
338339
propertyPath: m_ClassEventList.Array.data[31].m_Event
339-
value: 515
340+
value: 423
340341
objectReference: {fileID: 0}
341342
- target: {fileID: 0}
342343
propertyPath: m_ClassEventList.Array.data[32].m_Class
@@ -452,19 +453,19 @@ Prefab:
452453
objectReference: {fileID: 0}
453454
- target: {fileID: 0}
454455
propertyPath: m_ClassEventList.Array.data[47].m_Class
455-
value: about_xray
456+
value: ship_tracking
456457
objectReference: {fileID: 0}
457458
- target: {fileID: 0}
458459
propertyPath: m_ClassEventList.Array.data[47].m_Event
459-
value: 907
460+
value: 424
460461
objectReference: {fileID: 0}
461462
- target: {fileID: 0}
462463
propertyPath: m_ClassEventList.Array.data[48].m_Class
463-
value: about_xray
464+
value: procurement
464465
objectReference: {fileID: 0}
465466
- target: {fileID: 0}
466467
propertyPath: m_ClassEventList.Array.data[48].m_Event
467-
value: 907
468+
value: 425
468469
objectReference: {fileID: 0}
469470
- target: {fileID: 0}
470471
propertyPath: m_ClassEventList.Array.data[49].m_Class

Scripts/Camera/WatsonCamera.cs

Lines changed: 90 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
using System.Collections.Generic;
2121
using IBM.Watson.DeveloperCloud.Logging;
2222
using IBM.Watson.DeveloperCloud.Utilities;
23+
using UnityStandardAssets.ImageEffects;
2324

2425
namespace IBM.Watson.DeveloperCloud.Camera
2526
{
@@ -46,6 +47,12 @@ public class WatsonCamera : MonoBehaviour
4647
[SerializeField]
4748
private float m_SpeedForCameraAnimation = 2f;
4849

50+
private float m_CommandMovementModifier = 10.0f;
51+
52+
private Antialiasing m_AntiAliasing;
53+
private DepthOfField m_DepthOfField;
54+
private bool m_DisableInteractivity = false;
55+
4956
#endregion
5057

5158
#region Public Variable
@@ -110,11 +117,32 @@ public CameraTarget DefaultCameraTarget{
110117

111118
#endregion
112119

120+
#region Event Registration
121+
122+
void OnEnable()
123+
{
124+
EventManager.Instance.RegisterEventReceiver(Constants.Event.ON_CAMERA_SET_ANTIALIASING, OnCameraSetAntiAliasing);
125+
EventManager.Instance.RegisterEventReceiver(Constants.Event.ON_CAMERA_SET_DEPTHOFFIELD, OnCameraSetDepthOfField);
126+
EventManager.Instance.RegisterEventReceiver(Constants.Event.ON_CAMERA_SET_INTERACTIVITY, OnCameraSetTwoFingerDrag);
127+
}
128+
129+
void OnDisable()
130+
{
131+
EventManager.Instance.UnregisterEventReceiver(Constants.Event.ON_CAMERA_SET_ANTIALIASING, OnCameraSetAntiAliasing);
132+
EventManager.Instance.UnregisterEventReceiver(Constants.Event.ON_CAMERA_SET_DEPTHOFFIELD, OnCameraSetDepthOfField);
133+
EventManager.Instance.UnregisterEventReceiver(Constants.Event.ON_CAMERA_SET_INTERACTIVITY, OnCameraSetTwoFingerDrag);
134+
}
135+
136+
#endregion
137+
113138
#region Start / Update
114139

115140
void Awake(){
116141
mp_Instance = this;
142+
m_AntiAliasing = this.GetComponent<Antialiasing>();
143+
m_DepthOfField = this.GetComponent<DepthOfField>();
117144
}
145+
118146
void Start(){
119147
m_CameraInitialLocation = transform.localPosition;
120148
m_CameraInitialRotation = transform.rotation;
@@ -161,6 +189,9 @@ void InitializeCameraTargetList()
161189
/// <param name="args">Arguments.</param>
162190
public void DragTwoFinger(System.Object[] args)
163191
{
192+
if (m_DisableInteractivity)
193+
return;
194+
164195
if (args != null && args.Length == 1 && args[0] is TouchScript.Gestures.ScreenTransformGesture)
165196
{
166197
TouchScript.Gestures.ScreenTransformGesture transformGesture = args[0] as TouchScript.Gestures.ScreenTransformGesture;
@@ -180,12 +211,49 @@ public void DragTwoFinger(System.Object[] args)
180211

181212
#region Camera Events Received from Outside - Set default position / Move Left - Right - Up - Down / Zoom-in-out
182213

214+
public void OnCameraSetAntiAliasing(System.Object[] args)
215+
{
216+
if (args != null && args.Length == 1 && args[0] is bool)
217+
{
218+
bool valueSet = (bool)args[0];
219+
220+
if (m_AntiAliasing != null)
221+
{
222+
m_AntiAliasing.enabled = valueSet;
223+
}
224+
}
225+
}
226+
227+
public void OnCameraSetDepthOfField(System.Object[] args)
228+
{
229+
if (args != null && args.Length == 1 && args[0] is bool)
230+
{
231+
bool valueSet = (bool)args[0];
232+
233+
if (m_DepthOfField != null)
234+
{
235+
m_DepthOfField.enabled = valueSet;
236+
}
237+
}
238+
}
239+
240+
public void OnCameraSetTwoFingerDrag(System.Object[] args)
241+
{
242+
if (args != null && args.Length == 1 && args[0] is bool)
243+
{
244+
m_DisableInteractivity = !(bool)args[0];
245+
}
246+
}
247+
248+
183249
/// <summary>
184250
/// Event handler reseting the camera position.
185251
/// </summary>
186252
/// <param name="args">Arguments.</param>
187253
public void ResetCameraPosition(System.Object[] args)
188254
{
255+
if (m_DisableInteractivity)
256+
return;
189257
//Log.Status("WatsonCamera", "Reset Camera Position");
190258
DefaultCameraTarget.TargetPosition = m_CameraInitialLocation;
191259
DefaultCameraTarget.TargetRotation = m_CameraInitialRotation;
@@ -197,7 +265,10 @@ public void ResetCameraPosition(System.Object[] args)
197265
/// <param name="args">Arguments.</param>
198266
public void MoveUp(System.Object[] args)
199267
{
200-
DefaultCameraTarget.TargetPosition += this.transform.up;
268+
if (m_DisableInteractivity)
269+
return;
270+
271+
DefaultCameraTarget.TargetPosition += this.transform.up * m_CommandMovementModifier;
201272
}
202273

203274
/// <summary>
@@ -206,7 +277,10 @@ public void MoveUp(System.Object[] args)
206277
/// <param name="args">Arguments.</param>
207278
public void MoveDown(System.Object[] args)
208279
{
209-
DefaultCameraTarget.TargetPosition += this.transform.up * -1.0f;
280+
if (m_DisableInteractivity)
281+
return;
282+
283+
DefaultCameraTarget.TargetPosition += this.transform.up * -m_CommandMovementModifier;
210284
}
211285

212286
/// <summary>
@@ -215,7 +289,10 @@ public void MoveDown(System.Object[] args)
215289
/// <param name="args">Arguments.</param>
216290
public void MoveLeft(System.Object[] args)
217291
{
218-
DefaultCameraTarget.TargetPosition += this.transform.right * -1.0f;;
292+
if (m_DisableInteractivity)
293+
return;
294+
295+
DefaultCameraTarget.TargetPosition += this.transform.right * -m_CommandMovementModifier;
219296
}
220297

221298
/// <summary>
@@ -224,7 +301,10 @@ public void MoveLeft(System.Object[] args)
224301
/// <param name="args">Arguments.</param>
225302
public void MoveRight(System.Object[] args)
226303
{
227-
DefaultCameraTarget.TargetPosition += this.transform.right;
304+
if (m_DisableInteractivity)
305+
return;
306+
307+
DefaultCameraTarget.TargetPosition += this.transform.right * m_CommandMovementModifier;
228308
}
229309

230310
/// <summary>
@@ -233,6 +313,9 @@ public void MoveRight(System.Object[] args)
233313
/// <param name="args">Arguments.</param>
234314
public void ZoomIn(System.Object[] args)
235315
{
316+
if (m_DisableInteractivity)
317+
return;
318+
236319
DefaultCameraTarget.TargetPosition += transform.forward * m_ZoomSpeed;
237320
}
238321

@@ -242,6 +325,9 @@ public void ZoomIn(System.Object[] args)
242325
/// <param name="args">Arguments.</param>
243326
public void ZoomOut(System.Object[] args)
244327
{
328+
if (m_DisableInteractivity)
329+
return;
330+
245331
DefaultCameraTarget.TargetPosition += transform.forward * m_ZoomSpeed * -1.0f;
246332
}
247333

Scripts/Services/AlchemyAPI.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)