conflicts 3: revelations

This commit is contained in:
Sem van der Hoeven
2020-09-18 16:01:25 +02:00
2 changed files with 53 additions and 7 deletions

View File

@@ -61,9 +61,9 @@ namespace RH_Engine
dynamic payload = new
{
id = "scene/terrain/update",
data = new
data = new
{
}
};
return JsonConvert.SerializeObject(Payload(payload));
@@ -89,7 +89,7 @@ namespace RH_Engine
return JsonConvert.SerializeObject(Payload(payload));
}
public string DeleteGroundPaneCommand(string uuid)
public string DeleteNode(string uuid)
{
dynamic payload = new
@@ -108,15 +108,20 @@ namespace RH_Engine
public string AddBikeModel()
{
return AddModel("bike", "data\\NetworkEngine\\models\\bike\\bike.fbx", null);
return AddModel("bike", "data\\NetworkEngine\\models\\bike\\bike.fbx");
}
public string AddModel(string nodeName, string fileLocation)
{
return AddModel(nodeName, fileLocation, null);
return AddModel(nodeName, fileLocation, null, new float[] { 0, 0, 0 }, 1, new float[] { 0, 0, 0 });
}
public string AddModel(string nodeName, string fileLocation, string animationLocation)
public string AddModel(string nodeName, string fileLocation, float[] positionVector, float scalar, float[] rotationVector)
{
return AddModel(nodeName, fileLocation, null, positionVector, scalar, rotationVector);
}
public string AddModel(string nodeName, string fileLocation, string animationLocation, float[] positionVector, float scalar, float[] rotationVector)
{
string namename = nodeName;
bool animatedBool = false;
@@ -133,6 +138,13 @@ namespace RH_Engine
name = namename,
components = new
{
transform = new
{
position = positionVector,
scale = scalar,
rotation = rotationVector
},
model = new
{
file = fileLocation,
@@ -147,6 +159,31 @@ namespace RH_Engine
return JsonConvert.SerializeObject(Payload(payload));
}
public string MoveTo(string uuid, float[] positionVector, float rotateValue, float speedValue, float timeValue)
{
return MoveTo(uuid, "idk", positionVector, rotateValue, "linear", false, speedValue, timeValue);
}
private string MoveTo(string uuid, string stopValue, float[] positionVector, float rotateValue, string interpolateValue, bool followHeightValue, float speedValue, float timeValue)
{
dynamic payload = new
{
id = "scene/node/moveto",
data = new
{
id = uuid,
stop = stopValue,
position = positionVector,
rotate = rotateValue,
interpolate = interpolateValue,
followheight = followHeightValue,
speed = speedValue,
time = timeValue
}
};
return JsonConvert.SerializeObject(Payload(payload));
}
public string RouteCommand()
{
@@ -259,6 +296,7 @@ namespace RH_Engine
}
private object Payload(dynamic message)
{
return new

View File

@@ -106,8 +106,10 @@ namespace RH_Engine
WriteTextMessage(stream, createGraphics.RouteCommand());
Console.WriteLine("data: " + ReadPrefMessage(stream));
//WriteTextMessage(stream, createGraphics.GetSceneInfoCommand());
//add monkey head
//WriteTextMessage(stream, createGraphics.AddModel("Face", "data\\vrlib\\rendermodels\\face\\face.obj", new float[] { 0, 3, 0 }, 10, new float[] { 0, 0, 0 }));
//string headUuid = getUUIDFormResponse(ReadPrefMessage(stream));
//Console.WriteLine("data: " + ReadPrefMessage(stream));
}
@@ -182,6 +184,12 @@ namespace RH_Engine
}
public static string getUUIDFromResponse(string response)
{
dynamic JSON = JsonConvert.DeserializeObject(response);
return JSON.data.data.data.uuid;
}
}
/// <summary>