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 e551a9c3..7f6652e9 100644 --- a/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua +++ b/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua @@ -383,7 +383,7 @@ function BattleControllerDungeonRune:getRuneTaskAllOver() local chapterCondition = runeData:getChapterCondition(self.chapterId) local taskProgress = ModuleManager.DungeonRuneManager:getTaskStatus(self, chapterCondition) local taskOver = true - for type, info in pairs(taskProgress) do + for index, info in pairs(taskProgress) do if not info.over then taskOver = false break diff --git a/lua/app/module/dungeon_rune/dungeon_rune_manager.lua b/lua/app/module/dungeon_rune/dungeon_rune_manager.lua index 6111ff66..a303b12e 100644 --- a/lua/app/module/dungeon_rune/dungeon_rune_manager.lua +++ b/lua/app/module/dungeon_rune/dungeon_rune_manager.lua @@ -175,7 +175,7 @@ function DungeonRuneManager:getTaskStatus(battleControllerRune, taskInfo) for index, condition in ipairs(taskInfo) do local progress = battleControllerRune:getRuneTaskNumByType(condition) if progress then - taskProgress[condition[1]] = { + taskProgress[index] = { progress = progress, totalProgress = condition[3], over = progress >= condition[3] diff --git a/lua/app/ui/battle/battle_rune_result_ui.lua b/lua/app/ui/battle/battle_rune_result_ui.lua index 1c4ea205..cc33de6c 100644 --- a/lua/app/ui/battle/battle_rune_result_ui.lua +++ b/lua/app/ui/battle/battle_rune_result_ui.lua @@ -207,13 +207,14 @@ function BattleRuneResultUI:refreshTaskNode() local taskProgress = ModuleManager.DungeonRuneManager:getTaskStatus(ModuleManager.BattleManager.battleController, chapterCondition) for index, objs in ipairs(self.runeTaskCells) do - local condition = chapterCondition[index + 1] + local newIndex = index + 1 + local condition = chapterCondition[newIndex] if condition then objs.cell:getBaseObject():setActive(true) local desc = self.runeData:getConditionDesc(condition) local over = false - if taskProgress[condition[1]] then - local info = taskProgress[condition[1]] + if taskProgress[newIndex] then + local info = taskProgress[newIndex] over = info.over local color = "#FF4949" if over then diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index f4cd4d23..520c0b14 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -4,6 +4,7 @@ local GRID_CELL = "app/ui/battle/cell/grid_cell" local SELECT_SKILL_CELL = "app/ui/battle/cell/select_skill_cell" local BATTLE_SELECT_SKILL_COMP = "app/ui/battle/battle_skill_select_comp" local ELIMINATION_TOUCH_EVENT = GConst.ELIMINATION_TOUCH_EVENT +local BATTLE_TASK_CELL = "app/ui/battle/cell/battle_task_cell" local DEFAULT_X = 10000 local BOARD_POS_UP = BF.Vector2(0, 47) @@ -31,6 +32,16 @@ function BattleUI:initBaseInfo() self.gridEdgeCacheCell = uiMap["battle_ui.cache_node.grid_edge_cell"] self.topNode = uiMap["battle_ui.top_node"] + -- taskNode + self.taskNode = uiMap["battle_ui.top_node.task_node"] + 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) + end + end + + if self.topNode then local comp = self.topNode:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_CANVAS_SORTING_ORDER_HELPER) if not comp then diff --git a/lua/app/ui/battle/cell/battle_task_cell.lua b/lua/app/ui/battle/cell/battle_task_cell.lua new file mode 100644 index 00000000..1173f05e --- /dev/null +++ b/lua/app/ui/battle/cell/battle_task_cell.lua @@ -0,0 +1,31 @@ +local BattleTaskCell = class("BattleTaskCell", BaseCell) + +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"] + icon:setSprite(iconAtlas, iconName) + + desc:setText(taskNum) + self:hidePoint(not taskNum) + + self:hidePoint(false) +end + +function BattleTaskCell:hidePoint(hide) + local uiMap = self:getUIMap() + local point = uiMap["rune_task_cell.point"] + local desc = uiMap["rune_task_cell.desc"] + point:setVisible(not hide) + desc:setVisible(not hide) +end + +function BattleTaskCell:addClickListener(func) + self:getBaseObject():addClickListener(func) +end + +return BattleTaskCell \ No newline at end of file diff --git a/lua/app/ui/battle/cell/battle_task_cell.lua.meta b/lua/app/ui/battle/cell/battle_task_cell.lua.meta new file mode 100644 index 00000000..cefc31b2 --- /dev/null +++ b/lua/app/ui/battle/cell/battle_task_cell.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 826bfda5c26cbc54eb4eddaac91b31da +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} 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 1ca3764e..6f1c7479 100644 --- a/lua/app/ui/dungeon_rune/dungeon_rune_task_ui.lua +++ b/lua/app/ui/dungeon_rune/dungeon_rune_task_ui.lua @@ -34,13 +34,14 @@ function DungeonRuneTaskUI:_display() local count = 0 local taskProgress = ModuleManager.DungeonRuneManager:getTaskStatus(ModuleManager.BattleManager.battleController, chapterCondition) for index, cell in ipairs(self.taskCells) do - local condition = chapterCondition[index + 1] + local newIndex = index + 1 + local condition = chapterCondition[newIndex] if condition then cell:getBaseObject():setActive(true) local desc = self.runeData:getConditionDesc(condition) local over = false - if taskProgress[condition[1]] then - local info = taskProgress[condition[1]] + if taskProgress[newIndex] then + local info = taskProgress[newIndex] over = info.over local color = "#FF4949" if over then