Beispiel #1
0
    private void LeftBtnClick()
    {
        _rightBuyTF.gameObject.SetActive(false);
        _leftBuyTF.gameObject.SetActive(true);

        isRightBtnOrnament = false;

        for (int i = 0; i < content.childCount; i++)
        {
            if (content.GetChild(i).GetComponent <UIOrnament>().isClick)
            {
                isPromotion    = content.GetChild(i).GetComponent <UIOrnament>().isPromotion;
                todayBuyLimit  = content.GetChild(i).GetComponent <UIOrnament>().todayBuyLimit;
                limitStr       = content.GetChild(i).GetComponent <UIOrnament>().limitStr;
                iconName       = content.GetChild(i).GetComponent <UIOrnament>().iconName;
                popIconName    = content.GetChild(i).GetComponent <UIOrnament>().popIconName;
                uIOrnament     = content.GetChild(i).GetComponent <UIOrnament>();
                typeGameItem   = content.GetChild(i).GetComponent <UIOrnament>().typeGameItem;
                shopType       = content.GetChild(i).GetComponent <UIOrnament>().shopType;
                curStoreDefine = content.GetChild(i).GetComponent <UIOrnament>().curStoreDefine;
            }
        }
        Debug.Log(iconName);
        OnBuyBtnClick();
    }
Beispiel #2
0
    public async void ScrollCellIndex(int idx)
    {
        Init();

        if (uiShopComponent == null)
        {
            uiShopComponent = UIComponent.GetComponentHaveExist <UIShopComponent>(UIType.UIShop);
        }
        switch (shopType)
        {
        case ShopType.Seed:
            curStoreDefine = uiShopComponent.listShopSeedList[idx];
            break;

        case ShopType.Item:
            curStoreDefine = uiShopComponent.listShopItemList[idx];
            break;

        case ShopType.Ornament:
            curStoreDefine = uiShopComponent.listShopOrnamentList[idx];
            break;
        }
        //下标赋值
        index = idx;
        DealPromotionAndNewest();
        var itemConfig = StaticData.configExcel.GetGameItemByID(curStoreDefine.GoodId);

        //保存数据
        itemDefine = itemConfig;

        //道具图标
        if (itemConfig.ItemType == TypeGameItem.Seed)
        {
            var ManorCropConfig = StaticData.configExcel.ManorCrop;
            //用种子id查找作物id
            var curManorCropConfig = ManorCropConfig.Find((elem) => elem.IdSeed == curStoreDefine.GoodId);
            var cropItemConfig     = StaticData.configExcel.GetGameItemByID(curManorCropConfig.IdGainGameItem);
            iconName = cropItemConfig.Icon;
            _icon.GetComponent <Image>().sprite = await ABManager.GetAssetAsync <Sprite>(iconName);
        }
        else
        {
            iconName = itemConfig.Icon;
            _icon.GetComponent <Image>().sprite = await ABManager.GetAssetAsync <Sprite>(iconName);
        }

        typeGameItem = itemConfig.ItemType;

        //商品名称
        _itemName.GetComponent <UILocalize>().SetOtherLanguageId(itemConfig.ItemName);
        popIconName = itemConfig.ItemName;
        //未解锁mask
        _bgMask.gameObject.SetActive(false);
    }
Beispiel #3
0
 //装饰的重载
 public void InitShow(StoreDefine curStoreDefineTmp, bool isPromotionTmp, int todayBuyLimitTmp, string limitStrTmp, string iconNameTmp, ShopType shopTypeTmp, UIOrnament uiOrnamen, int popIconName, TypeGameItem itemType, bool isRightBtn)
 {
     isOrnament         = true;
     isRightBtnOrnament = isRightBtn;
     Init();
     _popIconName   = popIconName;
     typeGameItem   = itemType;
     curStoreDefine = curStoreDefineTmp;
     isPromotion    = isPromotionTmp;
     todayBuyLimit  = todayBuyLimitTmp;
     limitStr       = limitStrTmp;
     iconName       = iconNameTmp;
     shopType       = shopTypeTmp;
     buyAmount      = 1;
     uiSetAmountComponent.ResetDefalut();
     uiSetAmountComponent._maxValue = todayBuyLimit;
     RefreshShopChoiceUI();
     choicedUIOrnament = uiOrnamen;
 }
Beispiel #4
0
    public void Init()
    {
        leftBtn.onClick.RemoveAllListeners();
        leftBtn.onClick.AddListener(LeftBtnClick);
        rightBtn.onClick.RemoveAllListeners();
        rightBtn.onClick.AddListener(RightBtnClick);

        downClickBtn.onClick.RemoveAllListeners();
        //downClickBtn.onClick.AddListener(DownClick);

        isPromotion    = content.GetChild(0).GetComponent <UIOrnament>().isPromotion;
        limitStr       = content.GetChild(0).GetComponent <UIOrnament>().limitStr;
        iconName       = content.GetChild(0).GetComponent <UIOrnament>().iconName;
        popIconName    = content.GetChild(0).GetComponent <UIOrnament>().popIconName;
        uIOrnament     = content.GetChild(0).GetComponent <UIOrnament>();
        typeGameItem   = content.GetChild(0).GetComponent <UIOrnament>().typeGameItem;
        shopType       = content.GetChild(0).GetComponent <UIOrnament>().shopType;
        curStoreDefine = content.GetChild(0).GetComponent <UIOrnament>().curStoreDefine;
        todayBuyLimit  = content.GetChild(0).GetComponent <UIOrnament>().todayBuyLimit;

        FirstUpdatePopInfo();
    }
