add scene/get and progress on node/delete
This commit is contained in:
@@ -30,9 +30,21 @@ namespace RH_Engine
|
|||||||
return JsonConvert.SerializeObject(Payload(payload));
|
return JsonConvert.SerializeObject(Payload(payload));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string DeleteGroundPaneCommand()
|
public string DeleteGroundPaneCommand(string uuid)
|
||||||
{
|
{
|
||||||
return "";
|
|
||||||
|
dynamic payload = new
|
||||||
|
{
|
||||||
|
id = "scene/node/delete",
|
||||||
|
data = new
|
||||||
|
{
|
||||||
|
id = uuid,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
return JsonConvert.SerializeObject(Payload(payload));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ModelCommand()
|
public string ModelCommand()
|
||||||
@@ -42,6 +54,18 @@ namespace RH_Engine
|
|||||||
|
|
||||||
public string RouteCommand()
|
public string RouteCommand()
|
||||||
{
|
{
|
||||||
|
dynamic payload = new
|
||||||
|
{
|
||||||
|
id = "route/add",
|
||||||
|
data = new
|
||||||
|
{
|
||||||
|
nodes = new dynamic[]
|
||||||
|
{
|
||||||
|
pos = new int[]{ 0,0,0},
|
||||||
|
dir = new int[]{ 5,0,-5}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,6 +79,26 @@ namespace RH_Engine
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetSceneInfoCommand()
|
||||||
|
{
|
||||||
|
dynamic payload = new
|
||||||
|
{
|
||||||
|
id = "scene/get"
|
||||||
|
};
|
||||||
|
|
||||||
|
return JsonConvert.SerializeObject(Payload(payload));
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ResetScene()
|
||||||
|
{
|
||||||
|
dynamic payload = new
|
||||||
|
{
|
||||||
|
id = "scene/reset"
|
||||||
|
};
|
||||||
|
|
||||||
|
return JsonConvert.SerializeObject(Payload(payload));
|
||||||
|
}
|
||||||
|
|
||||||
public string SkyboxCommand(double timeToSet)
|
public string SkyboxCommand(double timeToSet)
|
||||||
{
|
{
|
||||||
if (timeToSet < 0 || timeToSet > 24)
|
if (timeToSet < 0 || timeToSet > 24)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
@@ -23,7 +24,7 @@ namespace RH_Engine
|
|||||||
TcpClient client = new TcpClient("145.48.6.10", 6666);
|
TcpClient client = new TcpClient("145.48.6.10", 6666);
|
||||||
|
|
||||||
CreateConnection(client.GetStream());
|
CreateConnection(client.GetStream());
|
||||||
Console.Read();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,9 +87,18 @@ namespace RH_Engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
CreateGraphics createGraphics = new CreateGraphics(tunnelID);
|
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);
|
Console.WriteLine("tunnelID is: " + tunnelID);
|
||||||
|
|
||||||
WriteTextMessage(stream, command);
|
WriteTextMessage(stream, command);
|
||||||
@@ -96,6 +106,24 @@ namespace RH_Engine
|
|||||||
Console.WriteLine(ReadPrefMessage(stream));
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user