protected int onRecv(EventTarget e) { SocketEvent se = e as SocketEvent; Shared.XOR(se.data, se.data.Length, ConstDef.sKey); byte[] msgIdBytes = new byte[4]; Array.Copy(se.data, 0, msgIdBytes, 0, 4); int MsgId = BitConverter.ToInt32(msgIdBytes, 0);; MsgId = BinaryStream.ntohl(MsgId); //if (MsgId != (int)PACKET_ID_ENUM.ID_NetRegisterRes && MsgId != (int)PACKET_ID_ENUM.ID_NetLoginRes && PlayerManager.playerMgr.localPlayer == null) // return 1; Packet packet = sPckMgr.AllocPacket(MsgId); if (packet == null) { return(0); } BinaryStream bit = new BinaryStream(se.data); packet.deSerialize(bit); sHandler.dispatchEvent(packet.MsgID, packet); return(0); }