protected void psstAddMobileObjectListPropertyUserCmd(ByteBuffer msg)
        {
            stAddMobileObjectListPropertyUserCmd cmd = new stAddMobileObjectListPropertyUserCmd();
            cmd.derialize(msg);

            Ctx.m_instance.m_dataPlayer.m_dataPack.psstAddMobileObjectListPropertyUserCmd(cmd.list);
        }
 public override void derialize(ByteBuffer bu)
 {
     base.derialize(bu);
     bu.readUnsignedInt32(ref qwThisID);
     bu.readUnsignedInt32(ref dwNum);
     bu.readUnsignedInt8(ref type);
 }
        protected void psstReqBuyMobileObjectPropertyUserCmd(ByteBuffer msg)
        {
            stReqBuyMobileObjectPropertyUserCmd cmd = new stReqBuyMobileObjectPropertyUserCmd();
            cmd.derialize(msg);

           //给与购买成功提示
        }
Exemple #4
0
		public bool readArchiveFileHeader(FileStream fileHandle, ByteBuffer pMByteBuffer)
		{
			pMByteBuffer.clear ();
			fileHandle.Read(pMByteBuffer.dynBuff.buff, 0, 4);
			pMByteBuffer.length = 4;
            string magic = "";
			pMByteBuffer.readMultiByte(ref magic, 4, Encoding.UTF8);
			if (magic != "asdf")		// 检查 magic
			{
				return false;
			}

			pMByteBuffer.clear ();
			fileHandle.Read(pMByteBuffer.dynBuff.buff, 0, (int)calcArchiveHeaderSizeNoFileHeader() - 4);
			pMByteBuffer.length = calcArchiveHeaderSizeNoFileHeader() - 4;
			// 读取 endian 
            pMByteBuffer.readUnsignedInt8(ref m_endian);
			pMByteBuffer.setEndian((Endian)m_endian);

			// 读取头部大小
            pMByteBuffer.readUnsignedInt32(ref m_headerSize);

			// 读取版本
            pMByteBuffer.readUnsignedInt32(ref m_version);
			// 读取文件数量
            pMByteBuffer.readUnsignedInt32(ref m_fileCount);

			// 读取整个头
			pMByteBuffer.clear ();
			fileHandle.Read(pMByteBuffer.dynBuff.buff, 0, (int)(m_headerSize - calcArchiveHeaderSizeNoFileHeader()));
			pMByteBuffer.length = m_headerSize - calcArchiveHeaderSizeNoFileHeader ();

			return true;
		}
Exemple #5
0
        public void testZipMsg()
        {
            byte[] outBytes = null;
            uint outSize = 0;

            byte[] inBytes = null;
            uint inSize = 0;

            ByteBuffer pByteBuffer = new ByteBuffer();
            UnitTestStrCmd pUnitTestCmd = new UnitTestStrCmd();

            // 发送第一个数据包
            pUnitTestCmd.testStr = "测试数据";
            pByteBuffer.clear();
            pUnitTestCmd.serialize(pByteBuffer);

            Compress.CompressData(pByteBuffer.dynBuff.buff, 0, pByteBuffer.length, ref outBytes, ref outSize);
            Compress.DecompressData(outBytes, 0, outSize, ref inBytes, ref inSize);

            pByteBuffer.clear();
            pByteBuffer.writeBytes(inBytes, 0, inSize);
            pByteBuffer.position = 0;
            pUnitTestCmd.derialize(pByteBuffer);

            UAssert.DebugAssert(pUnitTestCmd.testStr != "测试数据");
        }
Exemple #6
0
        public override void derialize(ByteBuffer bu)
        {
            base.derialize(bu);

            bu.readUnsignedInt32(ref id);
            bu.readUnsignedInt8(ref num);
        }
 public override void serialize(ByteBuffer bu)
 {
     base.serialize(bu);
     bu.writeMultiByte(strName, GkEncode.UTF8, ProtoCV.MAX_ACCNAMESIZE);
     bu.writeMultiByte(strPassword, GkEncode.UTF8, ProtoCV.MAX_PASSWORD);
     bu.writeMultiByte(strNewPassword, GkEncode.UTF8, ProtoCV.MAX_PASSWORD);
 }
 public override void serialize(ByteBuffer bu)
 {
     base.serialize(bu);
     bu.writeUnsignedInt32(qwThisID);
     bu.writeUnsignedInt32(dwNumber);
     bu.writeUnsignedInt8(useType);
     bu.writeUnsignedInt8(flag);
 }
