public override bool SignalInputBuffer(ref byte[] recvBuff) { int msgID = (int)(recvBuff[0] << 24 | recvBuff[1] << 16 | recvBuff[2] << 8 | recvBuff[3]); Handler handler = null; _packetHandleDic.TryGetValue(msgID, out handler); if (handler == null) { return(false); } MemoryStream stream = new MemoryStream(recvBuff, 4, recvBuff.Length - 4); NetObject stObj = new NetObject(); stObj.msgID = msgID; stObj.obj = Serializer.NonGeneric.Deserialize(handler.t, stream); lock (_recvList) { _recvList.PushBack(stObj); } return(true); }
public override bool SignalInputBuffer(ref byte[] recvBuff) { int msgID = (int)(recvBuff[0] << 24 | recvBuff[1] << 16 | recvBuff[2] << 8 | recvBuff[3]); string js = System.Text.Encoding.UTF8.GetString(recvBuff, 4, recvBuff.Length - 4); JsonData stJson = JsonMapper.ToObject(js); NetObject stObj = new NetObject(); stObj.msgID = msgID; stObj.obj = stJson; Console.WriteLine("sceneprotocol SignalInputBuffer msgid " + msgID.ToString()); lock (_recvList) { _recvList.PushBack(stObj); } return(true); }