Ejemplo n.º 1
0
 public void PushQueue(short wMainCmdId, short wSubCmdId, CMD_Base_RespNtf msgBase)
 {
     lock (messageQueue)
     {
         messageQueue.Enqueue(new QueueItem(wMainCmdId, wSubCmdId, msgBase));
     }
 }
Ejemplo n.º 2
0
        public virtual CMD_Base_RespNtf CreateRespNtfMsg(CMD_Command cmd)
        {
            if (!_dictItem.ContainsKey(cmd))
            {
                return(null);
            }

            try
            {
                CMD_Base_RespNtf msg = Activator.CreateInstance(_dictItem[cmd].msgRespNtf) as CMD_Base_RespNtf;
                return(msg);
            }
            catch (System.Exception ex)
            {
                Debug.LogError("<color=red>[Error]</color>---" + "CreateRespNtfMsg 创建失败!!:" + ex.Message);
                return(null);
            }
        }
Ejemplo n.º 3
0
        override public void OnMessage(USocket us, ByteBuffer bb)
        {
            try
            {
                int   nDataSize  = bb.ReadShort();
                int   nCheckCode = bb.ReadByte();
                int   nMsgVer    = bb.ReadByte();
                short nMainId    = bb.ReadShort();
                short nSubId     = bb.ReadShort();
                Debug.Log("<color=blue>" + string.Format("Message:{0},{1},{2},{3},{4}", nDataSize, nCheckCode, nMsgVer, nMainId, nSubId) + "</color>");

                CMD_Base_RespNtf msg = _factory.CreateRespNtfMsg(new CMD_Command(nMainId, nSubId));
                if (msg != null)
                {
                    msg.Deserialize(bb, nDataSize);
                    _queue.PushQueue(nMainId, nSubId, msg);
                }
            }
            catch (System.Exception ex)
            {
                Debug.LogError("<color=red>[Error]</color>---" + "KKBaseListener.OnMessage Error:" + ex.Message);
            }
        }
Ejemplo n.º 4
0
 public QueueItem(short wMainCmdId, short wSubCmdId, CMD_Base_RespNtf msgBase, string msg = "")
 {
     _cmd     = new CMD_Command(wMainCmdId, wSubCmdId);
     _msgBase = msgBase;
     _strMsg  = msg;
 }