private static void MessageReceived(object sender, MessageReceivedEventArgs e) { Packet packet = new Packet(e.Data); Client client_ = FindClientByIpPort(e.IpPort); int type = packet.ReadInt(); if (type == (int)ClientPackets.ping) { ServerHandle.Ping(client_.id, packet); } else { ThreadManager.ExecuteOnMainThread(() => { byte[] packetData = e.Data; Packet _packet = new Packet(packetData); int _packetId = _packet.ReadInt(); Client client = FindClientByIpPort(e.IpPort); NetworkManager.AddPacket(client.id, _packetId, _packet); }); } }