diff --git a/Assets/ManagedResources/~Lua/Modules/Recharge/View/EveryDayGiftNew.lua b/Assets/ManagedResources/~Lua/Modules/Recharge/View/EveryDayGiftNew.lua index 05fbd4ddf0..9c9d791d62 100644 --- a/Assets/ManagedResources/~Lua/Modules/Recharge/View/EveryDayGiftNew.lua +++ b/Assets/ManagedResources/~Lua/Modules/Recharge/View/EveryDayGiftNew.lua @@ -65,6 +65,7 @@ function EveryDayGiftNew:InitComponent() self.freeBtnAnim = Util.GetGameObject(self.extarFreeBtn,"UI_effect_TanSuo_Box"):GetComponent("Animator") self.freeBtnRed = Util.GetGameObject(self.extarFreeBtn,"redPoint") self.extarStoreBtn = Util.GetGameObject(self.extarTitle,"Bg/store") + self.extarBg = Util.GetGameObject(self.extarTitle,"Bg") self.UI_Effect_jinkuang_Yuan = Util.GetGameObject(self.extarStoreBtn, "UI_Effect_jinkuang_Yuan") self.extarOneKeyBtn = Util.GetGameObject(self.extarTitle,"Bg/oneKey/oneKeyBtn") self.allSaoGuang = Util.GetGameObject(self.extarOneKeyBtn, "saoguang") @@ -151,7 +152,7 @@ function EveryDayGiftNew:RefreshData(none,isTop,isAni) --特殊处理部分 Log("actType:"..tostring(self.actType)) - if self.actType == FUNCTION_OPEN_TYPE.MeiRiLiBao then + if self.actType == FUNCTION_OPEN_TYPE.MeiRiLiBao then self.extarTitle:SetActive(true) --每日礼 self:RefreshFreeData() @@ -159,7 +160,11 @@ function EveryDayGiftNew:RefreshData(none,isTop,isAni) self:RefreshOneKeyShow() self.Reward:GetComponent("RectTransform").sizeDelta = Vector2.New(1080,820) end - + if self.actType == 98 then + self.extarTitle:SetActive(true) + self.extarBg:SetActive(false) + self:RefreshFreeData() + end if not self.scrollView then --更改完空间大小后再生成滚动条 local rootHight = self.Reward.transform.rect.height @@ -490,9 +495,17 @@ end --刷新每日免费礼包 function EveryDayGiftNew:RefreshFreeData() - local freeData = ShopManager.GetShopDataByType(SHOP_TYPE.FREE_GIFT).storeItem - local boughtNum = ShopManager.GetShopItemHadBuyTimes(SHOP_TYPE.FREE_GIFT, freeData[1].id) + local type=0 + if self.actType==90 then + type=SHOP_TYPE.FREE_GIFT + elseif self.actType==98 then + type=35 + end + local freeData = ShopManager.GetShopDataByType(type).storeItem + LogError("freeData len=="..#freeData) + local boughtNum = ShopManager.GetShopItemHadBuyTimes(type, freeData[1].id) local limitNum = ShopManager.GetShopItemLimitBuyCount(freeData[1].id) + --LogError("freeData[1].id=="..freeData[1].id) local isCanBuy = limitNum - boughtNum >= 1 self.freeBtnAnim.enabled = isCanBuy self.freeBtnRed:SetActive(isCanBuy) @@ -503,7 +516,7 @@ function EveryDayGiftNew:RefreshFreeData() CheckRedPointStatus(RedPointType.DailyGift) Util.AddOnceClick(self.extarFreeBtn,function() if isCanBuy then - ShopManager.RequestBuyShopItem(SHOP_TYPE.FREE_GIFT, freeData[1].id, 1, function() + ShopManager.RequestBuyShopItem(type, freeData[1].id, 1, function() self:RefreshFreeData() CheckRedPointStatus(RedPointType.DailyGift) CheckRedPointStatus(RedPointType.GrowthPackage) diff --git a/Assets/ManagedResources/~Lua/Modules/Shop/ShopManager.lua b/Assets/ManagedResources/~Lua/Modules/Shop/ShopManager.lua index d3f475afd1..8d185fc55a 100644 --- a/Assets/ManagedResources/~Lua/Modules/Shop/ShopManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Shop/ShopManager.lua @@ -409,6 +409,7 @@ function this.SortItemList(shopType) -- 试炼副本商店不按sort字段排序 if storeInfo.StoreType ~= SHOP_TYPE.TRIAL_SHOP then table.sort(v.storeItem, function(a, b) + --LogError("a.id=="..a.id.." b.id=="..b.id) local aId = a.id % _StoreItemIdFilter local bId = b.id % _StoreItemIdFilter local aInfo = ConfigManager.GetConfigData(ConfigName.StoreConfig, aId) @@ -463,6 +464,19 @@ function this.GetShopDataByType(shopType) --assert(shopData, "未找到商店数据,请检查数据表及后端数据,商店类型 == "..shopType) return shopData end +-- 通过商店type获取商店数据 +function this.GetShopDataByTypeAndFuncType(shopType,fType) + local shopData = nil + for _, v in ipairs(this.allShopData) do + local shopInfo = this.GetShopInfo(v.id) + if shopInfo and shopInfo.StoreType == shopType and shopInfo.FunctionType ==fType then + shopData = v + break + end + end + --assert(shopData, "未找到商店数据,请检查数据表及后端数据,商店类型 == "..shopType) + return shopData +end -- 通过商店id获取商店数据 function this.GetShopDataByShopId(shopId) local shopData = nil