Exemple #9
0
		public void readHeaderFromArchiveFile(ByteBuffer bu)
		{
            bu.readUnsignedInt8(ref m_pathLen);
            bu.readMultiByte(ref m_fileNamePath, m_pathLen, Encoding.UTF8);
            bu.readUnsignedInt32(ref m_fileOffset);
            bu.readUnsignedInt32(ref m_fileSize);
            bu.readUnsignedInt32(ref m_flags);
		}
        public override void serialize(ByteBuffer bu)
        {
            base.serialize(bu);
            bu.writeUnsignedInt32(reserve);
            bu.writeUnsignedInt32(version);

            cmd.serialize(bu);
        }
Exemple #11
0
        public override void serialize(ByteBuffer bu)
        {
            base.serialize(bu);
            bu.writeUnsignedInt32(reserve);
            bu.writeUnsignedInt32(version);

            bu.writeMultiByte(testStr, GkEncode.UTF8, 100);
        }
        public override void derialize(ByteBuffer bu)
        {
            base.derialize(bu);
            bu.readUnsignedInt32(ref reserve);
            bu.readUnsignedInt32(ref version);

            cmd.derialize(bu);
        }
Exemple #13
0
        // 步骤 7 ,接收消息
        public void receiveMsg7f(ByteBuffer msg)
        {
            Ctx.m_instance.m_logSys.log(Ctx.m_instance.m_langMgr.getText(LangTypeId.eLTLog0, LangItemID.eItem10));

            stGameTimeTimerUserCmd cmd = new stGameTimeTimerUserCmd();
            cmd.derialize(msg);
            qwGameTime = cmd.qwGameTime;
        }
Exemple #14
0
        public override void derialize(ByteBuffer bu)
        {
            base.derialize(bu);
            bu.readUnsignedInt32(ref reserve);
            bu.readUnsignedInt32(ref version);

            bu.readMultiByte(ref testStr, 100, GkEncode.UTF8);
        }
Exemple #15
0
        // 步骤 8 ,接收消息
        public void receiveMsg8f(ByteBuffer msg)
        {
            Ctx.m_instance.m_logSys.log(Ctx.m_instance.m_langMgr.getText(LangTypeId.eLTLog0, LangItemID.eItem11));

            stRequestUserGameTimeTimerUserCmd cmd = new stRequestUserGameTimeTimerUserCmd();
            cmd.derialize(msg);

            sendMsg9f();
        }
Exemple #16
0
 public void handleMsg(ByteBuffer msg)
 {
     //if (false == m_bStopNetHandle)  // 如果没有停止网络处理
     //{
         foreach (var item in m_netDispList)
         {
             item.handleMsg(msg);
         }
     //}
 }
Exemple #17
0
        public override void derialize(ByteBuffer bu)
        {
            base.derialize(bu);

            bu.readUnsignedInt32(ref dwType);
            bu.readUnsignedInt32(ref dwSysInfoType);
            bu.readMultiByte(ref pstrName, ProtoCV.MAX_NAMESIZE, GkEncode.UTF8);
            bu.readMultiByte(ref pstrChat, ProtoCV.MAX_CHATINFO, GkEncode.UTF8);
            bu.readUnsignedInt32(ref dwFromID);
            bu.readUnsignedInt32(ref dwChannelID);
        }
Exemple #18
0
        public override void serialize(ByteBuffer bu)
        {
            base.serialize(bu);

            bu.writeUnsignedInt32(dwType);
            bu.writeUnsignedInt32(dwSysInfoType);
            bu.writeMultiByte(pstrName, GkEncode.UTF8, ProtoCV.MAX_NAMESIZE);
            bu.writeMultiByte(pstrChat, GkEncode.UTF8, ProtoCV.MAX_CHATINFO);
            bu.writeUnsignedInt32(dwFromID);
            bu.writeUnsignedInt32(dwChannelID);
        }
