public static void Serialize(Stream stream, PlayerProjectileAttack instance) { MemoryStream memoryStream = Pool.Get <MemoryStream>(); if (instance.playerAttack == null) { throw new ArgumentNullException("playerAttack", "Required by proto specification."); } stream.WriteByte(10); memoryStream.SetLength((long)0); PlayerAttack.Serialize(memoryStream, instance.playerAttack); uint length = (uint)memoryStream.Length; ProtocolParser.WriteUInt32(stream, length); stream.Write(memoryStream.GetBuffer(), 0, (int)length); stream.WriteByte(18); memoryStream.SetLength((long)0); Vector3Serialized.Serialize(memoryStream, instance.hitVelocity); uint num = (uint)memoryStream.Length; ProtocolParser.WriteUInt32(stream, num); stream.Write(memoryStream.GetBuffer(), 0, (int)num); stream.WriteByte(29); ProtocolParser.WriteSingle(stream, instance.hitDistance); stream.WriteByte(37); ProtocolParser.WriteSingle(stream, instance.travelTime); Pool.FreeMemoryStream(ref memoryStream); }
public virtual void WriteToStreamDelta(Stream stream, PlayerAttack previous) { if (previous == null) { PlayerAttack.Serialize(stream, this); return; } PlayerAttack.SerializeDelta(stream, this, previous); }
public static byte[] SerializeToBytes(PlayerAttack instance) { byte[] array; using (MemoryStream memoryStream = new MemoryStream()) { PlayerAttack.Serialize(memoryStream, instance); array = memoryStream.ToArray(); } return(array); }
public virtual void WriteToStream(Stream stream) { PlayerAttack.Serialize(stream, this); }
public void ToProto(Stream stream) { PlayerAttack.Serialize(stream, this); }