From 689f7030e4d2a5ef98721f05efb9a40444a6f2df Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Mon, 19 Oct 2020 12:20:26 +0200 Subject: [PATCH] added displaying of last doctor message in vr scene --- ClientApp/Utils/Client.cs | 3 +++ ClientApp/Utils/EngineConnection.cs | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ClientApp/Utils/Client.cs b/ClientApp/Utils/Client.cs index 21bcf83..f02d55c 100644 --- a/ClientApp/Utils/Client.cs +++ b/ClientApp/Utils/Client.cs @@ -163,6 +163,9 @@ namespace ClientApp.Utils sendMessage(DataParser.getSetResistanceResponseJson(true)); } break; + case DataParser.MESSAGE: + engineConnection.DoctorMessage = DataParser.getChatMessageFromJson(payloadbytes); + break; default: Console.WriteLine($"Received json with identifier {identifier}:\n{Encoding.ASCII.GetString(payloadbytes)}"); break; diff --git a/ClientApp/Utils/EngineConnection.cs b/ClientApp/Utils/EngineConnection.cs index c852058..4fe35a3 100644 --- a/ClientApp/Utils/EngineConnection.cs +++ b/ClientApp/Utils/EngineConnection.cs @@ -43,8 +43,8 @@ namespace ClientApp.Utils private static string headId = string.Empty; private static string groundPlaneId = string.Empty; private static string terrainId = string.Empty; - private static string lastMessage = "No message received yet"; + public string DoctorMessage { get; set; }; public float BikeSpeed { get; set; } public float BikePower { get; set; } public float BikeBPM { get; set; } @@ -65,6 +65,7 @@ namespace ClientApp.Utils BikePower = 0; BikeBPM = 0; BikeResistance = 50; + DoctorMessage = "No message received yet"; updateTimer = new System.Timers.Timer(1000); updateTimer.Elapsed += UpdateTimer_Elapsed; updateTimer.AutoReset = true; @@ -324,7 +325,7 @@ namespace ClientApp.Utils { // TODO check if is drawn }); - SendMessageAndOnResponse(mainCommand.showMessage(panelId, "message", lastMessage), "message", + SendMessageAndOnResponse(mainCommand.showMessage(panelId, "message", DoctorMessage), "message", (message) => { // TODO check if is drawn