Exemple #19
0
        protected void testCompressMsg()
        {
            byte[] outBytes = null;
            //uint outSize = 0;

            ByteBuffer bu = new ByteBuffer();
            stUserRequestLoginCmd cmd = new stUserRequestLoginCmd();
            cmd.serialize(bu);
            //Compress.CompressByteZip(bu.dynBuff.buff, 0, (uint)bu.length, ref outBytes, ref outSize);

            writeFile("e:\\log.zip", outBytes);
        }
        public override void serialize(ByteBuffer bu)
        {
            base.serialize(bu);

            bu.writeUnsignedInt32(loginTempID);
            bu.writeUnsignedInt32(dwUserID);
            bu.writeMultiByte(pstrName, GkEncode.UTF8, ProtoCV.MAX_ACCNAMESIZE);
            bu.writeMultiByte(pstrPassword, GkEncode.UTF8, ProtoCV.MAX_PASSWORD);

            bu.writeUnsignedInt32(reserve);
            bu.writeUnsignedInt32(version);
        }
Exemple #21
0
        // 一个操作开始
        public void psstNotifyBattleFlowStartUserCmd(ByteBuffer bu)
        {
            Ctx.m_instance.m_logSys.fightLog("[Fight] 接收到战斗回合开始指令");

            // 如果是空值才申请,否则就直接使用
            if (m_curParseRound == null)
            {
                m_curParseRound = new FightRound(m_sceneDZData);
                m_curParseRound.addRoundEndHandle(onOneRoundEnd);
                //m_cacheList.Add(m_curParseRound);
            }
        }
Exemple #22
0
        // 一个操作结束
        public void psstNotifyBattleFlowEndUserCmd(ByteBuffer bu)
        {
            Ctx.m_instance.m_logSys.fightLog("[Fight] 接收到战斗回合结束指令");

            if (m_curParseRound.bHasFightData)    // 说明有真正的攻击数据
            {
                m_cacheList.Add(m_curParseRound);   // 结束的时候才添加,因为现在有很多只有开始和结束的消息,没有战斗的消息
                m_curParseRound.bSvrRoundEnd = true;
                m_curParseRound = null;             // 设置成空值
                nextOneAttactRound();               // 真正有消息数据的时候,才开始下一场战斗
            }
        }
        // 步骤 2 ,接收返回的消息
        public void receiveMsg2f(ByteBuffer msg)
        {
            Ctx.m_instance.m_logSys.log(Ctx.m_instance.m_langMgr.getText(LangTypeId.eLTLog0, LangItemID.eItem3));
            stReturnClientIP cmd = new stReturnClientIP();
            cmd.derialize(msg);

            cmd.pstrIP = cmd.pstrIP.TrimEnd('\0');
            string str = string.Format(Ctx.m_instance.m_langMgr.getText(LangTypeId.eLTLog0, LangItemID.eItem15), cmd.pstrIP, cmd.port);
            Ctx.m_instance.m_logSys.log(str);

            sendMsg3f();
        }
        protected void psstRefCountObjectPropertyUserCmd(ByteBuffer msg)
        {
            stRefCountObjectPropertyUserCmd cmd = new stRefCountObjectPropertyUserCmd();
            cmd.derialize(msg);

            Ctx.m_instance.m_dataPlayer.m_dataPack.psstRefCountObjectPropertyUserCmd(cmd.qwThisID, cmd.dwNum, cmd.type);

            IUIOpenPack openPack = Ctx.m_instance.m_uiMgr.getForm(UIFormID.eUIOpenPack) as IUIOpenPack;
            if (openPack != null)
            {
                openPack.updateData();
                openPack.updatePackNum();
            }
        }
        protected void psstAddMobileObjectPropertyUserCmd(ByteBuffer msg)
        {
            stAddMobileObjectPropertyUserCmd cmd = new stAddMobileObjectPropertyUserCmd();
            cmd.derialize(msg);

            Ctx.m_instance.m_dataPlayer.m_dataPack.psstAddMobileObjectPropertyUserCmd(cmd.mobject);

            IUIOpenPack openPack = Ctx.m_instance.m_uiMgr.getForm(UIFormID.eUIOpenPack) as IUIOpenPack;
            if (openPack != null)
            {
                openPack.updateData();
                openPack.updatePackNum();
            }
        }
        public override void serialize(ByteBuffer bu)
        {
            base.serialize(bu);

            bu.writeMultiByte(pstrName, GkEncode.UTF8, ProtoCV.MAX_ACCNAMESIZE);
            bu.writeMultiByte(pstrPassword, GkEncode.UTF8, 33);
            bu.writeUnsignedInt16(game);
            bu.writeUnsignedInt16(zone);
            bu.writeMultiByte(jpegPassport, GkEncode.UTF8, 7);
            bu.writeMultiByte(mac_addr, GkEncode.UTF8, 13);
            bu.writeMultiByte(uuid, GkEncode.UTF8, 25);
            bu.writeUnsignedInt16(wdNetType);
            bu.writeMultiByte(passpodPwd, GkEncode.UTF8, 9);
        }
        // 卡牌图鉴中显示的所有数据
        protected void psstNotifyAllCardTujianInfoCmd(ByteBuffer msg)
        {
            stNotifyAllCardTujianInfoCmd cmd = new stNotifyAllCardTujianInfoCmd();
            cmd.derialize(msg);

            // 更新数据
            Ctx.m_instance.m_dataPlayer.m_dataCard.psstNotifyAllCardTujianInfoCmd(cmd.info);
            // 更新界面
            IUITuJian uiSC = Ctx.m_instance.m_uiMgr.getForm(UIFormID.eUITuJian) as IUITuJian;
            if (uiSC != null && uiSC.isVisible())
            {
                uiSC.psstNotifyAllCardTujianInfoCmd();
            }
        }
