From b64ea50f65ceb1a0a44980e85dfb24688be3a105 Mon Sep 17 00:00:00 2001 From: CloudJ Date: Tue, 30 May 2023 10:38:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E6=A8=A1=E5=BC=8F=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0mall=5Ftreasure=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/config_manager.lua | 221 ++++++++++++++++++++++ lua/app/ui/main_city/main_city_ui.lua | 63 +++--- lua/app/ui/shop/first_recharge_pop_ui.lua | 2 +- lua/app/userdata/shop/shop_data.lua | 1 + 4 files changed, 256 insertions(+), 31 deletions(-) diff --git a/lua/app/common/config_manager.lua b/lua/app/common/config_manager.lua index 9ea71610..1c134300 100644 --- a/lua/app/common/config_manager.lua +++ b/lua/app/common/config_manager.lua @@ -11,6 +11,9 @@ function ConfigManager:_getConfig(configName) end function ConfigManager:getConfig(configName) + if CS.BF.BFMain.IsShenhe and configName == "mall_treasure" then + return self:getMallTreasureConfig().data + end local config = self.configs[configName] if config == nil then config = self:_getConfig(configName) @@ -121,4 +124,222 @@ function ConfigManager:clearConfigCache(configName) package.loaded[CONFIG_PATH .. configName] = nil end +function ConfigManager:getMallTreasureConfig() + local mallTreasure = { + [1]={ + ["recharge_id"]=1, + ["reward"]={ + { + ["type"]=1, + ["id"]=2, + ["num"]=30 + } + }, + ["limit"]=1 + }, + [2]={ + ["recharge_id"]=2, + ["reward"]={ + { + ["type"]=1, + ["id"]=2, + ["num"]=60 + } + }, + ["limit"]=1 + }, + [3]={ + ["recharge_id"]=3, + ["reward"]={ + { + ["type"]=1, + ["id"]=2, + ["num"]=90 + } + }, + ["limit"]=2 + }, + [4]={ + ["recharge_id"]=4, + ["reward"]={ + { + ["type"]=1, + ["id"]=2, + ["num"]=120 + } + }, + ["limit"]=2 + }, + [5]={ + ["recharge_id"]=5, + ["reward"]={ + { + ["type"]=1, + ["id"]=2, + ["num"]=150 + } + }, + ["limit"]=2 + }, + [6]={ + ["recharge_id"]=6, + ["reward"]={ + { + ["type"]=1, + ["id"]=2, + ["num"]=180 + } + }, + ["limit"]=3 + }, + [7]={ + ["recharge_id"]=7, + ["reward"]={ + { + ["type"]=1, + ["id"]=2, + ["num"]=210 + } + }, + ["limit"]=3 + }, + [8]={ + ["recharge_id"]=8, + ["reward"]={ + { + ["type"]=1, + ["id"]=2, + ["num"]=240 + } + }, + ["limit"]=3 + }, + [9]={ + ["recharge_id"]=9, + ["reward"]={ + { + ["type"]=1, + ["id"]=2, + ["num"]=270 + } + }, + ["limit"]=3 + }, + [10]={ + ["recharge_id"]=10, + ["reward"]={ + { + ["type"]=1, + ["id"]=2, + ["num"]=300 + } + }, + ["limit"]=3 + }, + [11]={ + ["recharge_id"]=11, + ["reward"]={ + { + ["type"]=1, + ["id"]=2, + ["num"]=360 + } + }, + ["limit"]=3 + }, + [12]={ + ["recharge_id"]=12, + ["reward"]={ + { + ["type"]=1, + ["id"]=2, + ["num"]=450 + } + }, + ["limit"]=3 + }, + [13]={ + ["recharge_id"]=13, + ["reward"]={ + { + ["type"]=1, + ["id"]=2, + ["num"]=600 + } + }, + ["limit"]=3 + }, + [14]={ + ["recharge_id"]=14, + ["reward"]={ + { + ["type"]=1, + ["id"]=2, + ["num"]=750 + } + }, + ["limit"]=3 + }, + [15]={ + ["recharge_id"]=15, + ["reward"]={ + { + ["type"]=1, + ["id"]=2, + ["num"]=900 + } + }, + ["limit"]=3 + }, + [16]={ + ["recharge_id"]=16, + ["reward"]={ + { + ["type"]=1, + ["id"]=2, + ["num"]=1500 + } + }, + ["limit"]=3 + }, + [17]={ + ["recharge_id"]=17, + ["reward"]={ + { + ["type"]=1, + ["id"]=2, + ["num"]=2100 + } + }, + ["limit"]=3 + }, + [18]={ + ["recharge_id"]=18, + ["reward"]={ + { + ["type"]=1, + ["id"]=2, + ["num"]=3000 + } + }, + ["limit"]=3 + }, + [19]={ + ["recharge_id"]=19, + ["reward"]={ + { + ["type"]=1, + ["id"]=2, + ["num"]=6000 + } + }, + ["limit"]=3 + } + } + local config = { + data=mallTreasure,count=12 + } + return config +end + return ConfigManager \ 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 607157f8..48e672c8 100644 --- a/lua/app/ui/main_city/main_city_ui.lua +++ b/lua/app/ui/main_city/main_city_ui.lua @@ -839,26 +839,22 @@ function MainCityUI:checkTutorial() end end --- 检查礼包 +-- 检查礼包(首充/章节/新手/助力/成长/金币顺序) function MainCityUI:checkGift() -- 引导其间不处理 if DataManager.TutorialData:getIsHaveTutorial() then return end -- 章节礼包 - local popUpGift = DataManager.ShopData:getPopUpGiftByType(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT) - if popUpGift and #popUpGift > 0 then - ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT, popUpGift[1]) - return true - end + local chapterPopUpGifts = DataManager.ShopData:getPopUpGiftByType(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT) -- 通用礼包 - local popUpGift = DataManager.ShopData:getPopUpGiftByType(PayManager.PURCHARSE_TYPE.ACT_GIFT) - if popUpGift and #popUpGift > 0 then + local beginnerGiftIds = {} + local levelUpGiftIds = {} + local firstRechargeIds = {} + local actPopUpGifts = DataManager.ShopData:getPopUpGiftByType(PayManager.PURCHARSE_TYPE.ACT_GIFT) + if actPopUpGifts and #actPopUpGifts > 0 then -- 先遍历找出符合弹出的类型 - local beginnerGiftIds = {} - local levelUpGiftIds = {} - local firstRechargeIds = {} - for _, actId in ipairs(popUpGift) do + for _, actId in ipairs(actPopUpGifts) do local cfgInfo = DataManager.ShopData:getActGiftConfig()[actId] if cfgInfo then -- 新手礼包 @@ -875,26 +871,33 @@ function MainCityUI:checkGift() end end end - -- 首充礼包 - if #firstRechargeIds then - ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, firstRechargeIds[1]) - return true - end - -- 新手礼包 - if #beginnerGiftIds > 0 then - ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, beginnerGiftIds[1]) - return true - end - -- 助力礼包 - if #levelUpGiftIds then - ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, levelUpGiftIds[1]) - return true - end end -- 特殊的 成长礼包 - local popUpGift = DataManager.ShopData:getPopUpGiftByType(PayManager.PURCHARSE_TYPE.GROW_UP_GIFT) - if popUpGift and #popUpGift > 0 then - ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.GROW_UP_GIFT, popUpGift[1]) + local growUpPopUpGifts = DataManager.ShopData:getPopUpGiftByType(PayManager.PURCHARSE_TYPE.GROW_UP_GIFT) + -- 按顺序弹出(首充/章节/新手/助力/成长/金币顺序) + -- 首充礼包 + if #firstRechargeIds then + ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, firstRechargeIds[1]) + return true + end + -- 章节礼包 + if chapterPopUpGifts and #chapterPopUpGifts > 0 then + ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT, chapterPopUpGifts[1]) + return true + end + -- 新手礼包 + if #beginnerGiftIds > 0 then + ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, beginnerGiftIds[1]) + return true + end + -- 助力礼包 + if #levelUpGiftIds then + ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, levelUpGiftIds[1]) + return true + end + -- 成长礼包 + if growUpPopUpGifts and #growUpPopUpGifts > 0 then + ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.GROW_UP_GIFT, growUpPopUpGifts[1]) return true end end diff --git a/lua/app/ui/shop/first_recharge_pop_ui.lua b/lua/app/ui/shop/first_recharge_pop_ui.lua index 4090f6ab..b952631d 100644 --- a/lua/app/ui/shop/first_recharge_pop_ui.lua +++ b/lua/app/ui/shop/first_recharge_pop_ui.lua @@ -33,7 +33,7 @@ function FirstRechargePopUI:onLoadRootComplete() end self.descText = self.uiMap["first_recharge_pop_ui.bg.desc_text"] - self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_35)) -- 充值购买任意商品,即可获得如下奖励,仅此一次! + self.descText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_35)) -- 充值购买任意商品,即可获得如下奖励,仅此一次! self.funcBtn = self.uiMap["first_recharge_pop_ui.bg.func_btn"] self.btnJumpText = self.uiMap["first_recharge_pop_ui.bg.func_btn.jump_text"] diff --git a/lua/app/userdata/shop/shop_data.lua b/lua/app/userdata/shop/shop_data.lua index 9c75981d..d5cfc83e 100644 --- a/lua/app/userdata/shop/shop_data.lua +++ b/lua/app/userdata/shop/shop_data.lua @@ -119,6 +119,7 @@ function ShopData:markPopUpGift(actType, actId) self.needPopUpGift[actType] = {} end table.insert(self.needPopUpGift[actType], actId) + table.sort(self.needPopUpGift[actType]) end function ShopData:removePopUpGift(actType, actId)