Skip to content

Commit 43f4d4e

Browse files
author
Dogukan Erenel
committed
Merge branch 'develop' of https://hub.jazz.net/git/sanjayko/unity-sdk into develop
2 parents 76924c7 + 1906e4c commit 43f4d4e

File tree

6 files changed

+73
-17
lines changed

6 files changed

+73
-17
lines changed

Scripts/Logging/Logger.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ public static void InstallDefaultReactors( int logHistory = 2 )
132132
#if UNITY_EDITOR || UNITY_IOS || UNITY_ANDROID
133133
LogSystem.Instance.InstallReactor( new DebugReactor() );
134134
#endif
135-
LogSystem.Instance.InstallReactor( new FileReactor( Application.persistentDataPath + "/" + Application.productName + ".log", LogLevel.STATUS, logHistory ) );
135+
136+
if (!string.IsNullOrEmpty(Constants.Path.LOG_FOLDER) && !System.IO.Directory.Exists(Application.persistentDataPath + Constants.Path.LOG_FOLDER ))
137+
System.IO.Directory.CreateDirectory(Application.persistentDataPath + Constants.Path.LOG_FOLDER );
138+
139+
LogSystem.Instance.InstallReactor( new FileReactor( Application.persistentDataPath + Constants.Path.LOG_FOLDER + "/" + Application.productName + ".log", LogLevel.STATUS, logHistory ) );
136140

137141
Application.logMessageReceived += UnityLogCallback;
138142
}

Scripts/Services/Dialog/Dialog.cs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private void OnGetDialogsResp(RESTConnector.Request req, RESTConnector.Response
129129
}
130130
catch (Exception e)
131131
{
132-
Log.Error("NLC", "GetDialogs Exception: {0}", e.ToString());
132+
Log.Error("Dialog", "GetDialogs Exception: {0}", e.ToString());
133133
resp.Success = false;
134134
}
135135
}
@@ -459,8 +459,22 @@ public CheckServiceStatus( Dialog service, ServiceStatus callback )
459459
m_Service = service;
460460
m_Callback = callback;
461461

462-
if (! m_Service.GetDialogs( OnGetDialogs ) )
463-
OnFailure( "Failed to invoke GetDialogs()." );
462+
string customServiceID = Config.Instance.GetVariableValue(SERVICE_ID+"_ID");
463+
464+
//If custom classifierID is defined then we are using it to check the service health
465+
if(!string.IsNullOrEmpty(customServiceID)){
466+
467+
if (! m_Service.Converse( customServiceID, "Hello", OnDialog ) )
468+
OnFailure( "Failed to invoke Converse()." );
469+
else
470+
m_DialogCount += 1;
471+
}
472+
else{
473+
if (! m_Service.GetDialogs( OnGetDialogs ) )
474+
OnFailure( "Failed to invoke GetDialogs()." );
475+
}
476+
477+
464478
}
465479

466480
private void OnGetDialogs( Dialogs dialogs )
@@ -496,7 +510,7 @@ private void OnDialog( ConverseResponse resp )
496510

497511
private void OnFailure(string msg)
498512
{
499-
Log.Error("NaturalLanguageClassifier", msg);
513+
Log.Error("Dialog", msg);
500514
m_Callback(SERVICE_ID, false);
501515
m_DialogCount = 0;
502516
}

Scripts/Services/NaturalLanguageClassifier/NaturalLanguageClassifier.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,25 @@ public CheckServiceStatus( NaturalLanguageClassifier service, ServiceStatus call
512512
m_Service = service;
513513
m_Callback = callback;
514514

515-
if (! m_Service.GetClassifiers( OnCheckServices ) )
516-
OnFailure( "Failed to call GetClassifiers()" );
515+
string customClassifierID = Config.Instance.GetVariableValue(SERVICE_ID+"_ID");
516+
m_Service.DisableCache = true;
517+
//If custom classifierID is defined then we are using it to check the service health
518+
if(!string.IsNullOrEmpty(customClassifierID)){
519+
520+
if (! m_Service.GetClassifier(customClassifierID, OnCheckService ) )
521+
{
522+
OnFailure( "Failed to call GetClassifier()" );
523+
}
524+
else
525+
{
526+
m_GetClassifierCount += 1;
527+
}
528+
}
529+
else{
530+
if (! m_Service.GetClassifiers( OnCheckServices ) )
531+
OnFailure( "Failed to call GetClassifiers()" );
532+
}
533+
517534
}
518535

