add scene/get and progress on node/delete

This commit is contained in:
Sem van der Hoeven
2020-09-18 11:50:47 +02:00
parent 4782ecf53a
commit 7c7b64094b
2 changed files with 78 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Net.Sockets;
@@ -23,7 +24,7 @@ namespace RH_Engine
TcpClient client = new TcpClient("145.48.6.10", 6666);
CreateConnection(client.GetStream());
Console.Read();
}
@@ -86,9 +87,18 @@ namespace RH_Engine
}
CreateGraphics createGraphics = new CreateGraphics(tunnelID);
string command = createGraphics.SkyboxCommand(2);
//int[] heigths = new int[65536];
//for(int i =0; i < heigths.Length; i++)
//{
// heigths[i] = 0;
//}
//string command = createGraphics.TerrainCommand(new int[] { 256, 256 }, heigths);
string groundId = GetId("GroundPlane", stream, createGraphics);
Console.WriteLine(groundId);
string command = createGraphics.DeleteGroundPaneCommand(groundId);
//string command = createGraphics.ResetScene();
Console.WriteLine("tunnelID is: " + tunnelID);
WriteTextMessage(stream, command);
@@ -96,6 +106,24 @@ namespace RH_Engine
Console.WriteLine(ReadPrefMessage(stream));
}
public static string GetId(string name, NetworkStream stream, CreateGraphics createGraphics)
{
WriteTextMessage(stream, createGraphics.GetSceneInfoCommand());
dynamic response = JsonConvert.DeserializeObject(ReadPrefMessage(stream));
dynamic[] children = response.data.data.data.children;
foreach (dynamic child in children)
{
if (child.name == name)
{
return child.uuid;
}
}
return null;
}
}