Example #1
0
 public void push(DkRspMsg msg)
 {
     //lock (this)
     {
         msgQueue.Enqueue(msg);
     }
 }
        virtual public void respond(proto_header head, byte[] block)
        {
            if (type != null)
            {
                ProtobufSerializer serializer = new ProtobufSerializer();
                using (MemoryStream temp = new MemoryStream(block, 0, block.Length, true, true))
                {
                    m_rec = serializer.Deserialize(temp, null, type);
                }

                if (m_rec != null)
                {
                    DkRspMsg item = new DkRspMsg();
                    item.head = head;
                    item.body = m_rec;

                    if (isMsgPushQueue)
                    {
                        DkProtoQueue.Instance.push(item);
                    }
                    else
                    {
                        onRspHandler(item);
                    }
                }
                else
                {
                    Debug.LogError("cmd " + head.shMsgID + " deserialize failed, please check !");
                }
            }
            else
            {
                Debug.LogError("cmd " + head.shMsgID + " deserialize type is null !");
            }
        }
 virtual public void onRspHandler(DkRspMsg item)
 {
 }