112 lines
2.4 KiB
C#
112 lines
2.4 KiB
C#
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Text;
|
|
|
|
namespace RH_Engine
|
|
{
|
|
class CreateGraphics
|
|
{
|
|
string tunnelID;
|
|
|
|
public CreateGraphics(string tunnelID)
|
|
{
|
|
this.tunnelID = tunnelID;
|
|
}
|
|
|
|
public string TerrainCommand(int[] sizeArray, int[] heightsArray)
|
|
{
|
|
dynamic payload = new
|
|
{
|
|
id = "scene/terrain/add",
|
|
data = new
|
|
{
|
|
size = sizeArray,
|
|
heights = heightsArray
|
|
}
|
|
|
|
};
|
|
return JsonConvert.SerializeObject(Payload(payload));
|
|
}
|
|
|
|
public string AddNodeCommand()
|
|
{
|
|
dynamic payload = new
|
|
{
|
|
id = "scene/node/add",
|
|
data = new
|
|
{
|
|
name = "newNode",
|
|
components = new
|
|
{
|
|
terrain = new
|
|
{
|
|
smoothnormals = true
|
|
}
|
|
}
|
|
}
|
|
};
|
|
return JsonConvert.SerializeObject(Payload(payload));
|
|
}
|
|
|
|
public string DeleteGroundPaneCommand()
|
|
{
|
|
return "";
|
|
}
|
|
|
|
public string ModelCommand()
|
|
{
|
|
return "";
|
|
}
|
|
|
|
public string RouteCommand()
|
|
{
|
|
return "";
|
|
}
|
|
|
|
public string FollowRouteCommand()
|
|
{
|
|
return "";
|
|
}
|
|
|
|
public string RoadCommand()
|
|
{
|
|
return "";
|
|
}
|
|
|
|
public string SkyboxCommand(double timeToSet)
|
|
{
|
|
if (timeToSet < 0 || timeToSet > 24)
|
|
{
|
|
throw new Exception("The time must be between 0 and 24!");
|
|
}
|
|
|
|
|
|
dynamic payload = new
|
|
{
|
|
id = "scene/skybox/settime",
|
|
data = new {
|
|
time = timeToSet
|
|
}
|
|
|
|
};
|
|
return JsonConvert.SerializeObject(Payload(payload));
|
|
|
|
}
|
|
|
|
private object Payload(dynamic message)
|
|
{
|
|
return new
|
|
{
|
|
id = "tunnel/send",
|
|
data = new
|
|
{
|
|
dest = tunnelID,
|
|
data = message,
|
|
}
|
|
};
|
|
}
|
|
}
|
|
}
|