fix for displaying things on vr scene

This commit is contained in:
Sem van der Hoeven
2020-10-07 16:06:16 +02:00
parent 651a44762b
commit 847fa68acb
3 changed files with 56 additions and 30 deletions

View File

@@ -9,6 +9,8 @@ namespace RH_Engine
public class ServerResponseReader
{
private bool running;
private Thread t;
public OnResponse callback
{
get; set;
@@ -23,7 +25,7 @@ namespace RH_Engine
public void StartRead()
{
Thread t = new Thread(() =>
t = new Thread(() =>
{
if (this.callback == null)
{
@@ -31,8 +33,9 @@ namespace RH_Engine
}
else
{
running = true;
Console.WriteLine("[SERVERRESPONSEREADER] Starting loop for reading");
while (true)
while (running)
{
string res = ReadPrefMessage(Stream);
//Console.WriteLine("[SERVERRESPONSEREADER] got message from server: " + res);
@@ -44,6 +47,13 @@ namespace RH_Engine
t.Start();
}
public void Stop()
{
running = false;
t.Join();
Stream.Close();
}
/// <summary>
/// reads a response from the server
/// </summary>