Esempio n. 1
0
        public void SetShopGoodItemInfo(ShopGoodsItemInfo shopGoodsItemInfo)
        {
            _shopGoodsItemInfo = shopGoodsItemInfo;

            GameResData goodsGameResData = _shopGoodsItemInfo.ShopGoodsData.goodsGameResData;

            nameText.text        = Localization.Get(_shopGoodsItemInfo.ShopGoodsData.name);
            descriptionText.text = Localization.Get(_shopGoodsItemInfo.ShopGoodsData.description);

            string itemIconSpritePath = string.Empty;

            if (!string.IsNullOrEmpty(_shopGoodsItemInfo.ShopGoodsData.pic))
            {
                itemIconSpritePath = ResPath.GetShopItemIconPath(_shopGoodsItemInfo.ShopGoodsData.pic);
            }
            else
            {
                if (goodsGameResData.type == Logic.Enums.BaseResType.Item)
                {
                    ItemData itemData = ItemData.GetItemDataByID(goodsGameResData.id);
                    itemIconSpritePath = ResPath.GetItemIconPath(itemData.icon);
                }
                else if (goodsGameResData.type == Logic.Enums.BaseResType.Hero)
                {
                    HeroData heroData = HeroData.GetHeroDataByID(goodsGameResData.id);
                    itemIconSpritePath = ResPath.GetCharacterHeadIconPath(heroData.headIcons[heroData.starMin - 1]);
                }
            }
            itemIconImage.SetSprite(ResMgr.instance.Load <Sprite>(itemIconSpritePath));
            itemIconImage.SetNativeSize();

            costResourceIcon.SetSprite(ResMgr.instance.Load <Sprite>(UIUtil.GetBaseResIconPath(_shopGoodsItemInfo.ShopGoodsData.costGameResData.type)));
            costResourceIcon.SetNativeSize();
            costResourceCountText.text = _shopGoodsItemInfo.ShopGoodsData.costGameResData.count.ToString();

            freeTimesRoot.SetActive(false);
            freeCountDownSlider.gameObject.SetActive(false);

            if (_shopGoodsItemInfo.ShopGoodsData.itemNum > 0)
            {
                if (_shopGoodsItemInfo.RemainPurchaseTimes > 0)
                {
                    buyButton.gameObject.SetActive(true);
                    soldOutButton.gameObject.SetActive(false);
                }
                else
                {
                    buyButton.gameObject.SetActive(false);
                    soldOutButton.gameObject.SetActive(true);
                }
                limitTimesText.text = string.Format(Localization.Get("common.value/max"), _shopGoodsItemInfo.RemainPurchaseTimes, _shopGoodsItemInfo.ShopGoodsData.itemNum);
                limitTimesRoot.SetActive(true);
            }
            else
            {
                limitTimesRoot.SetActive(false);
                buyButton.gameObject.SetActive(true);
                soldOutButton.gameObject.SetActive(false);
            }
        }
Esempio n. 2
0
        private void RefreshItemIconImage()
        {
            Sprite sprite = ResMgr.instance.Load <Sprite>(ResPath.GetItemIconPath(_itemInfo.itemData.icon));

            if (sprite != null)
            {
                itemIconImage.SetSprite(sprite);
                //itemIconImage.SetNativeSize();
            }
        }
Esempio n. 3
0
        public void Refresh()
        {
            _itemInfo = ItemProxy.instance.GetItemInfoByItemID(itemId);
            if (_itemInfo == null)
            {
                _itemInfo = new ItemInfo(0, itemId, 0);
            }
            Sprite sprite = ResMgr.instance.Load <Sprite>(ResPath.GetItemIconPath(_itemInfo.itemData.icon));

            if (sprite != null)
            {
                itemImage.SetSprite(sprite);
            }
            RefreshCount();
        }