From 1ef1f34c7aec1ddea7f679b9f95525b2117cd388 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Tue, 12 Sep 2023 12:23:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=98=E6=96=97=E4=BC=98=E5=8C=96=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../battle_controller_dungeon_rune.lua | 32 ++++++++++-- .../dungeon_rune/dungeon_rune_manager.lua | 16 ++++-- lua/app/ui/battle/battle_rune_result_ui.lua | 5 +- lua/app/ui/battle/battle_ui.lua | 51 ++++++++++++++----- lua/app/ui/battle/cell/battle_task_cell.lua | 12 ++--- .../ui/dungeon_rune/dungeon_rune_task_ui.lua | 13 ++--- .../userdata/dungeon/dungeon_rune_entity.lua | 23 ++++++++- 7 files changed, 117 insertions(+), 35 deletions(-) diff --git a/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua b/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua index 7f6652e9..6cb64633 100644 --- a/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua +++ b/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua @@ -24,9 +24,14 @@ function BattleControllerDungeonRune:initOther() self.canRebirthTimes = 1 -- 每次只能复活一次 self.addRoundCount = runeData:getRebirthAddRoundCount() self.dungeonRuneRemainRoundCount = self:getChapterConfig()[self.chapterId].round or 1 + self.dungeonRuneMaxRoundCount = self.dungeonRuneRemainRoundCount if self.battleUI then - self.battleUI:refreshWave(self.dungeonRuneRemainRoundCount, GConst.ATLAS_PATH.COMMON, "common_dec_15") + local desc = self.dungeonRuneRemainRoundCount + if not self.isBossChapter then + desc = I18N:getGlobalText(I18N.GlobalConst.DUNGEON_WEAPON_DESC_6, self.chapterId) + end + self.battleUI:refreshWave(desc, GConst.ATLAS_PATH.COMMON, "common_dec_15") end self.runeMaxLv = runeData:getBattleMaxlv() or 1 @@ -144,14 +149,22 @@ function BattleControllerDungeonRune:onEnterNextWave() end function BattleControllerDungeonRune:enterRoundBegin() + if self.battleUI.refreshTaskNode then + self.battleUI:refreshTaskNode() + end if self.dungeonRuneRemainRoundCount <= 0 then if self.canRebirthTimes > 0 and not self.isBossChapter then ModuleManager.DungeonRuneManager:showRebirthUI(function() self.canRebirthTimes = self.canRebirthTimes - 1 self.dungeonRuneRemainRoundCount = self.dungeonRuneRemainRoundCount + self.addRoundCount + self.dungeonRuneMaxRoundCount = self.dungeonRuneMaxRoundCount + self.addRoundCount self.dungeonRuneRemainRoundCount = self.dungeonRuneRemainRoundCount - 1 if self.battleUI then - self.battleUI:refreshWave(self.dungeonRuneRemainRoundCount + 1, GConst.ATLAS_PATH.COMMON, "common_dec_15") + local desc = self.dungeonRuneRemainRoundCount + 1 + if not self.isBossChapter then + desc = I18N:getGlobalText(I18N.GlobalConst.DUNGEON_WEAPON_DESC_6, self.chapterId) + end + self.battleUI:refreshWave(desc, GConst.ATLAS_PATH.COMMON, "common_dec_15") end BattleController.enterRoundBegin(self) end, function() @@ -169,11 +182,22 @@ function BattleControllerDungeonRune:enterRoundBegin() self.dungeonRuneRemainRoundCount = self.dungeonRuneRemainRoundCount - 1 if self.battleUI then - self.battleUI:refreshWave(self.dungeonRuneRemainRoundCount + 1, GConst.ATLAS_PATH.COMMON, "common_dec_15") + local desc = self.dungeonRuneRemainRoundCount + 1 + if not self.isBossChapter then + desc = I18N:getGlobalText(I18N.GlobalConst.DUNGEON_WEAPON_DESC_6, self.chapterId) + end + self.battleUI:refreshWave(desc, GConst.ATLAS_PATH.COMMON, "common_dec_15") end BattleController.enterRoundBegin(self) end +function BattleControllerDungeonRune:onLinkOverDone(...) + if self.battleUI.refreshTaskNode then + self.battleUI:refreshTaskNode() + end + BattleController.onLinkOverDone(self, ...) +end + function BattleControllerDungeonRune:getNextMonsterId(waveIndex) self:getInitBoard() waveIndex = waveIndex or self:getWaveIndex() + 1 @@ -374,7 +398,7 @@ function BattleControllerDungeonRune:getRuneTaskNumByType(taskInfo) elseif taskType == GConst.DungeonRuneConst.TASK_TYPE.BREAK_GRID_TYPE then return self.totalBreakedGridType[taskParams1] or 0 elseif taskType == GConst.DungeonRuneConst.TASK_TYPE.KILL_MONSTER then - return self:getTaskProgress[GConst.BattleConst.BATTLE_TASK_FIELD.KILL_NORMAL_MONSTER] + return self.getTaskProgress[GConst.BattleConst.BATTLE_TASK_FIELD.KILL_NORMAL_MONSTER] end end diff --git a/lua/app/module/dungeon_rune/dungeon_rune_manager.lua b/lua/app/module/dungeon_rune/dungeon_rune_manager.lua index a303b12e..e0b69a30 100644 --- a/lua/app/module/dungeon_rune/dungeon_rune_manager.lua +++ b/lua/app/module/dungeon_rune/dungeon_rune_manager.lua @@ -174,12 +174,20 @@ function DungeonRuneManager:getTaskStatus(battleControllerRune, taskInfo) local taskProgress = {} for index, condition in ipairs(taskInfo) do local progress = battleControllerRune:getRuneTaskNumByType(condition) - if progress then + if condition[1] == GConst.DungeonRuneConst.TASK_TYPE.PASS_ROUND then taskProgress[index] = { - progress = progress, - totalProgress = condition[3], - over = progress >= condition[3] + progress = battleControllerRune.dungeonRuneMaxRoundCount - battleControllerRune.dungeonRuneRemainRoundCount, + totalProgress = battleControllerRune.dungeonRuneMaxRoundCount, + over = false } + else + if progress then + taskProgress[index] = { + progress = progress, + totalProgress = condition[3], + over = progress >= condition[3] + } + end end end diff --git a/lua/app/ui/battle/battle_rune_result_ui.lua b/lua/app/ui/battle/battle_rune_result_ui.lua index cc33de6c..2a50ac78 100644 --- a/lua/app/ui/battle/battle_rune_result_ui.lua +++ b/lua/app/ui/battle/battle_rune_result_ui.lua @@ -211,7 +211,8 @@ function BattleRuneResultUI:refreshTaskNode() local condition = chapterCondition[newIndex] if condition then objs.cell:getBaseObject():setActive(true) - local desc = self.runeData:getConditionDesc(condition) + local taskNum = taskProgress[index] and taskProgress[index].progress + local desc = self.runeData:getConditionDesc(condition, taskNum) local over = false if taskProgress[newIndex] then local info = taskProgress[newIndex] @@ -223,7 +224,7 @@ function BattleRuneResultUI:refreshTaskNode() desc = desc .. string.format("(%s/%s)", color, info.progress, info.totalProgress) end objs.cell:refresh(condition) - objs.desc:setText(self.runeData:getConditionDesc(condition)) + objs.desc:setText(self.runeData:getConditionDesc(condition, taskNum)) if over then objs.descUnDone:setText(GConst.EMPTY_STRING) objs.check:setVisible(true) diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index 520c0b14..c7eab930 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -37,9 +37,10 @@ function BattleUI:initBaseInfo() if not self.taskCells then self.taskCells = {} for i = 1, 4 do - self.taskCells[i] = CellManager:addCellComp(uiMap["battle_ui.top_node.task_node.battle_task_cell_"], BATTLE_TASK_CELL) + self.taskCells[i] = CellManager:addCellComp(uiMap["battle_ui.top_node.task_node.battle_task_cell_" .. i], BATTLE_TASK_CELL) end end + self.taskNode:setVisible(false) if self.topNode then @@ -490,20 +491,46 @@ function BattleUI:refreshTaskBtn() taskBtn:addClickListener(function() ModuleManager.DungeonArmorManager:showBattleTaskUI() end) - elseif self.battleController.battleType == GConst.BattleConst.BATTLE_TYPE.DUNGEON_RUNE then - local runeData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.RUNES_OPEN) - if runeData:isBossChapter(self.battleController.chapterId) then - taskBtn:setActive(false) - else - taskBtn:setSprite(GConst.ATLAS_PATH.BATTLE, "battle_btn_task_3") - taskBtn:setActive(true) - taskBtn:addClickListener(function() - ModuleManager.DungeonRuneManager:showTaskUI(self.battleController.chapterId) - end) - end else taskBtn:setActive(false) end end +function BattleUI:refreshTaskNode() + if self.battleController.battleType == GConst.BattleConst.BATTLE_TYPE.DUNGEON_RUNE then + self.taskNode:setLocalScale(0.6, 0.6, 0.6) + local runeData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.RUNES_OPEN) + local isBossChapter = runeData:isBossChapter(self.battleController.chapterId) + local chapterCondition = runeData:getChapterCondition(self.battleController.chapterId) + local taskProgress = ModuleManager.DungeonRuneManager:getTaskStatus(self.battleController, chapterCondition) + for index, cell in ipairs(self.taskCells) do + local newIndex = index + if isBossChapter then + newIndex = index + 1 + end + local condition = chapterCondition[newIndex] + if condition then + cell:getBaseObject():setActive(true) + + local atlast, iconName = runeData:getConditionIcon(condition) + local taskNum = condition[3] or 0 + Logger.printTable(taskProgress) + if taskProgress[newIndex] then + taskNum = taskProgress[newIndex].totalProgress - taskProgress[newIndex].progress + if taskNum < 0 then + taskNum = 0 + end + end + cell:refresh(atlast, iconName, taskNum) + cell:addClickListener(function() + ModuleManager.DungeonRuneManager:showTaskUI(self.battleController.chapterId) + end) + else + cell:getBaseObject():setActive(false) + end + end + self.taskNode:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT):RefreshLayout() + end +end + return BattleUI \ No newline at end of file diff --git a/lua/app/ui/battle/cell/battle_task_cell.lua b/lua/app/ui/battle/cell/battle_task_cell.lua index 1173f05e..e1969057 100644 --- a/lua/app/ui/battle/cell/battle_task_cell.lua +++ b/lua/app/ui/battle/cell/battle_task_cell.lua @@ -4,10 +4,10 @@ local BG = {"common_board_131", "common_board_132"} -- 紫绿 function BattleTaskCell:refresh(iconAtlas, iconName, taskNum) local uiMap = self:getUIMap() - local bg = uiMap["rune_task_cell.bg"] - local icon = uiMap["rune_task_cell.icon"] - local point = uiMap["rune_task_cell.point"] - local desc = uiMap["rune_task_cell.desc"] + local bg = uiMap["battle_task_cell.bg"] + local icon = uiMap["battle_task_cell.icon"] + local point = uiMap["battle_task_cell.point"] + local desc = uiMap["battle_task_cell.desc"] icon:setSprite(iconAtlas, iconName) desc:setText(taskNum) @@ -18,8 +18,8 @@ end function BattleTaskCell:hidePoint(hide) local uiMap = self:getUIMap() - local point = uiMap["rune_task_cell.point"] - local desc = uiMap["rune_task_cell.desc"] + local point = uiMap["battle_task_cell.point"] + local desc = uiMap["battle_task_cell.desc"] point:setVisible(not hide) desc:setVisible(not hide) end diff --git a/lua/app/ui/dungeon_rune/dungeon_rune_task_ui.lua b/lua/app/ui/dungeon_rune/dungeon_rune_task_ui.lua index 6f1c7479..6bfe8a59 100644 --- a/lua/app/ui/dungeon_rune/dungeon_rune_task_ui.lua +++ b/lua/app/ui/dungeon_rune/dungeon_rune_task_ui.lua @@ -38,16 +38,17 @@ function DungeonRuneTaskUI:_display() local condition = chapterCondition[newIndex] if condition then cell:getBaseObject():setActive(true) - local desc = self.runeData:getConditionDesc(condition) + local taskNum = taskProgress[index] and taskProgress[index].progress + local desc = self.runeData:getConditionDesc(condition, taskNum) local over = false if taskProgress[newIndex] then local info = taskProgress[newIndex] over = info.over - local color = "#FF4949" - if over then - color = "#49FF49" - end - desc = desc .. string.format("(%s/%s)", color, info.progress, info.totalProgress) + -- local color = "#FF4949" + -- if over then + -- color = "#49FF49" + -- end + -- desc = desc .. string.format("(%s/%s)", color, info.progress, info.totalProgress) end cell:refresh(desc, condition, over) count = count + 1 diff --git a/lua/app/userdata/dungeon/dungeon_rune_entity.lua b/lua/app/userdata/dungeon/dungeon_rune_entity.lua index c5780933..f51df559 100644 --- a/lua/app/userdata/dungeon/dungeon_rune_entity.lua +++ b/lua/app/userdata/dungeon/dungeon_rune_entity.lua @@ -214,18 +214,39 @@ function DungeonRuneEntity:getConditionIcon(taskInfo) return GConst.ATLAS_PATH.UI_DUNGEON_RUNE, iconSprite end -function DungeonRuneEntity:getConditionDesc(taskInfo) +function DungeonRuneEntity:getConditionDesc(taskInfo, taskNum) local taskType = taskInfo[1] local taskParams1 = taskInfo[2] local taskParams2 = taskInfo[3] if taskType == TASK_TYPE.PASS_ROUND then + if taskNum and taskNum > 0 then + taskParams1 = taskNum + end return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_QUEST_1, taskParams1) elseif taskType == TASK_TYPE.ELIMINATION_ELEMENT then + if taskNum and taskNum > 0 then + local num = taskParams2 - taskNum + if num > 0 then + taskParams2 = num + end + end local desc = ModuleManager.HeroManager:getMatchTypeName(taskParams1, true) return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_QUEST_2, taskParams2, desc) elseif taskType == TASK_TYPE.BREAK_GRID_TYPE then + if taskNum and taskNum > 0 then + local num = taskParams2 - taskNum + if num > 0 then + taskParams2 = num + end + end return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_QUEST_3, taskParams2) elseif taskType == TASK_TYPE.KILL_MONSTER then + if taskNum and taskNum > 0 then + local num = taskParams2 - taskNum + if num > 0 then + taskParams2 = num + end + end return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_QUEST_4, taskParams2) end end