Skip to content

Commit a16dd1e

Browse files
author
Dogukan Erenel
committed
* Fix dependencies which caused compiler issues
1 parent 815181b commit a16dd1e

File tree

2 files changed

+126
-32
lines changed

2 files changed

+126
-32
lines changed

Scripts/Camera/WatsonCamera.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ public class WatsonCamera : MonoBehaviour
4848

4949
private float m_CommandMovementModifier = 10.0f;
5050

51+
[SerializeField]
52+
private MonoBehaviour m_AntiAliasing;
53+
[SerializeField]
54+
private MonoBehaviour m_DepthOfField;
5155
private bool m_DisableInteractivity = false;
5256

5357
#endregion
@@ -118,11 +122,15 @@ public CameraTarget DefaultCameraTarget{
118122

119123
void OnEnable()
120124
{
125+
EventManager.Instance.RegisterEventReceiver(Constants.Event.ON_CAMERA_SET_ANTIALIASING, OnCameraSetAntiAliasing);
126+
EventManager.Instance.RegisterEventReceiver(Constants.Event.ON_CAMERA_SET_DEPTHOFFIELD, OnCameraSetDepthOfField);
121127
EventManager.Instance.RegisterEventReceiver(Constants.Event.ON_CAMERA_SET_INTERACTIVITY, OnCameraSetTwoFingerDrag);
122128
}
123129

124130
void OnDisable()
125131
{
132+
EventManager.Instance.UnregisterEventReceiver(Constants.Event.ON_CAMERA_SET_ANTIALIASING, OnCameraSetAntiAliasing);
133+
EventManager.Instance.UnregisterEventReceiver(Constants.Event.ON_CAMERA_SET_DEPTHOFFIELD, OnCameraSetDepthOfField);
126134
EventManager.Instance.UnregisterEventReceiver(Constants.Event.ON_CAMERA_SET_INTERACTIVITY, OnCameraSetTwoFingerDrag);
127135
}
128136

@@ -202,6 +210,32 @@ public void DragTwoFinger(System.Object[] args)
202210

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

213+
public void OnCameraSetAntiAliasing(System.Object[] args)
214+
{
215+
if (args != null && args.Length == 1 && args[0] is bool)
216+
{
217+
bool valueSet = (bool)args[0];
218+
219+
if (m_AntiAliasing != null)
220+
{
221+
m_AntiAliasing.enabled = valueSet;
222+
}
223+
}
224+
}
225+
226+
public void OnCameraSetDepthOfField(System.Object[] args)
227+
{
228+
if (args != null && args.Length == 1 && args[0] is bool)
229+
{
230+
bool valueSet = (bool)args[0];
231+
232+
if (m_DepthOfField != null)
233+
{
234+
m_DepthOfField.enabled = valueSet;
235+
}
236+
}
237+
}
238+
205239
public void OnCameraSetTwoFingerDrag(System.Object[] args)
206240
{
207241
if (args != null && args.Length == 1 && args[0] is bool)

Scripts/Services/AlchemyAPI/DataModels.cs

Lines changed: 92 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using FullSerializer;
1919
using System.Text;
2020
using System.Collections.Generic;
21+
using IBM.Watson.DeveloperCloud.Services.XRAY.v1;
2122

2223
namespace IBM.Watson.DeveloperCloud.Services.AlchemyAPI.v1
2324
{
@@ -57,6 +58,41 @@ public bool HasGeographicInformation
5758
}
5859
}
5960

61+
private PositionOnMap _GeoLocation = null;
62+
public PositionOnMap GeoLocation
63+
{
64+
get
65+
{
66+
if (_GeoLocation == null)
67+
{
68+
string geoString = null;
69+
for (int i = 0; entities != null && i < entities.Length; i++)
70+
{
71+
if (entities[i].disambiguated != null)
72+
{
73+
geoString = entities[i].disambiguated.geo;
74+
if (!string.IsNullOrEmpty(geoString))
75+
{
76+
string[] geoValues = geoString.Split(' ');
77+
if (geoValues != null && geoValues.Length == 2)
78+
{
79+
double latitute = 0;
80+
double longitutde = 0;
81+
82+
if (double.TryParse(geoValues[0], out latitute) && double.TryParse(geoValues[1], out longitutde))
83+
{
84+
_GeoLocation = new PositionOnMap(latitute, longitutde, entities[i].disambiguated.name);
85+
break;
86+
}
87+
}
88+
}
89+
}
90+
}
91+
}
92+
return _GeoLocation;
93+
}
94+
}
95+
6096
public override string ToString()
6197
{
6298
StringBuilder stringBuilder = new StringBuilder();
@@ -615,6 +651,37 @@ public bool HasGeographicInformation
615651
return !string.IsNullOrEmpty(geoString);
616652
}
617653
}
654+
655+
private PositionOnMap _GeoLocation = null;
656+
public PositionOnMap GeoLocation
657+
{
658+
get
659+
{
660+
if (_GeoLocation == null)
661+
{
662+
string geoString = null;
663+
if (disambiguated != null)
664+
{
665+
geoString = disambiguated.geo;
666+
if (!string.IsNullOrEmpty(geoString))
667+
{
668+
string[] geoValues = geoString.Split(' ');
669+
if (geoValues != null && geoValues.Length == 2)
670+
{
671+
double latitute = 0;
672+
double longitutde = 0;
673+
674+
if (double.TryParse(geoValues[0], out latitute) && double.TryParse(geoValues[1], out longitutde))
675+
{
676+
_GeoLocation = new PositionOnMap(latitute, longitutde, disambiguated.name);
677+
}
678+
}
679+
}
680+
}
681+
}
682+
return _GeoLocation;
683+
}
684+
}
618685
};
619686

