Esempio n. 1
0
        protected void testReceiveMsg()
        {
            ClientBuffer pDataBuffer = new ClientBuffer();
            stAddBattleCardPropertyUserCmd pCmd = new stAddBattleCardPropertyUserCmd();

            for (int idx = 0; idx < 6; ++idx)
            {
                Ctx.m_instance.m_logSys.log(string.Format("接收缓冲区测试索引 {0}", idx));

                pDataBuffer.sendData.clear();
                pCmd.serialize(pDataBuffer.sendData);
                pDataBuffer.send();
                pDataBuffer.getSocketSendData();
                pDataBuffer.dynBuff.size = pDataBuffer.sendBuffer.length;
                Array.Copy(pDataBuffer.sendBuffer.dynBuff.buff, 0, pDataBuffer.dynBuff.buff, 0, pDataBuffer.sendBuffer.length);
                pDataBuffer.moveDyn2Raw();
                pDataBuffer.moveRaw2Msg();
            }

            Ctx.m_instance.m_logSys.log(string.Format("接收缓冲区测试索引 {0}", 6));

            stRetRemoveBattleCardUserCmd pCmd_1 = new stRetRemoveBattleCardUserCmd();

            pDataBuffer.sendData.clear();
            pCmd_1.serialize(pDataBuffer.sendData);
            pDataBuffer.send();
            pDataBuffer.getSocketSendData();
            pDataBuffer.dynBuff.size = pDataBuffer.sendBuffer.length;
            Array.Copy(pDataBuffer.sendBuffer.dynBuff.buff, 0, pDataBuffer.dynBuff.buff, 0, pDataBuffer.sendBuffer.length);
            pDataBuffer.moveDyn2Raw();
            pDataBuffer.moveRaw2Msg();

            for (int idx = 7; idx < 13; ++idx)
            {
                Ctx.m_instance.m_logSys.log(string.Format("接收缓冲区测试索引 {0}", idx));

                pDataBuffer.sendData.clear();
                pCmd.serialize(pDataBuffer.sendData);
                pDataBuffer.send();
                pDataBuffer.getSocketSendData();
                pDataBuffer.dynBuff.size = pDataBuffer.sendBuffer.length;
                Array.Copy(pDataBuffer.sendBuffer.dynBuff.buff, 0, pDataBuffer.dynBuff.buff, 0, pDataBuffer.sendBuffer.length);
                pDataBuffer.moveDyn2Raw();
                pDataBuffer.moveRaw2Msg();
            }

            Ctx.m_instance.m_netDispList.clearOneRevMsg();
            Ctx.m_instance.m_netDispList.clearOneHandleMsg();
        }
Esempio n. 2
0
 protected void testMsg()
 {
     stAddBattleCardPropertyUserCmd cmd = new stAddBattleCardPropertyUserCmd();
     //cmd.attackType = 2;
     //cmd.pAttThisID = 0;
     //cmd.pDefThisID = 0;
     UtilMsg.sendMsg(cmd);
 }
        // 添加一个卡牌
        protected void psstAddBattleCardPropertyUserCmd(ByteBuffer bu)
        {
            stAddBattleCardPropertyUserCmd cmd = new stAddBattleCardPropertyUserCmd();
            cmd.derialize(bu);

            Ctx.m_instance.m_logSys.log(string.Format("添加一个卡牌 thisid: {0}", cmd.mobject.qwThisID));

            if (cmd.byActionType == 1)
            {
                // 填充数据
                cmd.sceneItem = Ctx.m_instance.m_dataPlayer.m_dzData.m_playerArr[cmd.who - 1].createCardItemBySvrData((EnDZPlayer)(cmd.who - 1), cmd.mobject);
                Ctx.m_instance.m_dataPlayer.m_dzData.m_playerArr[cmd.who - 1].addOneSceneCard(cmd.sceneItem);       // 添加数据
            }
            else
            {
                cmd.sceneItem = Ctx.m_instance.m_dataPlayer.m_dzData.m_playerArr[cmd.who - 1].updateCardInfoByCardItem(cmd.mobject);
            }

            if (cmd.sceneItem != null)      // 更新或者添加都需要这个数据必须存在
            {
                UISceneDZ uiDZ = Ctx.m_instance.m_uiSceneMgr.getSceneUI<UISceneDZ>(UISceneFormID.eUISceneDZ);
                if (uiDZ != null && uiDZ.isVisible())
                {
                    uiDZ.psstAddBattleCardPropertyUserCmd(cmd);
                }
            }
        }
Esempio n. 4
0
 public void psstAddBattleCardPropertyUserCmd(stAddBattleCardPropertyUserCmd msg)
 {
     m_sceneDZData.m_sceneDZAreaArr[msg.who - 1].psstAddBattleCardPropertyUserCmd(msg);
 }
Esempio n. 5
0
 // 添加卡牌不包括 CardArea.CARDCELLTYPE_COMMON 区域, enemy 对方出牌也是这个消息
 public void psstAddBattleCardPropertyUserCmd(stAddBattleCardPropertyUserCmd msg)
 {
     if (msg.byActionType == 1)
     {
         addSceneCardByItem(msg.sceneItem);
     }
     else        // 更新卡牌数据
     {
         updateSceneCardByItem(msg.sceneItem);
     }
 }