[ADDED] canvas data sending to the server works, but not fully yet to all the clients

This commit is contained in:
Lars
2020-10-21 23:18:37 +02:00
parent 61577e0df7
commit 8190724f77
7 changed files with 74 additions and 11 deletions

View File

@@ -83,6 +83,7 @@ namespace SharedClientServer
});
}
public static byte[] ConstructLobbyJoinMessage(int lobbyID)
{
return GetMessageToSend(LOBBY, new
@@ -140,6 +141,24 @@ namespace SharedClientServer
#endregion
public static byte[] ConstructCanvasDataSend(double[] coordinates)
{
return GetMessageToSend(CANVAS, new
{
coordinatesLine = coordinates
}); ;
}
public static double[] getCoordinates(byte[] payload)
{
dynamic payloadD = JsonConvert.DeserializeObject(Encoding.ASCII.GetString(payload));
JArray coordinatesArray = payloadD.coordinatesLine;
double[] coordinates = coordinatesArray.ToObject<double[]>();
return coordinates;
}
/// <summary>
/// constructs a message that can be sent to the clients or server
/// </summary>