Skip to content
Snippets Groups Projects
Commit 992faafc authored by AevaMorigi's avatar AevaMorigi
Browse files

removed debug messages, fixed noiseValue processing

parent 3e604138
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
......@@ -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)
......
......@@ -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"))
{
......
......@@ -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
......@@ -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;
}
}
......
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])
}
}
......
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment