示例#1
0
 public void PetPlacard_AddItem(_PET_PLACARD_ITEM pItem)
 {
     if (m_nPetPlacardItemCount < GAMEDEFINE.MAX_PETPLACARD_LIST_ITEM_NUM)
     {
         m_aPetPlacardItems[m_nPetPlacardItemCount++] = pItem;
     }
 }
        //获得宠主对宠物的介绍信息
        public string GetInviteMsg(int nIndex)
        {
            int plidx = nIndex - 1;     //Lua is begin from 1, but c begin from 0
            _PET_PLACARD_ITEM curItem = GetPlaceCardItem(plidx);

            if ((object)curItem != null)
            {
                return(UIString.Instance.GetUnicodeString(curItem.m_szMessage));
            }
            return("");
        }
        ////tolua_end

        //网络处理相关接口
        public void ConvertPlaceCard2PetFriend()
        {
            CleanUpPetList();
            for (int i = 0; i < m_PetList.Count; ++i)
            {
                SDATA_PET         pOut    = GetPetListData(i);
                _PET_PLACARD_ITEM curItem = GetPlaceCardItem(i);
                if (pOut != null && (object)curItem != null)
                {
                    _PET_DETAIL_ATTRIB pIn = curItem.m_PetAttr;
                    PET_DETAIL_ATTRIB2SDATA_PAT(pIn, pOut);
                }
            }
        }
        //获得征友宠主的详细信息(名称、等级之类)
        // 修改了返回值和参数,需要修改lua脚本 [6/8/2010 Sun]
        public Lua_PetHumanInfo GetHumanINFO(int nIndex)
        {
            int plidx = nIndex - 1;     //Lua is begin from 1, but c begin from 0
            Lua_PetHumanInfo  petInfo = new Lua_PetHumanInfo();
            _PET_PLACARD_ITEM curItem = GetPlaceCardItem(plidx);

            if ((object)curItem != null)
            {
                string str = string.Format("{0:X}", curItem.m_HumanGUID);
                petInfo.m_strHumanGUID     = str;
                petInfo.m_HumanGUID        = curItem.m_HumanGUID;
                petInfo.m_szHumanName      = UIString.Instance.GetUnicodeString(curItem.m_szHumanName);
                petInfo.m_nHumanLevel      = curItem.m_nHumanLevel;
                petInfo.m_nHumanMenPai     = curItem.m_nHumanMenPai;
                petInfo.m_szHumanGuildName = UIString.Instance.GetUnicodeString(curItem.m_szHumanGuildName);
            }
            return(petInfo);
        }
        public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer)
        {
            if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain)
            {
                LogManager.Log("Receive GCPetPlacardList Packet");
                GCPetPlacardList packet = (GCPetPlacardList)pPacket;
                CDataPool.Instance.PetPlacard_CleanUp();

                int nItemCount;
                nItemCount = packet.Count;
                for (int i = 0; i < nItemCount; i++)
                {
                    _PET_PLACARD_ITEM pItem = packet.Item[i];
                    CDataPool.Instance.PetPlacard_AddItem(pItem);
                }

                if (nItemCount > 0)
                {
                    PetInviteFriend.Instance.ConvertPlaceCard2PetFriend();
                    CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_UPDATE_PETINVITEFRIEND, "invite");
                }
            }
            return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
        }
示例#6
0
 public void PetPlacard_AddItem(_PET_PLACARD_ITEM pItem)
 {
     mPetDataPool.PetPlacard_AddItem(pItem);
 }