/// <summary> /// Creates a <see cref="GamePacket" /> with a header, channel, and protocol. /// </summary> /// <param name="id">Id of the packet</param> /// <param name="channel">Channel</param> /// <param name="flags">Protocol to send packet</param> public GamePacket(short id, PacketChannel channel, PacketProtocolFlags flags = PacketProtocolFlags.Reliable) { packetData = new GamePacketData(id); Channel = channel; Flags = flags; }
/// <summary> /// Creates a <see cref="GamePacket" /> with the event arguements for packets. /// </summary> /// <param name="args"></param> public GamePacket(GamePacketEventArgs args) { packetData = new GamePacketData(args); Channel = args.Channel; Flags = args.ProtocolFlag; }
/// <summary> /// Creates a <see cref="GamePacket" /> from a packet. /// </summary> /// <param name="packet">Packet</param> public GamePacket(Packet packet) { packetData = new GamePacketData(packet.Id); Channel = packet.Channel; Flags = packet.Flags; }
/// <summary> /// Creates a <see cref="GamePacket" /> with the packet data. /// </summary> /// <param name="data">Bytes of the packet</param> public GamePacket(byte[] data) { packetData = new GamePacketData(data); }