Ejemplo n.º 1
0
 public void Send <T>(NetPeer peer, T packet, DeliveryMethod options) where T : class, new()
 {
     _netDataWriter.Reset();
     Write(_netDataWriter, packet);
     peer.Send(_netDataWriter, options);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Serialize struct to byte array
 /// </summary>
 /// <param name="obj">Object to serialize</param>
 /// <returns>byte array with serialized data</returns>
 public byte[] Serialize <T>(T obj) where T : class, new()
 {
     _writer.Reset();
     Serialize(_writer, obj);
     return(_writer.CopyData());
 }