public void PutReceiveMsgToPool(byte[] recvMsg) { //Debug.Log(Encoding.UTF8.GetString(recvMsg)); //ushort id = BitConverter.ToUInt16(recvMsg, 0); //Debug.Log(id); //byte[] result = new byte[recvMsg.Length - 2]; //Buffer.BlockCopy(recvMsg, 2, result, 0, recvMsg.Length-2); //Debug.Log(Encoding.UTF8.GetString(result)); //NetMsgBase tmpNet = new NetMsgBase(id, result); //Debug.Log(string.Format("收到消息 msgid{0} 消息:{1}", id, Encoding.UTF8.GetString(tmpNet.buffer))); NetModel model = ProtoSerialize.DeSerialize(recvMsg); recvMsgPool.Enqueue(new NetMsg(model)); }
public List <byte[]> GetNetBytes() { byte[] buffer = ProtoSerialize.Serialize(model); return(NetEncode.Encode(buffer)); }