/// <summary> /// 点击购买 /// </summary> public void OnBuyBtnClick() { if (!isItemUnlock) { StaticData.CreateToastTips(_LevelLimitText.GetComponent <Text>().text); return; } if (todayBuyLimit < 1) { StaticData.CreateToastTips(limitStr); return; } if (uiShopComponent == null) { uiShopComponent = UIComponent.GetComponentHaveExist <UIShopComponent>(UIType.UIShop); } else { if (uiShopChoiceAmount == null) { uiShopChoiceAmount = uiShopComponent._buyAmountChoice.GetComponent <UIShopChoiceAmount>(); } } uiShopChoiceAmount.gameObject.SetActive(true); uiShopChoiceAmount.InitShow(curStoreDefine, isPromotion, todayBuyLimit, limitStr, iconName, shopType, this, popIconName, typeGameItem, isRightBtnDiamond); }
public void ChangeBuyLimit(int buyAmount) { if (uiShopComponent == null) { uiShopComponent = UIComponent.GetComponentHaveExist <UIShopComponent>(UIType.UIShop); } uiShopComponent.RefreshBuyLimit(curStoreDefine.ShopId, buyAmount, curStoreDefine); RefreshBuyLimit(); }
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); }
void Update() { if (uiShopComponent == null) { uiShopComponent = UIComponent.GetComponentHaveExist <UIShopComponent>(UIType.UIShop); if (uiDecoratePop == null) { uiDecoratePop = uiShopComponent.LoopOrnamentShop.Find("DecoratePop").GetComponent <UIDecoratePop>(); } //刷新限购信息 if (uiShopComponent.preGetLimitDay != 0 && preGetLimitDay != uiShopComponent.preGetLimitDay) { RefreshBuyLimit(); preGetLimitDay = uiShopComponent.preGetLimitDay; if (uiDecoratePop.isFirstUpdatePopInfo) { return; } //初始化左边详细界面 uiDecoratePop.GetComponent <UIDecoratePop>().Init(); } } else { if (uiDecoratePop == null) { uiDecoratePop = uiShopComponent.LoopOrnamentShop.Find("DecoratePop").GetComponent <UIDecoratePop>(); } //刷新限购信息 if (uiShopComponent.preGetLimitDay != 0 && preGetLimitDay != uiShopComponent.preGetLimitDay) { RefreshBuyLimit(); preGetLimitDay = uiShopComponent.preGetLimitDay; if (uiDecoratePop.isFirstUpdatePopInfo) { return; } //初始化左边详细界面 uiDecoratePop.GetComponent <UIDecoratePop>().Init(); } } }
void Update() { if (uiShopComponent == null) { uiShopComponent = UIComponent.GetComponentHaveExist <UIShopComponent>(UIType.UIShop); //刷新限购信息 if (uiShopComponent.preGetLimitDay != 0 && preGetLimitDay != uiShopComponent.preGetLimitDay) { RefreshBuyLimit(); preGetLimitDay = uiShopComponent.preGetLimitDay; } } else { //刷新限购信息 if (uiShopComponent.preGetLimitDay != 0 && preGetLimitDay != uiShopComponent.preGetLimitDay) { RefreshBuyLimit(); preGetLimitDay = uiShopComponent.preGetLimitDay; } } }
//更新装饰弹窗信息 private void UpdatePopInfo() { //判断是否检测到 if (uiShopComponent == null) { uiShopComponent = UIComponent.GetComponentHaveExist <UIShopComponent>(UIType.UIShop); if (_popGoldPriceText == null) { _popGoldPriceText = uiShopComponent.LoopOrnamentShop.Find("DecoratePop").Find("BuyBtn_gold").Find("CurPrice").GetComponent <Text>(); } if (_popDiamondPriceText == null) { _popDiamondPriceText = uiShopComponent.LoopOrnamentShop.Find("DecoratePop").Find("BuyBtn_diamond").Find("CurPrice").GetComponent <Text>(); } if (iconPop == null) { iconPop = uiShopComponent.LoopOrnamentShop.Find("DecoratePop").Find("Icon"); } if (iconNamePop == null) { iconNamePop = uiShopComponent.LoopOrnamentShop.Find("DecoratePop").Find("IconName"); } } else { if (_popGoldPriceText == null) { _popGoldPriceText = uiShopComponent.LoopOrnamentShop.Find("DecoratePop").Find("BuyBtn_gold").Find("CurPrice").GetComponent <Text>(); } if (_popDiamondPriceText == null) { _popDiamondPriceText = uiShopComponent.LoopOrnamentShop.Find("DecoratePop").Find("BuyBtn_diamond").Find("CurPrice").GetComponent <Text>(); } if (iconPop == null) { iconPop = uiShopComponent.LoopOrnamentShop.Find("DecoratePop").Find("Icon"); } if (iconNamePop == null) { iconNamePop = uiShopComponent.LoopOrnamentShop.Find("DecoratePop").Find("IconName"); } } //更新图片 iconPop.GetComponent <Image>().sprite = _icon.GetComponent <Image>().sprite; //更新名字 iconNamePop.GetComponent <Text>().text = _itemName.GetComponent <Text>().text; //更新价格 _popGoldPriceText.text = _topPriceText; //金币价格 _popDiamondPriceText.text = _topPriceText2; //钻石价格 //传递该物品详情 UIDecoratePop.itemDefine = itemDefine; //判断是否有旋转 uiShopComponent.LoopOrnamentShop.Find("DecoratePop").GetComponent <UIDecoratePop>().IsHasReversal(); }
private async void DealPromotionAndNewest() { //判断是否检测到 if (uiShopComponent == null) { uiShopComponent = UIComponent.GetComponentHaveExist <UIShopComponent>(UIType.UIShop); if (_topCurrencyIcon == null) { _topCurrencyIcon = uiShopComponent.LoopOrnamentShop.Find("DecoratePop").Find("BuyBtn_gold").Find("CurrencyIcon"); } if (_topCurrencyIcon2 == null) { _topCurrencyIcon2 = uiShopComponent.LoopOrnamentShop.Find("DecoratePop").Find("BuyBtn_diamond").Find("CurrencyIcon"); } } else { if (_topCurrencyIcon == null) { _topCurrencyIcon = uiShopComponent.LoopOrnamentShop.Find("DecoratePop").Find("BuyBtn_gold").Find("CurrencyIcon"); } if (_topCurrencyIcon2 == null) { _topCurrencyIcon2 = uiShopComponent.LoopOrnamentShop.Find("DecoratePop").Find("BuyBtn_diamond").Find("CurrencyIcon"); } } //判定促销状态 var nowTime = TimeHelper.ServerTimeStampNow; if (nowTime > curStoreDefine.PromotionTimeBegin && nowTime < curStoreDefine.PromotionTimeEnd) { isPromotion = true; _discountFlag.gameObject.SetActive(true); //装饰的促销 //货币1 if (curStoreDefine.PromotionPrice.Count == 0)//只是钻石促销 { int costItemId = curStoreDefine.OriginalPrice[0].ID; var costItemConfig = StaticData.configExcel.GetGameItemByID(costItemId); _topCurrencyIcon.GetComponent <Image>().sprite = await ABManager.GetAssetAsync <Sprite>(costItemConfig.Icon); _topPriceText = curStoreDefine.OriginalPrice[0].Count.ToString();//金币显示原价 } else { int costItemId = curStoreDefine.PromotionPrice[0].ID; var costItemConfig = StaticData.configExcel.GetGameItemByID(costItemId); _topCurrencyIcon.GetComponent <Image>().sprite = await ABManager.GetAssetAsync <Sprite>(costItemConfig.Icon); _topPriceText = curStoreDefine.PromotionPrice[0].Count.ToString(); } //货币2 if (curStoreDefine.PromotionDiamondPrice.Count == 0)//只是金币促销 { int costItemId2 = curStoreDefine.DiamondPrice[0].ID; var costItemConfig2 = StaticData.configExcel.GetGameItemByID(costItemId2); _topCurrencyIcon2.GetComponent <Image>().sprite = await ABManager.GetAssetAsync <Sprite>(costItemConfig2.Icon); _topPriceText2 = curStoreDefine.DiamondPrice[0].Count.ToString();//钻石显示原价 } else { int costItemId2 = curStoreDefine.PromotionDiamondPrice[0].ID; var costItemConfig2 = StaticData.configExcel.GetGameItemByID(costItemId2); _topCurrencyIcon2.GetComponent <Image>().sprite = await ABManager.GetAssetAsync <Sprite>(costItemConfig2.Icon); _topPriceText2 = curStoreDefine.PromotionDiamondPrice[0].Count.ToString(); } } else { isPromotion = false; _discountFlag.gameObject.SetActive(false); //装饰的原价 //货币1 int costItemId = curStoreDefine.OriginalPrice[0].ID; var costItemConfig = StaticData.configExcel.GetGameItemByID(costItemId); _topCurrencyIcon.GetComponent <Image>().sprite = await ABManager.GetAssetAsync <Sprite>(costItemConfig.Icon); //花费的原价道具数量 _topPriceText = curStoreDefine.OriginalPrice[0].Count.ToString(); //货币2 int costItemId2 = curStoreDefine.DiamondPrice[0].ID; var costItemConfig2 = StaticData.configExcel.GetGameItemByID(costItemId2); _topCurrencyIcon2.GetComponent <Image>().sprite = await ABManager.GetAssetAsync <Sprite>(costItemConfig2.Icon); //花费的原价道具数量 _topPriceText2 = curStoreDefine.DiamondPrice[0].Count.ToString(); } //判定上新状态 if (nowTime > curStoreDefine.UpNewTimeBegin && nowTime < curStoreDefine.UpNewTimeEnd) { _newestFlag.gameObject.SetActive(true); } else { _newestFlag.gameObject.SetActive(false); } }
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); } }