/// <summary> /// registers a packet /// </summary> /// <param name="opCode">Server opcode</param> /// <param name="handeler">Handeler</param> public void registerPacket(ClientOpCode opCode, PacketRegistery<ClientOpCode, ClientIncomingPacket>.handlePacket handeler, bool handleImmidiate = false) { if (handleImmidiate) { immidiateHandeler.registerPacket(opCode, handeler); } else { this.queueHandeler.registerPacket(opCode, handeler); } }
public ClientIncomingPacket(byte[] bytes) : base(bytes) { if (ClientOpcodeCheck.isOpCode(base.packetID)) { this.mOpcode = (ClientOpCode)base.packetID; } else { throw new PacketMalformedException("Invalid packet bytes data. Must atleast be 4 bytes.", this); } }
/// <summary> /// Removes a packet from the opcode list /// </summary> /// <param name="code">The opcode to remove</param> public void removePacket(ClientOpCode code) { this.processor.removePacket(code); }
/// <summary> /// Adds or replaces a packet handeler /// </summary> /// <param name="code">The Client code</param> /// <param name="packetFunction">The packet function which can handle a packet</param> public void registerPacket(ClientOpCode code, PacketRegistery<ClientOpCode, ClientIncomingPacket>.handlePacket packetFunction, bool handleImmidiate = false) { this.processor.registerPacket(code, packetFunction, handleImmidiate); }
public ServerOutgoingPacket(ClientOpCode opcode) : base((short)opcode) { mOpcode = opcode; }
/// <summary> /// Removes a packet from the packet handeler /// </summary> /// <param name="code">The opcode that is removed from the game</param> public void removePacket(ClientOpCode code) { immidiateHandeler.removePacket(code); queueHandeler.removePacket(code); }