private static void HandleDataPackets(string connectionID, byte[] data) { ByteBuffer buffer = new ByteBuffer(); DebugLog.Info("[Connection] Receiving data!"); buffer.WriteBytes(data); // Console.WriteLine(string.Join(",", data.ToList().Select(b => b.ToString()))); int packageType = buffer.ReadInteger(); int packetID = buffer.ReadInteger(); int entityId = buffer.ReadInteger(); // if (packets.TryGetValue(packetID, out Packet packet)) // { // packet.Invoke(connectionID, buffer); // } // if (packetsNew.TryGetValue(packetID, out Requestor requestor)) // requestor.Receive(buffer, connectionID); NetworkMagic.Receive(packageType, connectionID, packetID, entityId, buffer); buffer.Dispose(); }
private static void HandleDataPackets(byte[] data) { ByteBuffer buffer = new ByteBuffer(); // Debug.Log(string.Join(" ", data)); DebugLog.Info("[Connection] Receiving Data!"); buffer.WriteBytes(data); int packageType = buffer.ReadInteger(); int packetID = buffer.ReadInteger(); int entityId = buffer.ReadInteger(); // if (packets.TryGetValue(packetID, out Packet packet)) // { // packet.Invoke(buffer); // } NetworkMagic.Receive(packageType, "", packetID, entityId, buffer); // if (packetsNew.TryGetValue(packetID, out Requestor requestor)) // requestor.Receive(buffer); buffer.Dispose(); }