public void HUD(string[] bycicleData, string paneUuid) { string displayText; for (int i = 0; i < 8; i++) { switch (i) { case 0: displayText = "Pulse = " + bycicleData[0]; break; case 1: displayText = "Rpm = " + bycicleData[1]; break; case 2: displayText = "Speed = " + bycicleData[2]; break; case 3: displayText = "Distance = " + bycicleData[3]; break; case 4: displayText = "Requested power = " + bycicleData[4]; break; case 5: displayText = "Power = " + bycicleData[5]; break; case 6: displayText = "Elapsed time = " + bycicleData[6]; break; case 7: displayText = "Actual power = " + bycicleData[7]; break; default: displayText = "Error"; break; } dynamic toJson = new { id = "scene/panel/drawtext", data = new { id = paneUuid, text = displayText, position = new[] { 50 * (i / 4) + 150, 100.0 * (i % 4) + 100 }, color = new[] { 0, 0, 0, 1 } } }; vrConnector.sendJson(JObject.Parse(JsonConvert.SerializeObject(toJson))); Console.WriteLine(vrConnector.readObject()); } }
public void HUD(string[] bycicleData, string HUDUuid) { vrConnector.sendJson(bycicleClear); Thread.Sleep(50); string displayText; for (int i = 0; i < 8; i++) { switch (i) { case 0: displayText = "Pulse = " + bycicleData[0]; break; case 1: displayText = "Rpm = " + bycicleData[1]; break; case 2: displayText = "Speed = " + bycicleData[2]; break; case 3: displayText = "Distance = " + bycicleData[3]; break; case 4: displayText = "Requested power = " + bycicleData[4]; break; case 5: displayText = "Power = " + bycicleData[5]; break; case 6: displayText = "Elapsed time = " + bycicleData[6]; break; case 7: displayText = "Actual power = " + bycicleData[7]; break; default: displayText = "Error"; break; } dynamic toJsonText = new { id = "scene/panel/drawtext", data = new { id = HUDUuid, text = displayText, position = new[] { 200 * (i / 4) + 50, 100.0 * (i % 4) + 50 }, color = new[] { 0, 0, 0, 1 } } }; vrConnector.sendJson(JObject.Parse(JsonConvert.SerializeObject(toJsonText))); } vrConnector.sendJson(bycicleSwap); }
private void TimeBT_Click(object sender, EventArgs e) { float selectedTime = TimeCB.SelectedIndex; dynamic toJson = new { id = "scene/skybox/settime", data = new { time = selectedTime } }; vrConnector.sendJson(toJson); Console.WriteLine(vrConnector.readObject()); }