public uint Execute(PacketDistributed ipacket)
        {
            GC_RET_BLACKMARKETITEMINFO packet = (GC_RET_BLACKMARKETITEMINFO)ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }
            //enter your logic
            if (BlackMarketLogic.Instance() != null)
            {
                BlackMarketLogic.Instance().UpdateGoodInfo(packet);
            }
            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }
Пример #2
0
    public void UpdateGoodInfo(GC_RET_BLACKMARKETITEMINFO packet)
    {
        //显示金钱数
//        int nCoin = GameManager.gameManager.PlayerDataPool.Money.GetMoney_Coin();
        int nPlayerYuanBao     = GameManager.gameManager.PlayerDataPool.Money.GetMoney_YuanBao();
        int nPlayerYuanBaoBind = GameManager.gameManager.PlayerDataPool.Money.GetMoney_YuanBaoBind();

        //      m_JinBiNumLable.text = nCoin.ToString();
        m_YuanBaoNumLable.text = nPlayerYuanBao.ToString();
        m_BindYBNumLable.text  = nPlayerYuanBaoBind.ToString();
        m_UnBindBuy.GetComponent <BoxCollider>().enabled = (nPlayerYuanBao != 0);
        m_BindBuy.GetComponent <BoxCollider>().enabled   = (nPlayerYuanBaoBind != 0);
        if (nPlayerYuanBaoBind == 0)
        {
            if (nPlayerYuanBao != 0)
            {
                m_BuyTypeController.ChangeTab("1UnBind");
            }
        }
        if (nPlayerYuanBao == 0)
        {
            m_BuyTypeController.ChangeTab("2Bind");
        }
        //最大页数
        m_nMaxPage       = packet.MaxPage;
        m_PageLable.text = String.Format("{0}/{1}", m_nCurPage, m_nMaxPage);
        for (int nIndex = 0; nIndex < (int)BLACKMARKETDATE.MAXNUMPAGE; ++nIndex)
        {
            if (m_GoodItemGameObj[nIndex] != null)
            {
                BlackMarketItemInfo goodInfo = new BlackMarketItemInfo();
                goodInfo.CleanUp();
                bool isHaveInfo = false;
                //索引
                if (nIndex < packet.ItemIndexCount)
                {
                    goodInfo.ItemIndex = packet.GetItemIndex(nIndex);
                    isHaveInfo         = true;
                }
                //ID
                if (nIndex < packet.ItemDataIdCount)
                {
                    goodInfo.ItemInfo.DataID = packet.GetItemDataId(nIndex);
                    isHaveInfo = true;
                }
                //是否绑定
                if (nIndex < packet.IsBindCount)
                {
                    goodInfo.ItemInfo.BindFlag = (packet.GetIsBind(nIndex) == 1);
                    isHaveInfo = true;
                }
                //数量
                if (nIndex < packet.ItemCountCount)
                {
                    goodInfo.ItemCount = packet.GetItemCount(nIndex);
                    isHaveInfo         = true;
                }
                //价格
                if (nIndex < packet.ItemPriceCount)
                {
                    goodInfo.ItemPrice = packet.GetItemPrice(nIndex);
                    isHaveInfo         = true;
                }
                //金钱类型
                if (nIndex < packet.ItemMoneyTypeCount)
                {
                    goodInfo.ItemMoneyType = packet.GetItemMoneyType(nIndex);
                    isHaveInfo             = true;
                }
                //显示
                if (isHaveInfo)
                {
                    BlackMarketItemLogic itemLogic = m_GoodItemGameObj[nIndex].GetComponent <BlackMarketItemLogic>();
                    if (itemLogic != null)
                    {
                        itemLogic.InitItemInfo(goodInfo);
                    }
                }
                //隐藏
                else
                {
                    m_GoodItemGameObj[nIndex].gameObject.SetActive(false);
                }
            }
        }
        m_UIGrid.Reposition();
    }