diff --git a/Packages/vr.teachr.applicationmanager/Runtime/EventLogger/Scripts/EventLogger.cs b/Packages/vr.teachr.applicationmanager/Runtime/EventLogger/Scripts/EventLogger.cs index 2841f188e48575d5251e1fedeea7eee0bbb06b73..115b795d21596d0f8e595b443e0a23f72b302d97 100644 --- a/Packages/vr.teachr.applicationmanager/Runtime/EventLogger/Scripts/EventLogger.cs +++ b/Packages/vr.teachr.applicationmanager/Runtime/EventLogger/Scripts/EventLogger.cs @@ -279,7 +279,6 @@ namespace TeachR.ApplicationManager public string GetScriptInfoListAsJson() { string json = JsonConvert.SerializeObject(scriptInfoList, Formatting.Indented); - Debug.Log($"[Data] Sending scriptInfoList JSON: {json}"); return json; } diff --git a/Packages/vr.teachr.applicationmanager/Runtime/Scripts/MenuDataHolder.cs b/Packages/vr.teachr.applicationmanager/Runtime/Scripts/MenuDataHolder.cs index f584802ce242da2c719d9127eac06e746437b3d7..92012f7f7f3acc81a37bbbaf2de0b7c9a7090114 100644 --- a/Packages/vr.teachr.applicationmanager/Runtime/Scripts/MenuDataHolder.cs +++ b/Packages/vr.teachr.applicationmanager/Runtime/Scripts/MenuDataHolder.cs @@ -135,13 +135,11 @@ namespace TeachR.ApplicationManager [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] private static void BeforeSceneLoad() { - Debug.Log($"[MenuDataHolder] BeforeSceneLoad"); SceneController.OnDoneLoadScene += NewSceneLoaded; } private static void NewSceneLoaded(object sender, SceneControllerEventArgs sceneControllerEventArgs) { - Debug.Log($"[MenuDataHolder] NewSceneLoaded sender: {sender}"); BuildScenes newScene = sceneControllerEventArgs.Scene; if (newScene == BuildScenes.PreviewRooms) return; @@ -168,8 +166,6 @@ namespace TeachR.ApplicationManager students = StudentCount }; SetMeasures(classChange, newScene); - - Debug.Log($"[MenuDataHolder] classChange students: {StudentCount}"); } public static void SetMeasures(ClassChange room, BuildScenes chosenScene) diff --git a/Packages/vr.teachr.atmosphere/Runtime/Scripts/AmbientSound.cs b/Packages/vr.teachr.atmosphere/Runtime/Scripts/AmbientSound.cs index 35c2ff50c24c483691b062f74a8cf2a48f8e91da..ba4780a87ef2cbbba5ecf720250a23a0a8901f26 100644 --- a/Packages/vr.teachr.atmosphere/Runtime/Scripts/AmbientSound.cs +++ b/Packages/vr.teachr.atmosphere/Runtime/Scripts/AmbientSound.cs @@ -4,8 +4,6 @@ using UnityEngine; using UnityEngine.Assertions; using System.Threading.Tasks; using System; -using System.Collections; -using System.Linq; #if UNITY_EDITOR using UnityEditor; @@ -87,7 +85,17 @@ namespace TeachR.Atmosphere public Task WebsocketInit() { - CoachRtc.Transient.On("changeNoiseLevel", json => SoundLevel(json.GetValue<int>())); + CoachRtc.Transient.On("changeNoiseLevel", json => + { + var data = json.ToDict<int>(); + if (data.ContainsKey("noiseLevel")) + { + int noiseIndex = (int)data["noiseLevel"]; + SoundLevel(noiseIndex, true); + } + else + Debug.LogError("Received changeNoiseLevel message without noiseLevel key!"); + }); return Task.CompletedTask; } @@ -108,7 +116,7 @@ namespace TeachR.Atmosphere SoundLevel(ac.level); } - public void SoundLevel(int soundLevel) + public void SoundLevel(int soundLevel, bool setByWebsite = false) { Assert.IsTrue(soundLevel >= 0 && soundLevel <= NoiseLevels.Length); @@ -117,7 +125,8 @@ namespace TeachR.Atmosphere source.volume = NoiseLevels[CurrentNoiseLevel]; source.clip = ClassAmbient(CurrentNoiseLevel); - CoachRtc.Send("setVolumeByUnity", CurrentNoiseLevel); // ToDo: rename to setNoiseByUnity + if(!setByWebsite) + CoachRtc.Send("setNoiseByUnity", CurrentNoiseLevel); LogData($"{DateTime.Now.ToString(DateTimeFormat)};{source.clip?.name};{CurrentNoiseLevel}"); // Only play a clip from the start if it was actually changed (avoid obvious cutoff/looping) @@ -153,8 +162,6 @@ namespace TeachR.Atmosphere EditorGUILayout.LabelField("Change Noiselevel:"); AmbientSound ambientSound = (AmbientSound)target; - //EditorGUILayout.LabelField($"CurrentNoiseLevel: {AmbientSound.CurrentNoiseLevel}"); - //EditorGUILayout.LabelField($"current noiseLevel: {noiseLevel}"); if (GUILayout.Button("louder")) { diff --git a/Packages/vr.teachr.structuretree/Runtime/Scripts/StructureTreeController.cs b/Packages/vr.teachr.structuretree/Runtime/Scripts/StructureTreeController.cs index 888e7daacfd0d46144991f51ba3e71dd4b6c4f0b..8e8842cf02e397b85fe887e571d5cc585af0d21b 100644 --- a/Packages/vr.teachr.structuretree/Runtime/Scripts/StructureTreeController.cs +++ b/Packages/vr.teachr.structuretree/Runtime/Scripts/StructureTreeController.cs @@ -9,8 +9,6 @@ using TeachR.WebCommunication; using System.Threading.Tasks; using System.IO; - - #if UNITY_EDITOR using UnityEditor; #endif @@ -49,7 +47,6 @@ namespace TeachR.StructureTree EventLoggingInit(); } - /// <summary> /// Clear all hooks. /// </summary> @@ -59,7 +56,6 @@ namespace TeachR.StructureTree InitGlobals.WebsocketInitHook -= WebInit; } - /// <summary> /// Prepare data collection. /// </summary> @@ -69,7 +65,6 @@ namespace TeachR.StructureTree $"{DateTime.Now.ToString(DateTimeFormat)};-;-;-;-"); } - /// <summary> /// Sets Poster and Lessondraft active. /// </summary> @@ -221,4 +216,4 @@ namespace TeachR.StructureTree } } #endif -} +} \ No newline at end of file diff --git a/Packages/vr.teachr.students/Runtime/WholeClass/Scripts/ClassInfo.cs b/Packages/vr.teachr.students/Runtime/WholeClass/Scripts/ClassInfo.cs index 86853f31a513f51eec5c5dd49a97f60ad6f119ae..cac56b348bfc3d08561e952542e53ccb9fb17e5c 100644 --- a/Packages/vr.teachr.students/Runtime/WholeClass/Scripts/ClassInfo.cs +++ b/Packages/vr.teachr.students/Runtime/WholeClass/Scripts/ClassInfo.cs @@ -22,7 +22,6 @@ namespace TeachR.Student { // ReSharper disable Unity.PerformanceAnalysis (rarely called) private static BootstrapData FromClass() { - Debug.Log("BootstrapData FromClass()"); System.Collections.Generic.List<StudentDataClass> res = Object.FindObjectsByType<StudentController>( FindObjectsInactive.Exclude, FindObjectsSortMode.None) .Select(s => new StudentDataClass(s)).ToList(); @@ -35,11 +34,8 @@ namespace TeachR.Student { femaleQuestions = SoundLoader.FemaleQuestionClips, scene = SceneController.LastLoadedScene.ToString(), weather = "sunny", - //behaviors = disturbanceManager?.Disturbances }; - Debug.Log($"bootstrap: noise: {request.noiseLevel}, studentData: {request.students.Count}"); - return request; } } diff --git a/Packages/vr.teachr.webcommunication/Runtime/Scripts/CoachRtc.cs b/Packages/vr.teachr.webcommunication/Runtime/Scripts/CoachRtc.cs index 0400803c8a3154bf839f207f14bcabd0c6cc38af..4d0c719013c8e56607603d018c5d181aa5de8eff 100644 --- a/Packages/vr.teachr.webcommunication/Runtime/Scripts/CoachRtc.cs +++ b/Packages/vr.teachr.webcommunication/Runtime/Scripts/CoachRtc.cs @@ -1,3 +1,4 @@ +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -5,7 +6,6 @@ using System.Net; using System.Threading.Tasks; using TeachR.ApplicationManager; using UnityEngine; -using UnityEngine.Events; namespace TeachR.WebCommunication { @@ -25,10 +25,6 @@ namespace TeachR.WebCommunication private static readonly List<Msg> InboundStack = new(); public static bool Active { get; private set; } - //private static UnityEvent configurationEvent; - //private static UnityEvent speechtoolEvent; - public static Action<List<ScriptInfo>> OnScriptInfoListChanged; - /// <summary> /// Listener for transient events, i.e. events that are specific to a current scene and that are reset after @@ -62,13 +58,13 @@ namespace TeachR.WebCommunication } /// <summary> - /// This function is used to query from Unity whether the web app provides certain functions. + /// This function is used to request from Unity whether the web app provides certain functions. /// </summary> private static void CheckFunctionAvailability() { List<string> functionsToCheck = new List<string> { "behave", - "behavesfdsfdsfsfdsfd", + "behavesfdsfdsfsfdsfd", // test-value, expected to be false "bootstrap", "disturbanceScores", "highlight", @@ -104,7 +100,7 @@ namespace TeachR.WebCommunication private static void HandleFunctionCheckResult(JsonMsg msg) { - Debug.Log($"[Debug] Function check result received: {msg.content} DoTo: Do something with this information"); + Debug.Log($"[Debug] Function check result received. DoTo: Do something with this information. Data: {msg.content}"); } private static void HandleScriptInfoListRequest(JsonMsg msg) @@ -203,18 +199,20 @@ namespace TeachR.WebCommunication private static void HandleMessage(string arg1, string arg2) { InboundStack.Add(new Msg { type = arg1, payload = arg2 }); - Debug.Log($"[DEBUG] handle incomming message: {arg1} payload: {arg2}"); + //Debug.Log($"[DEBUG] handle incomming message: {arg1} payload: {arg2}"); if (arg1.Equals("configurationParameters")) { - Debug.Log($"[CONFIG] received configuration parameters: {arg2} type: {arg2.GetType()}"); - MenuDataHolder.StudentCount = 4; - MenuDataHolder.IsPresentation = false; - MenuDataHolder.LevelOfMisbehavior = 2; - MenuDataHolder.IsAutomaticIntervention = false; + Debug.Log($"[ToDo] handle incomming message: {arg1} payload: {arg2}. These parameters currently have no effect."); + var json = JObject.Parse(arg2); + MenuDataHolder.StudentCount = (int)json["numStudents"]; + MenuDataHolder.LevelOfMisbehavior = (int)json["disorderLevel"]; + MenuDataHolder.IsPresentation = ((string)json["startingSituation"]).Equals("seatwork"); + MenuDataHolder.IsAutomaticIntervention = !((string)json["interventionControl"]).Equals("manually"); } else if (arg1.Equals("speechtoolParameters")) { - Debug.Log($"[DEBUG] received speechtool parameters: {arg2}"); + Debug.Log($"[ToDo] received speechtool parameters: {arg2}. This parameter currently has no effect."); + // ToDo: Use parameter (enableSpeechtools [bool]) } } diff --git a/Packages/vr.teachr.webcommunication/Runtime/Scripts/ControllerManager.cs b/Packages/vr.teachr.webcommunication/Runtime/Scripts/ControllerManager.cs index fc09e99e1192e03619cc56435cefc08970618baa..9434e792d444df0c13ff5b77354183ef41ccef93 100644 --- a/Packages/vr.teachr.webcommunication/Runtime/Scripts/ControllerManager.cs +++ b/Packages/vr.teachr.webcommunication/Runtime/Scripts/ControllerManager.cs @@ -52,8 +52,6 @@ namespace TeachR.WebCommunication private void RegisterAvailableControllersHandler(Action<JsonMsg> handler) { - //website can send "askForControllerAvailability" - Debug.Log($"Website asks for controllers"); CoachRtc.Persistent.On("askForControllerAvailability", handler); } @@ -69,7 +67,6 @@ namespace TeachR.WebCommunication available = controller.available }) }; - Debug.Log($"SendControllerStatus() {controllerGameObjects.ToArray()}"); CoachRtc.Send("receiveControllerAvailability", payload); }