From 1ab4b2c80aa7c8ce49e84d2787bb4e116c5cf4cd Mon Sep 17 00:00:00 2001 From: scherlit <scherlit@uni-potsdam.de> Date: Tue, 14 Jan 2025 17:08:59 +0100 Subject: [PATCH] preparing data collection connection try to get a connection between ApplicationManager and WebCommunication --- .../Runtime/EventLogger/Scripts/EventLogger.cs | 9 +++++++++ .../Runtime/Scripts/ImpulseController.cs | 1 + .../Runtime/Scripts/CoachRtc.cs | 18 +++++++++++++++++- .../Runtime/Scripts/ControllerManager.cs | 2 -- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/Packages/vr.teachr.applicationmanager/Runtime/EventLogger/Scripts/EventLogger.cs b/Packages/vr.teachr.applicationmanager/Runtime/EventLogger/Scripts/EventLogger.cs index 4f3a4c780..abe2e59af 100644 --- a/Packages/vr.teachr.applicationmanager/Runtime/EventLogger/Scripts/EventLogger.cs +++ b/Packages/vr.teachr.applicationmanager/Runtime/EventLogger/Scripts/EventLogger.cs @@ -94,6 +94,15 @@ namespace TeachR.ApplicationManager return Task.CompletedTask; } + /// <summary> + /// Used to send the scriptInfoList to website + /// </summary> + /// <returns>The script info list as Json.</returns> + public string GetScriptInfoListAsJson() + { + return JsonUtility.ToJson(new { scripts = scriptInfoList }, true); + } + private void CreateChildInInspector(MonoBehaviour_Loggable script, string additionalName = "") { if (script.Chosen) diff --git a/Packages/vr.teachr.structuretree/Runtime/Scripts/ImpulseController.cs b/Packages/vr.teachr.structuretree/Runtime/Scripts/ImpulseController.cs index f67f57fcb..302f47a2a 100644 --- a/Packages/vr.teachr.structuretree/Runtime/Scripts/ImpulseController.cs +++ b/Packages/vr.teachr.structuretree/Runtime/Scripts/ImpulseController.cs @@ -95,6 +95,7 @@ namespace TeachR.StructureTree CoachRtc.Transient.On("themeChange", json => StartCoroutine(HandleThemeChange(json.GetValue<ThemeChange>(), chanceToMisbehave))); CoachRtc.Transient.On("requestThemes", _ => AnswerThemeRequest()); + return Task.CompletedTask; } diff --git a/Packages/vr.teachr.webcommunication/Runtime/Scripts/CoachRtc.cs b/Packages/vr.teachr.webcommunication/Runtime/Scripts/CoachRtc.cs index 4ab65cc91..1ac269193 100644 --- a/Packages/vr.teachr.webcommunication/Runtime/Scripts/CoachRtc.cs +++ b/Packages/vr.teachr.webcommunication/Runtime/Scripts/CoachRtc.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Net; using System.Threading.Tasks; using UnityEngine; +using UnityEngine.Events; namespace TeachR.WebCommunication { @@ -23,6 +24,9 @@ namespace TeachR.WebCommunication private static readonly List<Msg> InboundStack = new(); public static bool Active { get; private set; } + private static UnityEvent configurationEvent; + private static UnityEvent dataCollectionEvent; + private static UnityEvent speechtoolEvent; /// <summary> @@ -107,7 +111,7 @@ namespace TeachR.WebCommunication if (missingControllers.Any()) { - Debug.Log("Die folgenden Controller wurden nicht in der Szene gefunden: " + string.Join(", ", missingControllers)); + Debug.Log("The following controllers were not found in the scene: " + string.Join(", ", missingControllers)); } } @@ -141,6 +145,18 @@ namespace TeachR.WebCommunication { InboundStack.Add(new Msg { type = arg1, payload = arg2 }); Debug.Log($"[DEBUG] handle incomming message: {arg1} payload: {arg2}"); + if (arg1.Equals("configurationParameters")) + { + Debug.Log($"[DEBUG] received configuration parameters: {arg2}"); + } + else if (arg1.Equals("dataCollectionParameters")) + { + Debug.Log($"[DEBUG] received data collection parameters: {arg2}"); + } + else if (arg1.Equals("speechtoolParameters")) + { + Debug.Log($"[DEBUG] received speechtool parameters: {arg2}"); + } } private static void RunEventLoop() diff --git a/Packages/vr.teachr.webcommunication/Runtime/Scripts/ControllerManager.cs b/Packages/vr.teachr.webcommunication/Runtime/Scripts/ControllerManager.cs index 70ffb1256..fc09e99e1 100644 --- a/Packages/vr.teachr.webcommunication/Runtime/Scripts/ControllerManager.cs +++ b/Packages/vr.teachr.webcommunication/Runtime/Scripts/ControllerManager.cs @@ -41,11 +41,9 @@ namespace TeachR.WebCommunication private Task Init() { controllerGameObjects.Add(new ControllerScriptEntry("ImpulseController", impulseController)); - //controllerGameObjects.Add(new ControllerScriptEntry("BehaviourController", behaviourController)); controllerGameObjects.Add(new ControllerScriptEntry("ScenarioController", scenarioController)); controllerGameObjects.Add(new ControllerScriptEntry("SpeechToolsController", speechToolsController)); controllerGameObjects.Add(new ControllerScriptEntry("LabController", labController)); - //controllerGameObjects.Add(new ControllerScriptEntry(" ", ToAddMoreScriptsController)); RegisterAvailableControllersHandler(CheckControllerStatus); -- GitLab