Exemple #28
0
		public void readArchiveFileHeader()
		{
			ByteBuffer pMByteBuffer = new ByteBuffer();

            if (m_pArchiveHeader.readArchiveFileHeader(m_fs, pMByteBuffer))		// 检查 magic
			{
				FileHeader pFileHeader;
				for (uint idx = 0; idx < m_pArchiveHeader.m_fileCount; ++idx)
				{
					pFileHeader = new FileHeader();
					m_pFileVec.Add(pFileHeader);
					pFileHeader.readHeaderFromArchiveFile(pMByteBuffer);
				}
			}
		}
        // 一个卡牌图鉴信息
        protected void psstNotifyOneCardTujianInfoCmd(ByteBuffer msg)
        {
            stNotifyOneCardTujianInfoCmd cmd = new stNotifyOneCardTujianInfoCmd();
            cmd.derialize(msg);

            bool bhas = Ctx.m_instance.m_dataPlayer.m_dataCard.m_id2CardDic.ContainsKey(cmd.id);
            // 更新数据
            Ctx.m_instance.m_dataPlayer.m_dataCard.psstNotifyOneCardTujianInfoCmd(cmd.id, cmd.num);
            // 更新界面
            IUITuJian uiSC = Ctx.m_instance.m_uiMgr.getForm(UIFormID.eUITuJian) as IUITuJian;
            if (uiSC != null && uiSC.isVisible())
            {
                uiSC.psstNotifyOneCardTujianInfoCmd(cmd.id, cmd.num, !bhas);
            }
        }
        public override void serialize(ByteBuffer bu)
        {
            base.serialize(bu);
            bu.writeMultiByte(strUserName, GkEncode.UTF8, ProtoCV.MAX_NAMESIZE + 1);
            bu.writeUnsignedInt16(gender);
            bu.writeUnsignedInt16(race);

            bu.writeUnsignedInt32(hair);
            bu.writeUnsignedInt32(face);

            bu.writeUnsignedInt16(career);
            bu.writeUnsignedInt32(country);

            bu.writeUnsignedInt8(height);
            bu.writeUnsignedInt8(weight);
        }