Ejemplo n.º 1
0
 public virtual void WriteToStreamDelta(Stream stream, Attack previous)
 {
     if (previous == null)
     {
         Attack.Serialize(stream, this);
         return;
     }
     Attack.SerializeDelta(stream, this, previous);
 }
Ejemplo n.º 2
0
 public static byte[] SerializeToBytes(Attack instance)
 {
     byte[] array;
     using (MemoryStream memoryStream = new MemoryStream())
     {
         Attack.Serialize(memoryStream, instance);
         array = memoryStream.ToArray();
     }
     return(array);
 }
Ejemplo n.º 3
0
        public static void Serialize(Stream stream, PlayerAttack instance)
        {
            MemoryStream memoryStream = Pool.Get <MemoryStream>();

            if (instance.attack == null)
            {
                throw new ArgumentNullException("attack", "Required by proto specification.");
            }
            stream.WriteByte(10);
            memoryStream.SetLength((long)0);
            Attack.Serialize(memoryStream, instance.attack);
            uint length = (uint)memoryStream.Length;

            ProtocolParser.WriteUInt32(stream, length);
            stream.Write(memoryStream.GetBuffer(), 0, (int)length);
            stream.WriteByte(16);
            ProtocolParser.WriteUInt64(stream, (ulong)instance.projectileID);
            Pool.FreeMemoryStream(ref memoryStream);
        }
Ejemplo n.º 4
0
 public virtual void WriteToStream(Stream stream)
 {
     Attack.Serialize(stream, this);
 }
Ejemplo n.º 5
0
 public void ToProto(Stream stream)
 {
     Attack.Serialize(stream, this);
 }