示例#1
0
    /// <summary>
    /// 商城装饰排序
    /// </summary>
    private void ShopOrnamentSort(StoreDefine storeDefine)
    {
        //判断是否上新或者促销
        var nowTime = TimeHelper.ServerTimeStampNow;

        if (nowTime > storeDefine.PromotionTimeBegin && nowTime < storeDefine.PromotionTimeEnd) //促销
        {
            if (nowTime > storeDefine.UpNewTimeBegin && nowTime < storeDefine.UpNewTimeEnd)     //既促销又上新
            {
                listShopOrnamentNewList.Add(storeDefine);
            }
            else
            {
                listShopOrnamentPromotionList.Add(storeDefine);
            }
        }
        else if (nowTime > storeDefine.UpNewTimeBegin && nowTime < storeDefine.UpNewTimeEnd)//上新
        {
            listShopOrnamentNewList.Add(storeDefine);
        }
        else
        {
            listShopOrnamentNorMalList.Add(storeDefine);
        }
    }
示例#2
0
    /// <summary>
    /// 刷新购买限制
    /// </summary>
    /// <param name="shopId"></param>
    /// <param name="buyAmount"></param>
    /// <param name="curStoreDefine"></param>
    public void RefreshBuyLimit(int shopId, int buyAmount, StoreDefine curStoreDefine)
    {
        var curLimitInfo = listGoodsInfoStruct.Find((elem) => elem.ShopId == shopId);

        if (curLimitInfo != null)
        {
            if (curStoreDefine.PurchaseNumLimit > 0)
            {
                curLimitInfo.PermanentBuyNum += buyAmount;
            }
            if (curStoreDefine.DailyPurchaseNum > 0)
            {
                curLimitInfo.TodayBuyNum += buyAmount;
            }
        }
        else
        {
            GoodsInfoStruct newGoodsInfoStruct = new GoodsInfoStruct()
            {
                ShopId = shopId
            };
            if (curStoreDefine.PurchaseNumLimit > 0)
            {
                newGoodsInfoStruct.PermanentBuyNum += buyAmount;
            }
            if (curStoreDefine.DailyPurchaseNum > 0)
            {
                newGoodsInfoStruct.TodayBuyNum += buyAmount;
            }
            listGoodsInfoStruct.Add(newGoodsInfoStruct);
        }
    }
示例#3
0
    /// <summary>
    /// 商城种子排序
    /// </summary>
    private void ShopSeedSort(StoreDefine storeDefine)
    {
        //判断物品是否解锁
        var itemConfig = StaticData.configExcel.GetGameItemByID(storeDefine.GoodId);
        int levelLimit = itemConfig.Grade;

        if (levelNum >= levelLimit)//物品已经解锁
        {
            //判断是否上新或者促销
            var nowTime = TimeHelper.ServerTimeStampNow;
            if (nowTime > storeDefine.PromotionTimeBegin && nowTime < storeDefine.PromotionTimeEnd) //促销
            {
                if (nowTime > storeDefine.UpNewTimeBegin && nowTime < storeDefine.UpNewTimeEnd)     //既促销又上新
                {
                    listShopSeedNewList.Add(storeDefine);
                }
                else
                {
                    listShopSeedPromotionList.Add(storeDefine);
                }
            }
            else if (nowTime > storeDefine.UpNewTimeBegin && nowTime < storeDefine.UpNewTimeEnd)//上新
            {
                listShopSeedNewList.Add(storeDefine);
            }
            else
            {
                listShopSeedNorMalList.Add(storeDefine);
            }
        }
        else
        {
            listShopSeedNorMalList.Add(storeDefine);
        }
    }
示例#4
0
    //判断是否有促销或者上新
    private static bool NewAndPromotion(StoreDefine storeDefine)
    {
        var nowTime = TimeHelper.ServerTimeStampNow;

        if (nowTime > storeDefine.UpNewTimeBegin && nowTime < storeDefine.UpNewTimeEnd)             //处于上新
        {
            if (nowTime > storeDefine.PromotionTimeBegin && nowTime < storeDefine.PromotionTimeEnd) //处于上新和促销
            {
                return(true);
            }
            else
            {
                return(true);
            }
        }
        else
        {
            if (nowTime > storeDefine.PromotionTimeBegin && nowTime < storeDefine.PromotionTimeEnd) //处于促销
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
    }
示例#5
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();
    }
示例#6
0
    public void InitValue(Action <int, int> callbakc, Action cancelBuy)
    {
        BuyCallback = callbakc;
        CancelBuy   = cancelBuy;
        _buyItemNum = 1;

        Init();

        int itemID   = StaticData.configExcel.GetVertical().PhysicalPower;
        var itemInfo = StaticData.configExcel.GetGameItemByID(itemID);

        _tits.text       = LocalizationDefineHelper.GetStringNameById(120014);//体力已经用完啦是否需要补充体力?
        _itemIcon.sprite = ABManager.GetAsset <Sprite>(itemInfo.Icon);
        _itemName.text   = LocalizationDefineHelper.GetStringNameById(itemInfo.ItemName);

        _itemObtain.text = _itemName.text + LocalizationDefineHelper.GetStringNameById(120139); //:

        StoreDefine buyInfo = ZillionaireGameMapManager._instance.GetBuyPowerInfo();

        _baseItemObtainNum    = buyInfo.GoodNum;
        _itemObtainValue.text = "+" + _baseItemObtainNum;

        _buyRemaining       = ZillionaireGameMapManager._instance.GetBuyPowerTime();
        _itemRemaining.text = LocalizationDefineHelper.GetStringNameById(120135) + (_buyRemaining - _buyItemNum);//

        _itemNum.text = _buyItemNum.ToString();

        _butLess.onClick.RemoveAllListeners();
        _butLess.onClick.AddListener(OnClickLessBuyNum);

        _butPlus.onClick.RemoveAllListeners();
        _butPlus.onClick.AddListener(OnClickPlusBuyNum);

        //add 策划需求购买体力界面点击黑背景不关闭 ws 2021/1/11
        //_butClose.onClick.RemoveAllListeners();
        //_butClose.onClick.AddListener(() => {
        //    UniversalTool.CancelPopAnim(_bgTra, OnClickClose); });

        _butCancel.onClick.RemoveAllListeners();
        _butCancel.onClick.AddListener(() => {
            UniversalTool.CancelPopAnim(_bgTra, OnClickCancel);
        });

        _butBuy.onClick.RemoveAllListeners();
        _butBuy.onClick.AddListener(() => {
            UniversalTool.CancelPopAnim(_bgTra, OnClickBuy);
        });

        _baseBuyCurrencyNum = (int)buyInfo.OriginalPrice[0].Count;
        string path = StaticData.configExcel.GetGameItemByID(buyInfo.OriginalPrice[0].ID).Icon;

        _butBuyCurrencyIcon.sprite = ABManager.GetAsset <Sprite>(path);
        _butBuyCurrencyIcon.SetNativeSize();
        _butBuyCurrencyNum.text = _baseBuyCurrencyNum.ToString();
    }
示例#7
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);
    }
示例#8
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;
 }
示例#9
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();
    }
示例#10
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);
        }
    }