Beispiel #1
0
 public NetworkObjectDataPacket ToPacket()
 {
     return(new NetworkObjectDataPacket()
     {
         data = NetworkUtils.Compress(JsonConvert.SerializeObject(data))
     });
 }
Beispiel #2
0
    public static NetworkMessagePacket ToPacket(int objectID, object obj)
    {
        INetworkData message = obj as INetworkData;

        if (message != null)
        {
            message.Type = obj.GetType().Name;
        }
        return(new NetworkMessagePacket()
        {
            objectID = objectID, data = NetworkUtils.Compress(JsonConvert.SerializeObject(obj))
        });
    }