// Use this for initialization
 public void InitItemInfo(BlackMarketItemInfo GoodInfo)
 {
     //初始化货物信息
     m_GoodInfo.CleanUp();
     m_GoodInfo = GoodInfo;
     m_ItemIconSprite.spriteName = m_GoodInfo.ItemInfo.GetIcon();
     m_ItemIconSprite.MakePixelPerfect();
     m_ItemQualitySprite.spriteName = m_GoodInfo.ItemInfo.GetQualityFrame();
     m_ItemQualitySprite.MakePixelPerfect();
     m_ItemNameLable.text  = m_GoodInfo.ItemInfo.GetName();
     m_ItemCountLable.text = m_GoodInfo.ItemCount.ToString();
     if (m_GoodInfo.ItemMoneyType == (int)MONEYTYPE.MONEYTYPE_COIN)
     {
         m_MoneySprite.spriteName = "qian1";
         m_MoneySprite.MakePixelPerfect();
     }
     else if (m_GoodInfo.ItemMoneyType == (int)MONEYTYPE.MONEYTYPE_YUANBAO)
     {
         m_MoneySprite.spriteName = "qian2";
         m_MoneySprite.MakePixelPerfect();
     }
     else if (m_GoodInfo.ItemMoneyType == (int)MONEYTYPE.MONEYTYPE_YUANBAO_BIND)
     {
         m_MoneySprite.spriteName = "qian3";
         m_MoneySprite.MakePixelPerfect();
     }
     m_MoneyNumLable.text = m_GoodInfo.ItemPrice.ToString();
     gameObject.SetActive(true);
 }
Example #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();
    }