// For generic packets like tile updates public void Broadcast(NewPackets.PacketType ofType, byte[] packet) { packet = NewPackets.AppendTypeHeader(ofType, packet); countBytes += packet.Length; GameServer.Broadcast(packet); }
public void Send(NewPackets.PacketType ofType, byte[] packet, ConnectedClient client) { packet = NewPackets.AppendTypeHeader(ofType, packet); countBytes += packet.Length; GameServer.Send(client, packet); }
public void AddCallback(NewPackets.PacketType type, Action <byte[]> callback) { if (!_packetCallbacks.ContainsKey(type)) { _packetCallbacks.Add(type, callback); } else { _packetCallbacks[type] += callback; } }
public void Send(byte[] packet, NewPackets.PacketType type, byte from) { packet = NewPackets.AppendByteHeader(from, packet); packet = NewPackets.AppendTypeHeader(type, packet); Client.Send(packet); }