fix for displaying things on vr scene
This commit is contained in:
@@ -50,9 +50,14 @@ namespace Client
|
||||
Console.WriteLine("-- Could not connect to the VR engine. Please make sure you are running the simulation!");
|
||||
Console.WriteLine("-- Press ENTER to retry connecting to the VR engine.");
|
||||
Console.WriteLine("-- Press 'q' and then ENTER to not connect to the VR engine");
|
||||
Console.WriteLine(Console.Read());
|
||||
|
||||
engineConnection.CreateConnection();
|
||||
string input = Console.ReadLine();
|
||||
if (input == string.Empty) engineConnection.CreateConnection();
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Skipping connecting to VR engine...");
|
||||
engineConnection.Stop();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void engineConnected()
|
||||
|
||||
@@ -110,16 +110,6 @@ namespace Client
|
||||
|
||||
WriteTextMessage(tunnelCreate);
|
||||
|
||||
// wait until we have a tunnel id
|
||||
//while (tunnelId == string.Empty) { }
|
||||
//if (tunnelId != null)
|
||||
//{
|
||||
// Write("got tunnel id! " + tunnelId);
|
||||
// Connected = true;
|
||||
// OnSuccessFullConnection?.Invoke();
|
||||
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -201,26 +191,13 @@ namespace Client
|
||||
SendMessageAndOnResponse(mainCommand.addPanel("panelAdd", bikeId), "panelAdd",
|
||||
(message) =>
|
||||
{
|
||||
|
||||
|
||||
panelId = JSONParser.getPanelID(message);
|
||||
WriteTextMessage(mainCommand.ColorPanel(panelId));
|
||||
WriteTextMessage(mainCommand.ClearPanel(panelId));
|
||||
|
||||
|
||||
SendMessageAndOnResponse(mainCommand.MoveTo(panelId, "panelMove", new float[] { 0f, 0f, 0f }, "Z", 1, 5), "panelMove",
|
||||
(message) =>
|
||||
{
|
||||
Console.WriteLine(message);
|
||||
|
||||
SendMessageAndOnResponse(mainCommand.bikeSpeed(panelId, "bikeSpeed", 5.0), "bikeSpeed",
|
||||
(message) =>
|
||||
{
|
||||
WriteTextMessage(mainCommand.SwapPanel(panelId));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//while (!(speedReplied && moveReplied)) { }
|
||||
showPanel(mainCommand, 5.3, 83, 52, 53);
|
||||
|
||||
while (cameraId == string.Empty) { }
|
||||
SetFollowSpeed(5.0f);
|
||||
@@ -228,6 +205,34 @@ namespace Client
|
||||
});
|
||||
}
|
||||
|
||||
private void showPanel(Command mainCommand, double bikeSpeed, int bpm, int power, int resistance)
|
||||
{
|
||||
SendMessageAndOnResponse(mainCommand.showBikespeed(panelId, "bikeSpeed", bikeSpeed), "bikeSpeed",
|
||||
(message) =>
|
||||
{
|
||||
// TODO check if is drawn
|
||||
});
|
||||
SendMessageAndOnResponse(mainCommand.showHeartrate(panelId, "bpm", bpm), "bpm",
|
||||
(message) =>
|
||||
{
|
||||
// TODO check if is drawn
|
||||
});
|
||||
SendMessageAndOnResponse(mainCommand.showPower(panelId, "power", power), "power",
|
||||
(message) =>
|
||||
{
|
||||
// TODO check if is drawn
|
||||
});
|
||||
SendMessageAndOnResponse(mainCommand.showResistance(panelId, "resistance", resistance), "resistance",
|
||||
(message) =>
|
||||
{
|
||||
// TODO check if is drawn
|
||||
});
|
||||
|
||||
// Check if every text is drawn!
|
||||
|
||||
WriteTextMessage(mainCommand.SwapPanel(panelId));
|
||||
}
|
||||
|
||||
private void SetFollowSpeed(float speed)
|
||||
{
|
||||
WriteTextMessage(mainCommand.RouteFollow(routeId, bikeId, speed, new float[] { 0, -(float)Math.PI / 2f, 0 }, new float[] { 0, 0, 0 }));
|
||||
@@ -270,6 +275,12 @@ namespace Client
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
serverResponseReader.Stop();
|
||||
|
||||
}
|
||||
public void Write(string msg)
|
||||
{
|
||||
Console.WriteLine( "[ENGINECONNECT] " + msg);
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user