diff --git a/lua/app/module/chapter/chapter_manager.lua b/lua/app/module/chapter/chapter_manager.lua index faf41585..8c51ee7f 100644 --- a/lua/app/module/chapter/chapter_manager.lua +++ b/lua/app/module/chapter/chapter_manager.lua @@ -103,7 +103,7 @@ function ChapterManager:endFightFinish(result) DataManager.ShopData:markPopUpGiftForBeginnerGift() end -- 章节通关 标记可弹出章节礼包 - DataManager.ShopData:markPopUpGiftForActChapterStore(newMaxChapter) + DataManager.ShopData:markPopUpGiftForActChapterStore(newMaxChapter - 1) end ModuleManager.TaskManager:addFightTaskProgress(reqData) diff --git a/lua/app/module/shop/shop_const.lua b/lua/app/module/shop/shop_const.lua index b761b9ef..af8609ea 100644 --- a/lua/app/module/shop/shop_const.lua +++ b/lua/app/module/shop/shop_const.lua @@ -1,5 +1,12 @@ local ShopConst = class("ShopConst", BaseModule) ShopConst.BEGINNER_GIFT_ID = 40102 -- 新手礼包ID +ShopConst.MAIN_UI_POP_TYPE = { -- 当触发弹窗时,相关联的类型礼包也要触发 + [PayManager.PURCHARSE_TYPE.ACT_GIFT] = { + [PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = true, + [PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = true, + }, + [PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = true +} return ShopConst \ No newline at end of file diff --git a/lua/app/ui/main_city/main_city_ui.lua b/lua/app/ui/main_city/main_city_ui.lua index 8ad88825..5c1dccc0 100644 --- a/lua/app/ui/main_city/main_city_ui.lua +++ b/lua/app/ui/main_city/main_city_ui.lua @@ -838,12 +838,12 @@ function MainCityUI:checkGift() end -- 新手礼包 if #beginnerGiftIds > 0 then - ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT, beginnerGiftIds[1]) + ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, beginnerGiftIds[1]) return true end -- 助力礼包 if #levelUpGiftIds then - ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT, levelUpGiftIds[1]) + ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, levelUpGiftIds[1]) return true end diff --git a/lua/app/ui/shop/cell/grow_sell_cell.lua b/lua/app/ui/shop/cell/grow_sell_cell.lua index 0076172f..546f3879 100644 --- a/lua/app/ui/shop/cell/grow_sell_cell.lua +++ b/lua/app/ui/shop/cell/grow_sell_cell.lua @@ -44,7 +44,7 @@ function GrowSellCell:getCellHeight() end function GrowSellCell:getIsOpen() - return true -- TOODJ + return false -- true -- TOODJ end function GrowSellCell:setVisible(visible) diff --git a/lua/app/ui/shop/gift_pop_ui.lua b/lua/app/ui/shop/gift_pop_ui.lua index f0839fad..637ae032 100644 --- a/lua/app/ui/shop/gift_pop_ui.lua +++ b/lua/app/ui/shop/gift_pop_ui.lua @@ -3,12 +3,14 @@ local GiftPopUI = class("GiftPopUI", BaseUI) local GIFT_BG_NAME = { [PayManager.PURCHARSE_TYPE.ACT_GIFT] = { [PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = "assets/arts/textures/background/shop/shop_gift_banner_2_1.png", -- TODOJ + [PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = "assets/arts/textures/background/shop/shop_gift_banner_5_1.png", -- TODOJ }, [PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = "assets/arts/textures/background/shop/shop_gift_banner_1_1.png", -- TODOJ } local GIFT_TITLE_TEXT = { [PayManager.PURCHARSE_TYPE.ACT_GIFT] = { [PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = "新手礼包TD", -- TODOJ + [PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = "金币礼包TD", -- TODOJ }, [PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = "章节礼包TD", -- TODOJ } @@ -16,9 +18,6 @@ local GIFT_TITLE_TEXT = { local MAX_ITEM_NUM = 4 function GiftPopUI:ctor(params) - - Logger.logHighlight("GiftPopUI -- ctor type:%s id:%s", params.type, params.id) - params = params or {} self.actType = params.type @@ -155,15 +154,17 @@ function GiftPopUI:onClickGift() PayManager:purchasePackage(self.actId, self.actType) end +-- 如果还有需要显示的 则直接刷新而不是关闭本界面 function GiftPopUI:checkNextPopGiftOrClose() - local actId = DataManager.ShopData:getNextPopGiftData(self.actType) - if actId then + local actType, actId = DataManager.ShopData:getNextPopGiftData(self.actType, self.actId) + if actType and actId then -- 更新数据 + self.actType = actType self.actId = actId self:refresh() -- 移除弹窗列表 - DataManager.ShopData:removePopUpGift(self.actType, actId) + DataManager.ShopData:removePopUpGift(self.actType, self.actId) else self:closeUI() end diff --git a/lua/app/userdata/shop/shop_data.lua b/lua/app/userdata/shop/shop_data.lua index f2a8ca12..bbd8d837 100644 --- a/lua/app/userdata/shop/shop_data.lua +++ b/lua/app/userdata/shop/shop_data.lua @@ -148,14 +148,57 @@ function ShopData:getPopUpGiftByType(actType) return self.needPopUpGift and self.needPopUpGift[actType] end --- 获取下一个需要弹出的同类型礼包数据 -function ShopData:getNextPopGiftData(actType) - local popUpGift = self:getPopUpGiftByType(actType) - if popUpGift and #popUpGift > 0 then - for _, actId in ipairs(popUpGift) do - return actId +-- 获取下一个需要弹出的同类型礼包数据,特别的,如果是主界面部分则多个不同类型的也要考虑进去 +function ShopData:getNextPopGiftData(actType, actId) + if GConst.ShopConst.MAIN_UI_POP_TYPE[actType] then + -- 优先找自己类型的,如果是act类则需要找同类型的 + local popUpGift = self:getPopUpGiftByType(actType) + if popUpGift and #popUpGift > 0 then + if actType == PayManager.PURCHARSE_TYPE.ACT_GIFT then + for _, nextActId in ipairs(popUpGift) do + if self:getActGiftConfig()[nextActId].type == self:getActGiftConfig()[actId].type then + return actType, nextActId + end + end + else + for _, nextActId in ipairs(popUpGift) do + return actType, nextActId + end + end + end + -- 按顺序找其他类型的 + if actType ~= PayManager.PURCHARSE_TYPE.ACT_GIFT then + local popUpGift = self:getPopUpGiftByType(PayManager.PURCHARSE_TYPE.ACT_GIFT) + if popUpGift and #popUpGift > 0 then + for _, nextActId in ipairs(popUpGift) do + -- 新手礼包 + if self:getActGiftConfig()[nextActId].type == PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT then + return PayManager.PURCHARSE_TYPE.ACT_GIFT, nextActId + end + -- 助力礼包 + if self:getActGiftConfig()[nextActId].type == PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT then + return PayManager.PURCHARSE_TYPE.ACT_GIFT, nextActId + end + end + end + end + if actType ~= PayManager.PURCHARSE_TYPE.CHAPTER_GIFT then + local popUpGift = self:getPopUpGiftByType(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT) + if popUpGift and #popUpGift > 0 then + for _, nextActId in ipairs(popUpGift) do + return PayManager.PURCHARSE_TYPE.CHAPTER_GIFT, nextActId + end + end + end + else -- 直接返回同类型的即可 + local popUpGift = self:getPopUpGiftByType(actType) + if popUpGift and #popUpGift > 0 then + for _, nextActId in ipairs(popUpGift) do + return actType, nextActId + end end end + return nil end -- 通用礼包结束 ----------------------------------------------------------------------------------------------