Merge branch 'develop' of https://github.com/SemvdH/Proftaak-RH-B4 into develop

# Conflicts:
#	RH-Engine/Program.cs
This commit is contained in:
DESKTOP-TV73FK0\woute
2020-09-18 12:32:06 +02:00
2 changed files with 104 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,8 +87,23 @@ namespace RH_Engine
}
CreateGraphics createGraphics = new CreateGraphics(tunnelID);
<<<<<<< HEAD
=======
//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("ground id: " + groundId);
string command = createGraphics.DeleteGroundPaneCommand(groundId);
//string command = createGraphics.ResetScene();
>>>>>>> 0e2ee807e147b30f2517a1be463f08da41a799fd
Console.WriteLine("tunnelID is: " + tunnelID);
WriteTextMessage(stream, createGraphics.TerrainCommand(new int[] { 2, 2 }, new int[] { 1, 1, 1, 1 }));
@@ -97,6 +113,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));
JArray children = response.data.data.data.children;
foreach (dynamic child in children)
{
if (child.name == name)
{
return child.uuid;
}
}
return null;
}
}