From 71820d787f09981685c4420b15ac9e6a3ce66727 Mon Sep 17 00:00:00 2001 From: puxuan <413323644@qq.com> Date: Mon, 20 Oct 2025 11:09:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=BF=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/bi_report.lua | 1 + lua/app/common/event_manager.lua | 1 + lua/app/config/strings/cn/global.lua | 2 +- lua/app/module/battle/battle_manager.lua | 7 +- .../controller/battle_base_controller.lua | 24 +++++-- .../battle_controller_daily_challenge.lua | 14 ++++ .../controller/battle_controller_stage.lua | 14 ++++ lua/app/ui/battle/battle_result_ui.lua | 67 +++++++++++++++++++ lua/app/ui/battle/battle_revive_ui.lua | 29 +++++++- .../ui/battle/battle_skill_select_comp.lua | 14 +++- lua/app/userdata/chapter/chapter_data.lua | 33 ++++++++- .../daily_challenge/daily_challenge_data.lua | 44 ++++++++++++ 12 files changed, 232 insertions(+), 18 deletions(-) diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index 7eed752a..f146e5f7 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -233,6 +233,7 @@ BIReport.ADS_CLICK_TYPE = { BATTLE_SKILL_DEITY = "BattleSkillDeity", BATTLE_DOUBLE_BOX = "BattleDoubleBox", BATTLE_REVIVE = "BattleRevive", + BATTLE_RESULT_DOUBLE = "BattleResultDouble", AD_ENERGY = "AdEnergy", TASK_DAILY_REFRESH = "TaskDailyRefresh", TASK_DAILY_TASK = "TaskDailyTask", diff --git a/lua/app/common/event_manager.lua b/lua/app/common/event_manager.lua index 8b0d0710..907c84dd 100644 --- a/lua/app/common/event_manager.lua +++ b/lua/app/common/event_manager.lua @@ -86,6 +86,7 @@ EventManager.CUSTOM_EVENT = { CHANGE_ACTIVITY_PAGE = "CHANGE_ACTIVITY_PAGE", BATTLE_REVIVE = "BATTLE_REVIVE", BATTLE_REVIVE_FAILED = "BATTLE_REVIVE_FAILED", + BATTLE_DOUBLE_REWARD = "BATTLE_DOUBLE_REWARD", CROSS_DAY = "CROSS_DAY",-- 跨天 diff --git a/lua/app/config/strings/cn/global.lua b/lua/app/config/strings/cn/global.lua index 2ac5d2cd..06277e05 100644 --- a/lua/app/config/strings/cn/global.lua +++ b/lua/app/config/strings/cn/global.lua @@ -919,7 +919,7 @@ local localization_global = ["ADS_DESC_5"] = "额外2级齿轮", ["ADS_DESC_6"] = "是否观看广告,获得额外2级齿轮", ["ADS_DESC_7"] = "时光回溯", - ["ADS_DESC_9"] = "可回到本波开始前并获得{0}水晶", + ["ADS_DESC_9"] = "战斗失败,是否复活?", ["ADS_DESC_10"] = "放弃复活", ["ADS_DESC_11"] = "刷新齿轮", ["ADS_DESC_12"] = "是否观看广告,免费刷新齿轮?", diff --git a/lua/app/module/battle/battle_manager.lua b/lua/app/module/battle/battle_manager.lua index ddb6fc56..56d55821 100644 --- a/lua/app/module/battle/battle_manager.lua +++ b/lua/app/module/battle/battle_manager.lua @@ -96,8 +96,8 @@ function BattleManager:showBoxOpenUI(rewards, callback) UIManager:showUI("app/ui/battle/battle_box_open_ui", {rewards = rewards, callback = callback}) end -function BattleManager:showBattleReviveUI(callback) - UIManager:showUI("app/ui/battle/battle_revive_ui", {callback = callback}) +function BattleManager:showBattleReviveUI(battleType, callback) + UIManager:showUI("app/ui/battle/battle_revive_ui", {battleType = battleType, callback = callback}) end function BattleManager:reqSkillRefresh(isAll, deitySkillIdx, isDoubleBox) @@ -154,9 +154,6 @@ function BattleManager:rspChapterDoubleReward(result) if result.err_code ~= GConst.ERROR_STR.SUCCESS then return end - if result.rewards then - GFunc.showRewardBox(result.rewards) - end EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.BATTLE_DOUBLE_REWARD) end diff --git a/lua/app/module/battle/controller/battle_base_controller.lua b/lua/app/module/battle/controller/battle_base_controller.lua index 94fa8b2a..5a44c304 100644 --- a/lua/app/module/battle/controller/battle_base_controller.lua +++ b/lua/app/module/battle/controller/battle_base_controller.lua @@ -111,6 +111,18 @@ function BattleBaseController:refreshWave() self.battleUI:refreshWave(self:getWaveIndex()) end +function BattleBaseController:canRevive() + return false +end + +function BattleBaseController:hadAdDeityCount() + return false +end + +function BattleBaseController:canGetDoubleRewards() + return false +end + -- 战斗结束 function BattleBaseController:controllBattleEnd() end @@ -2479,9 +2491,10 @@ function BattleBaseController:getRandomSkillList(getCount, isGodSkill, excludeMa local result = table.shuffle(self.randomSkillList) if isGodSkill then - local count = self.battleData:getAdDeityCount() - local cfgCount = GFunc.getConstIntValue("ads_deity_get_limit") - if cfgCount > count then + -- local count = self.battleData:getAdDeityCount() + -- local cfgCount = GFunc.getConstIntValue("ads_deity_get_limit") + -- if cfgCount > count then + if self:hadAdDeityCount() then local randomSkillNewSkillPool = {} local randomSkillSkillWeight = {} for skillId, info in pairs(cfg) do @@ -3264,11 +3277,14 @@ function BattleBaseController:adRevive(revive) end function BattleBaseController:checkRevive() + if not self:canRevive() then + return false + end if self.battleData:getIsRevive() then return false end self.battleData:setIsRevive(true) - ModuleManager.BattleManager:showBattleReviveUI(function(revive) + ModuleManager.BattleManager:showBattleReviveUI(self.battleType, function(revive) self:adRevive(revive) end) return true diff --git a/lua/app/module/battle/controller/battle_controller_daily_challenge.lua b/lua/app/module/battle/controller/battle_controller_daily_challenge.lua index 68c539f1..7d206eba 100644 --- a/lua/app/module/battle/controller/battle_controller_daily_challenge.lua +++ b/lua/app/module/battle/controller/battle_controller_daily_challenge.lua @@ -3,6 +3,20 @@ local BattleController = require "app/module/battle/controller/battle_controller local BattleControllerDailyChallenge = class("BattleControllerDailyChallenge", BattleController) local BattleBuffEntity = require "app/userdata/battle/skill/battle_buff_entity" +function BattleControllerDailyChallenge:canRevive() + return true +end + +function BattleControllerDailyChallenge:hadAdDeityCount() + local count = self.battleData:getAdDeityCount() + local cfgCount = GFunc.getConstIntValue("daily_challenge_ads_deity_get_limit") + return cfgCount > count +end + +function BattleControllerDailyChallenge:canGetDoubleRewards() + return DataManager.DailyChallengeData:canAdDouble() +end + function BattleControllerDailyChallenge:getBoardConfig() return ConfigManager:getConfig("chapter_board_daily_challenge") end diff --git a/lua/app/module/battle/controller/battle_controller_stage.lua b/lua/app/module/battle/controller/battle_controller_stage.lua index d2e46203..941c2532 100644 --- a/lua/app/module/battle/controller/battle_controller_stage.lua +++ b/lua/app/module/battle/controller/battle_controller_stage.lua @@ -1,6 +1,20 @@ local BattleController = require "app/module/battle/controller/battle_controller" local BattleControllerStage = class("BattleControllerStage", BattleController) +function BattleControllerStage:canRevive() + return true +end + +function BattleControllerStage:hadAdDeityCount() + local count = self.battleData:getAdDeityCount() + local cfgCount = GFunc.getConstIntValue("ads_deity_get_limit") + return cfgCount > count +end + +function BattleControllerStage:canGetDoubleRewards() + return DataManager.ChapterData:canAdDouble() +end + function BattleControllerStage:getBoardConfig() return ConfigManager:getConfig("chapter_board") end diff --git a/lua/app/ui/battle/battle_result_ui.lua b/lua/app/ui/battle/battle_result_ui.lua index 2927cef5..f3bc2b0e 100644 --- a/lua/app/ui/battle/battle_result_ui.lua +++ b/lua/app/ui/battle/battle_result_ui.lua @@ -46,6 +46,7 @@ function BattleResultUI:ctor(params) GFunc.mergeRewards2(self.rewards, newRewards) self.rewards = newRewards end + self.isDouble = false end function BattleResultUI:onClose() @@ -121,6 +122,24 @@ function BattleResultUI:onLoadRootComplete() self.arenaBoxBtnGet = uiMap["battle_result_ui.arena_box_node.btn_get"] self.arenaBoxTxGet = uiMap["battle_result_ui.arena_box_node.btn_get.tx_get"] + self.doubleNode = uiMap["battle_result_ui.double_node"] + self.doubleOkBtn = uiMap["battle_result_ui.double_node.ok_btn"] + self.doubleOkBtnTx = uiMap["battle_result_ui.double_node.ok_btn.tx"] + self.doubleBtn = uiMap["battle_result_ui.double_node.double_btn"] + self.doubleBtnAdImg = uiMap["battle_result_ui.double_node.double_btn.ad_img"] + self.doubleBtnTx = uiMap["battle_result_ui.double_node.double_btn.tx"] + self.doubleBtnLimitTx = uiMap["battle_result_ui.double_node.double_btn.limit_tx"] + self.doubleOkBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK)) + self.doubleBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.ADS_DESC_14)) + + self.doubleOkBtn:addClickListener(function() + self:onClickMask() + end) + self.doubleBtn:addClickListener(function() + SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.BATTLE_RESULT_DOUBLE, function() + self:onGetDouble() + end) + end) self.victoryMask:addClickListener(function() self:onClickMask() end) @@ -135,6 +154,9 @@ function BattleResultUI:onLoadRootComplete() self:refreshRewards() self:refreshArenaBoxNode() end) + self:addEventListener(EventManager.CUSTOM_EVENT.BATTLE_DOUBLE_REWARD, function() + self:onReviveDouble() + end) end function BattleResultUI:onClickMask() @@ -153,6 +175,7 @@ function BattleResultUI:onRefresh() self:refreshRewards() self:refreshArenaNode() self:refreshArenaBoxNode() + self:refreshDoubleNode() end function BattleResultUI:refreshVictoryNode() @@ -357,6 +380,9 @@ function BattleResultUI:refreshRewards() end cell:showRightUpIcon(index <= self.mysteryBoxIdx, GConst.ATLAS_PATH.COMMON, "common_chest_1") cell:showFirstPass(index <= self.firstPassIdx) + if self.isDouble then + cell:setNumTx(self.rewards[index].num * 2) + end end) if self:hasArenaBoxNode() then self.rewardScrollRect:setSizeDeltaY(SCROLL_LINE_HEIGHT) @@ -444,4 +470,45 @@ function BattleResultUI:showRewardAppearAnim(idx, cell) return animRewardAppear end +--@region 双倍奖励 +function BattleResultUI:refreshDoubleNode() + if self.battleType ~= GConst.BattleConst.BATTLE_TYPE.STAGE and self.battleType ~= GConst.BattleConst.BATTLE_TYPE.DAILY_CHALLENGE then + self.doubleNode:setActive(false) + return + end + if self.battleType == GConst.BattleConst.BATTLE_TYPE.STAGE then + if not DataManager.ChapterData:canAdDouble() then + self.doubleNode:setActive(false) + else + self.doubleNode:setActive(true) + GFunc.setAdsSprite(self.doubleBtnAdImg) + self.doubleBtnLimitTx:setText(DataManager.ChapterData:getReDoubleCount() .. "/" .. GFunc.getConstIntValue("ads_double_rewards_limit")) + self.doubleOkBtn:setAnchoredPositionX(125) + self.doubleBtn:setActive(true) + end + end + if self.battleType == GConst.BattleConst.BATTLE_TYPE.DAILY_CHALLENGE then + if not DataManager.DailyChallengeData:canAdDouble() then + self.doubleNode:setActive(false) + else + self.doubleNode:setActive(true) + GFunc.setAdsSprite(self.doubleBtnAdImg) + self.doubleBtnLimitTx:setText(DataManager.DailyChallengeData:getReDoubleCount() .. "/" .. GFunc.getConstIntValue("daily_challenge_ads_double_rewards_limit")) + self.doubleOkBtn:setAnchoredPositionX(125) + self.doubleBtn:setActive(true) + end + end +end + +function BattleResultUI:onGetDouble() + ModuleManager.BattleManager:reqChapterDoubleReward() +end + +function BattleResultUI:onReviveDouble() + self.isDouble = true + self:refreshRewards() + self.doubleOkBtn:setAnchoredPositionX(0) + self.doubleBtn:setActive(false) +end +--@endregion return BattleResultUI \ No newline at end of file diff --git a/lua/app/ui/battle/battle_revive_ui.lua b/lua/app/ui/battle/battle_revive_ui.lua index 76be399b..0dc42c57 100644 --- a/lua/app/ui/battle/battle_revive_ui.lua +++ b/lua/app/ui/battle/battle_revive_ui.lua @@ -7,6 +7,7 @@ end function BattleReviveUI:ctor(params) params = params or {} self.callback = params.callback + self.battleType = params.battleType end function BattleReviveUI:getPrefabPath() @@ -29,12 +30,19 @@ function BattleReviveUI:_display() self.adBtn = uiMap["battle_revive_ui.bg.ad_btn"] self.adIcon = uiMap["battle_revive_ui.bg.ad_btn.icon"] self.adTx = uiMap["battle_revive_ui.bg.ad_btn.tx"] + self.adLimitTx = uiMap["battle_revive_ui.limit_tx"] self.cancelBtn = uiMap["battle_revive_ui.bg.cancel_btn"] self.cancelTx = uiMap["battle_revive_ui.bg.cancel_btn.tx"] self.title1Tx:setText(I18N:getGlobalText(I18N.GlobalConst.ADS_DESC_7)) + self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.ADS_DESC_9)) -- self.title2Tx:setText(I18N:getGlobalText(I18N.GlobalConst.ADS_DESC_8)) - self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.ADS_DESC_9, GFunc.getConstIntValue("ads_revive_limit"))) + if self.battleType == GConst.BattleConst.BATTLE_TYPE.STAGE then + self.adLimitTx:setText(DataManager.ChapterData:getReReviveCount() .. "/" .. GFunc.getConstIntValue("ads_revive_limit")) + elseif self.battleType == GConst.BattleConst.BATTLE_TYPE.DAILY_CHALLENGE then + self.adLimitTx:setText(DataManager.DailyChallengeData:getReReviveCount() .. "/" .. GFunc.getConstIntValue("daily_challenge_ads_revive_limit")) + end + self.adTx:setText(I18N:getGlobalText(I18N.GlobalConst.FREE_DESC)) self.cancelTx:setText(I18N:getGlobalText(I18N.GlobalConst.ADS_DESC_10)) @@ -53,14 +61,21 @@ function BattleReviveUI:_display() -- self.fx:setActive(false) -- 根据复活次数更新按钮位置 - local canAdRevive = DataManager.ChapterData:canAdRevive() + local canAdRevive = false + if self.battleType == GConst.BattleConst.BATTLE_TYPE.STAGE then + canAdRevive = DataManager.ChapterData:canAdRevive() + elseif self.battleType == GConst.BattleConst.BATTLE_TYPE.DAILY_CHALLENGE then + canAdRevive = DataManager.DailyChallengeData:canAdRevive() + end if not canAdRevive then self.costBtn:setActive(true) self.adBtn:setActive(false) + self.adLimitTx:setActive(false) self.costBtn:setAnchoredPositionX(0) else self.costBtn:setActive(true) self.adBtn:setActive(true) + self.adLimitTx:setActive(true) self.costBtn:setAnchoredPositionX(-144) end @@ -86,7 +101,15 @@ end function BattleReviveUI:_addListeners() self.costBtn:addClickListener(function() - local cost = GFunc.getConstReward("cost_revive") + local cost + if self.battleType == GConst.BattleConst.BATTLE_TYPE.STAGE then + cost = GFunc.getConstReward("cost_revive") + elseif self.battleType == GConst.BattleConst.BATTLE_TYPE.DAILY_CHALLENGE then + cost = GFunc.getConstReward("daily_challenge_cost_revive") + end + if not cost then + return + end if GFunc.checkCost(GConst.ItemConst.ITEM_ID_GEM, cost.num, true) then self:doRevive(false) end diff --git a/lua/app/ui/battle/battle_skill_select_comp.lua b/lua/app/ui/battle/battle_skill_select_comp.lua index 5f4dfd44..d397088d 100644 --- a/lua/app/ui/battle/battle_skill_select_comp.lua +++ b/lua/app/ui/battle/battle_skill_select_comp.lua @@ -92,7 +92,12 @@ function BattleSkillSelectComp:refreshBtns() end local battleController = ModuleManager.BattleManager.battleController - local getAllAdCount = GFunc.getConstIntValue("ads_getall_rogue_limit") + local getAllAdCount = 0 + if ModuleManager.BattleManager.battleController.battleType == GConst.BattleConst.BATTLE_TYPE.STAGE then + getAllAdCount = GFunc.getConstIntValue("ads_getall_rogue_limit") + elseif ModuleManager.BattleManager.battleController.battleType == GConst.BattleConst.BATTLE_TYPE.DAILY_CHALLENGE then + getAllAdCount = GFunc.getConstIntValue("daily_challenge_ads_getall_rogue_limit") + end local allCount = battleController.battleData:getAllSkillCount() if getAllAdCount > allCount then allBtn:setActive(true) @@ -100,7 +105,12 @@ function BattleSkillSelectComp:refreshBtns() allBtn:setActive(false) end - local cfgAdCount = GFunc.getConstIntValue("ad_refresh_skill") + local cfgAdCount = 0 + if ModuleManager.BattleManager.battleController.battleType == GConst.BattleConst.BATTLE_TYPE.STAGE then + cfgAdCount = GFunc.getConstIntValue("ads_refresh_rogue_limit") + elseif ModuleManager.BattleManager.battleController.battleType == GConst.BattleConst.BATTLE_TYPE.DAILY_CHALLENGE then + cfgAdCount = GFunc.getConstIntValue("daily_challenge_ads_refresh_rogue_limit") + end local talentCount = DataManager.TalentData:getSkillRefreshCount() local adCount = battleController.battleData:getADRefreshSkillCount() + talentCount if cfgAdCount > adCount then diff --git a/lua/app/userdata/chapter/chapter_data.lua b/lua/app/userdata/chapter/chapter_data.lua index e330959a..18bbb756 100644 --- a/lua/app/userdata/chapter/chapter_data.lua +++ b/lua/app/userdata/chapter/chapter_data.lua @@ -45,6 +45,7 @@ function ChapterData:init(data, notChangeChapterId) end self.revive = data.revive or 0 self.todayRevive = data.today_revive or 0 + self.todayDouble = data.today_double_mystery or 0 if not notChangeChapterId then self.data.chapterId = data.max_chapter_id @@ -53,6 +54,11 @@ function ChapterData:init(data, notChangeChapterId) self.data.chapterInfo = data.chapter_info or {} self.boxCanGetState = nil self.canGetBoxInfo = {} + + DataManager:registerCrossDayFunc("ChapterData", function() + self.todayRevive = 0 + self.todayDouble = 0 + end) end function ChapterData:getIsFirstChapter(chapterId) @@ -587,9 +593,7 @@ function ChapterData:showRedPoint(chapterId) end --@endregion ---@region 复活 - -- self.revive = data.revive or 0 - -- self.todayRevive = data.today_revive or 0 +--@region 复活 双倍 function ChapterData:addReviveCount() self.revive = self.revive + 1 self.todayRevive = self.todayRevive + 1 @@ -599,10 +603,33 @@ function ChapterData:getReviveCount() return self.todayRevive end +function ChapterData:getReReviveCount() + local cfgAdCount = GFunc.getConstIntValue("ads_revive_limit") + return cfgAdCount - self.todayRevive +end + function ChapterData:canAdRevive() local cfgAdCount = GFunc.getConstIntValue("ads_revive_limit") return self.todayRevive < cfgAdCount end +function ChapterData:addDoubleCount() + self.todayDouble = self.todayDouble + 1 +end + +function ChapterData:getDoubleCount() + return self.todayDouble +end + +function ChapterData:getReDoubleCount() + local cfgAdCount = GFunc.getConstIntValue("ads_double_rewards_limit") + return cfgAdCount - self.todayDouble +end + +function ChapterData:canAdDouble() + local cfgAdCount = GFunc.getConstIntValue("ads_double_rewards_limit") + return self.todayDouble < cfgAdCount +end --@endregion + return ChapterData \ No newline at end of file diff --git a/lua/app/userdata/daily_challenge/daily_challenge_data.lua b/lua/app/userdata/daily_challenge/daily_challenge_data.lua index 6f438559..31dc7c27 100644 --- a/lua/app/userdata/daily_challenge/daily_challenge_data.lua +++ b/lua/app/userdata/daily_challenge/daily_challenge_data.lua @@ -27,6 +27,14 @@ function DailyChallengeData:init(data) self.initDay = Time:getBeginningOfServerToday() self.popTaskTime = LocalData:getChallengeTaskPopTime() self.diffLv = data.level or 1 + self.revive = data.revive or 0 + self.todayRevive = data.today_revive or 0 + self.double = data.double or 0 + self.todayDouble = data.today_double or 0 + DataManager:registerCrossDayFunc("DailyChallengeData", function() + self.todayRevive = 0 + self.todayDouble = 0 + end) self:setDirty() end @@ -336,4 +344,40 @@ function DailyChallengeData:getDifficultyCfg(id) return DAILY_CHALLENGE_LEVEL[id] end --@endregion + +--@region 复活 双倍 +function DailyChallengeData:addReviveCount() + self.revive = self.revive + 1 + self.todayRevive = self.todayRevive + 1 +end + +function DailyChallengeData:getReviveCount() + return self.todayRevive +end + +function DailyChallengeData:canAdRevive() + local cfgAdCount = GFunc.getConstIntValue("daily_challenge_ads_revive_limit") + return self.todayRevive < cfgAdCount +end + +function DailyChallengeData:addDoubleCount() + self.double = self.double + 1 + self.todayDouble = self.todayDouble + 1 +end + +function DailyChallengeData:getDoubleCount() + return self.todayDouble +end + +function DailyChallengeData:getReDoubleCount() + local cfgAdCount = GFunc.getConstIntValue("daily_challenge_ads_double_rewards_limit") + return cfgAdCount - self.todayDouble +end + +function DailyChallengeData:canAdDouble() + local cfgAdCount = GFunc.getConstIntValue("daily_challenge_ads_double_rewards_limit") + return self.todayDouble < cfgAdCount +end +--@endregion + return DailyChallengeData \ No newline at end of file