620687
[fsObject]
@@ -749,12 +816,6 @@ public string ToLongString()
749816
return stringBuilder.ToString();
750817
}
751818

752-
public override string ToString()
753-
{
754-
return string.Format("[CombinedCallData: status={0}, totalTransactions={1}, language={2}, text={3}, keywords={4}, entities={5}, docSentiment={6}, concepts={7}, " +
755-
"relations={8}, taxonomy={9}, docEmotions={10}, dates={11}, HasData={12}, " +
756-
"EntityCombined={13}, EntityCombinedCommaSeperated={14}]", status, totalTransactions, language, text, keywords, entities, docSentiment, concepts, relations, taxonomy, docEmotions, dates, HasData, EntityCombined, EntityCombinedCommaSeperated);
757-
}
758819
};
759820

760821

@@ -768,32 +829,6 @@ public class Keyword
768829

769830
};
770831

771-
[fsObject]
772-
public class DateData
773-
{
774-
public string text { get; set; }
775-
public string date { get; set; }
776-
777-
private System.DateTime m_dateValue = default(System.DateTime);
778-
public System.DateTime DateValue
779-
{
780-
get
781-
{
782-
if (m_dateValue == default(System.DateTime) && !string.IsNullOrEmpty(date) && date.Length > 8)
783-
{
784-
//19840101T000000
785-
System.DateTime.TryParseExact(date.Remove(8),
786-
"yyyyddMM",
787-
System.Globalization.CultureInfo.InvariantCulture,
788-
System.Globalization.DateTimeStyles.None,
789-
out m_dateValue);
790-
791-
}
792-
return m_dateValue;
793-
}
794-
}
795-
};
796-
797832
[fsObject]
798833
public class Concept
799834
{
@@ -873,5 +908,30 @@ public class DocEmotions
873908
public string sadness { get; set; }
874909
};
875910

911+
[fsObject]
912+
public class DateData
913+
{
914+
public string text { get; set; }
915+
public string date { get; set; }
916+
917+
private System.DateTime m_dateValue = default(System.DateTime);
918+
public System.DateTime DateValue
919+
{
920+
get
921+
{
922+
if (m_dateValue == default(System.DateTime) && !string.IsNullOrEmpty(date) && date.Length > 8)
923+
{
924+
//19840101T000000
925+
System.DateTime.TryParseExact(date.Remove(8),
926+
"yyyyddMM",
927+
System.Globalization.CultureInfo.InvariantCulture,
928+
System.Globalization.DateTimeStyles.None,
929+
out m_dateValue);
930+
931+
}
932+
return m_dateValue;
933+
}
934+
}
935+
};
876936

877937
}

0 commit comments

Comments
 (0)