519536
private void OnCheckServices( Classifiers classifiers )

Scripts/Utilities/Constants.cs

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ public enum Event
220220
/// Event fired when location with procurement information
221221
/// </summary>
222222
ON_QUESTION_PROCUREMENT,
223+
/// <summary>
224+
/// Event fired when location with procurement information
225+
/// </summary>
226+
ON_QUESTION_COMBINED_CALL,
223227
#endregion
224228

225229
#region Animation / Camera
@@ -399,14 +403,21 @@ public enum Event
399403
///
400404
/// </summary>
401405
ON_COMMAND_PROCUREMENT,
406+
/// <summary>
407+
///
408+
/// </summary>
409+
ON_COMMAND_PROCUREMENT_LIST,
410+
/// <summary>
411+
///
412+
/// </summary>
413+
ON_COMMAND_ENTITY_EXTRACTION,
414+
#endregion
402415

403-
#endregion
404-
405-
#region Input - Touch
406-
/// <summary>
407-
/// Event if there is touch on fullscreen pressed - It is called for each touch
408-
/// </summary>
409-
ON_TOUCH_PRESSED_FULLSCREEN = 500,
416+
#region Input - Touch
417+
/// <summary>
418+
/// Event if there is touch on fullscreen pressed - It is called for each touch
419+
/// </summary>
420+
ON_TOUCH_PRESSED_FULLSCREEN = 500,
410421
/// <summary>
411422
/// Event if
412423
/// </summary>
@@ -619,6 +630,16 @@ public static class Path
619630
/// Configuration file name.
620631
/// </summary>
621632
public const string CONFIG_FILE = "/Config.json";
633+
634+
/// <summary>
635+
/// Cache folder to customize a parent folder for cache directory
636+
/// </summary>
637+
public static string CACHE_FOLDER = ""; //It needs to start with /
638+
639+
/// <summary>
640+
/// Log folder to customize a parent folder for logs
641+
/// </summary>
642+
public static string LOG_FOLDER = ""; //It needs to start with /
622643
}
623644

624645
/// <summary>

Scripts/Utilities/DataCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void Initialize(string cacheName, long maxCacheSize, double maxCacheAge )
7272
m_MaxCacheSize = maxCacheSize;
7373
m_MaxCacheAge = maxCacheAge;
7474

75-
m_CachePath = Application.persistentDataPath + "/" + cacheName + "/";
75+
m_CachePath = Application.persistentDataPath + Constants.Path.CACHE_FOLDER + "/" + cacheName + "/";
7676
if (!Directory.Exists(m_CachePath))
7777
Directory.CreateDirectory(m_CachePath);
7878

Scripts/Utilities/Utility.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public static GameObject FindObject(GameObject parent, string nameChild)
150150
/// <param name="nameChild">Name child.</param>
151151
/// <param name="isContains">Check string contains the name instead of equality.</param>
152152
/// <param name="sortByName">If true, children will be returned sorted by their name.</param>
153-
public static T[] FindObjects<T>(GameObject parent, string nameChild, bool isContains = false, bool sortByName = false) where T : Component
153+
public static T[] FindObjects<T>(GameObject parent, string nameChild, bool isContains = false, bool sortByName = false, bool includeInactive = true) where T : Component
154154
{
155155
T[] childObjects = null;
156156
List<T> listGameObject = new List<T>();
@@ -160,7 +160,7 @@ public static T[] FindObjects<T>(GameObject parent, string nameChild, bool isCon
160160
for (int i = 0; i < childPath.Length; i++)
161161
{
162162
string childTransformName = childPath[i];
163-
T[] childerenTransform = parent.GetComponentsInChildren<T>(includeInactive: true);
163+
T[] childerenTransform = parent.GetComponentsInChildren<T>(includeInactive: includeInactive);
164164
if (childerenTransform != null)
165165
{
166166
foreach (T item in childerenTransform)

0 commit comments

Comments
 (0)