战斗优化调整

This commit is contained in:
xiekaidong 2023-09-12 12:23:07 +08:00
parent 61b73d9c8f
commit 1ef1f34c7a
7 changed files with 117 additions and 35 deletions

View File

@ -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

View File

@ -174,6 +174,13 @@ function DungeonRuneManager:getTaskStatus(battleControllerRune, taskInfo)
local taskProgress = {}
for index, condition in ipairs(taskInfo) do
local progress = battleControllerRune:getRuneTaskNumByType(condition)
if condition[1] == GConst.DungeonRuneConst.TASK_TYPE.PASS_ROUND then
taskProgress[index] = {
progress = battleControllerRune.dungeonRuneMaxRoundCount - battleControllerRune.dungeonRuneRemainRoundCount,
totalProgress = battleControllerRune.dungeonRuneMaxRoundCount,
over = false
}
else
if progress then
taskProgress[index] = {
progress = progress,
@ -182,6 +189,7 @@ function DungeonRuneManager:getTaskStatus(battleControllerRune, taskInfo)
}
end
end
end
return taskProgress
end

View File

@ -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("<color=%s>(%s/%s)</color>", 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)

View File

@ -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

View File

@ -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

View File

@ -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("<color=%s>(%s/%s)</color>", color, info.progress, info.totalProgress)
-- local color = "#FF4949"
-- if over then
-- color = "#49FF49"
-- end
-- desc = desc .. string.format("<color=%s>(%s/%s)</color>", color, info.progress, info.totalProgress)
end
cell:refresh(desc, condition, over)
count = count + 1

View File

@ -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