Beispiel #5
0
    public async void ScrollCellIndex(int idx)
    {
        Init();

        if (uiShopComponent == null)
        {
            uiShopComponent = UIComponent.GetComponentHaveExist <UIShopComponent>(UIType.UIShop);
        }

        switch (shopType)
        {
        case ShopType.Seed:
            curStoreDefine = uiShopComponent.listShopSeedList[idx];
            break;

        case ShopType.Item:
            curStoreDefine = uiShopComponent.listShopItemList[idx];
            break;

        case ShopType.Ornament:
            curStoreDefine = uiShopComponent.listShopOrnamentList[idx];
            break;
        }
        //判断上新促销状态
        DealPromotionAndNewest();
        var itemConfig = StaticData.configExcel.GetGameItemByID(curStoreDefine.GoodId);

        //var storeConfig = StaticData.configExcel.GetStoreByShopId(curStoreDefine.GoodId);


        //判断这个物品是不是钻石购买
        if (shopType == ShopType.Item)
        {
            if (curStoreDefine.OriginalPrice[0].ID == StaticData.configExcel.GetVertical().GoldGoodsId)
            {
                isRightBtnDiamond = false;
            }
            else
            {
                isRightBtnDiamond = true;
            }
        }
        if (shopType == ShopType.Seed)
        {
            isRightBtnDiamond = false;
        }


        //道具地板
        switch (itemConfig.Rarity)
        {
        case TypeRarity.None:
            _iconBg.GetComponent <Image>().sprite = await ABManager.GetAssetAsync <Sprite>("sd_sp_k1");

            break;

        case TypeRarity.Primary:
            _iconBg.GetComponent <Image>().sprite = await ABManager.GetAssetAsync <Sprite>("sd_sp_k1");

            break;

        case TypeRarity.Intermediate:
            _iconBg.GetComponent <Image>().sprite = await ABManager.GetAssetAsync <Sprite>("sd_sp_k2");

            break;

        case TypeRarity.Senior:
            _iconBg.GetComponent <Image>().sprite = await ABManager.GetAssetAsync <Sprite>("sd_sp_k3");

            break;

        default:
            break;
        }
        //道具数量 只有道具才显示
        if (curStoreDefine.GoodNum >= 1 && shopType == ShopType.Item)
        {
            _buyQuantity.gameObject.SetActive(true);
            _buyQuantity.Find("Text").GetComponent <Text>().text = curStoreDefine.GoodNum.ToString();
        }


        //道具等级 只有种子才有
        if (shopType == ShopType.Seed)
        {
            _itemGradeBg.gameObject.SetActive(true);
            _itemGradeBg.Find("ItemGrade").GetComponent <Text>().text = itemConfig.Grade.ToString();
        }
        else
        {
            if (_itemGradeBg != null)
            {
                _itemGradeBg.gameObject.SetActive(false);
            }
        }


        //道具图标
        if (itemConfig.ItemType == TypeGameItem.Seed)
        {
            var ManorCropConfig = StaticData.configExcel.ManorCrop;
            //用种子id查找作物id
            var curManorCropConfig = ManorCropConfig.Find((elem) => elem.IdSeed == curStoreDefine.GoodId);
            var cropItemConfig     = StaticData.configExcel.GetGameItemByID(curManorCropConfig.IdSeed);
            iconName = cropItemConfig.Icon;
            _icon.GetComponent <Image>().sprite = await ABManager.GetAssetAsync <Sprite>(iconName);
        }
        else
        {
            iconName = itemConfig.Icon;
            _icon.GetComponent <Image>().sprite = await ABManager.GetAssetAsync <Sprite>(iconName);
        }

        typeGameItem = itemConfig.ItemType;

        //商品名称
        _itemName.GetComponent <UILocalize>().SetOtherLanguageId(itemConfig.ItemName);
        popIconName = itemConfig.ItemName;
        //等级限制
        int levelLimit    = itemConfig.Grade;
        var userLevelInfo = StaticData.GetPlayerLevelAndCurrExp();
        int levelNum      = userLevelInfo.level;

        //未解锁mask
        _bgMask.gameObject.SetActive(false);
        if (_LevelLimit != null && levelNum < levelLimit)
        {
            _LevelLimit.gameObject.SetActive(true);
            _lock.gameObject.SetActive(true);

            //上新标签
            _newestFlag.gameObject.SetActive(false);
            //促销标签
            _discountFlag.gameObject.SetActive(false);

            //未解锁mask
            //_bgMask.gameObject.SetActive(true);
            isItemUnlock = false;
            string levelStr  = LocalizationDefineHelper.GetStringNameById(120042);
            string UnlockStr = LocalizationDefineHelper.GetStringNameById(120096);
            _LevelLimitText.GetComponent <Text>().text = levelLimit.ToString() + levelStr + UnlockStr;
        }
        else
        {
            _LevelLimit.gameObject.SetActive(false);
            _lock.gameObject.SetActive(false);
            isItemUnlock = true;
            //未解锁mask
            //_bgMask.gameObject.SetActive(false);
        }
    }