From 1035873eef013c1b2629eeba76fc4b7c4b050c92 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Thu, 29 Jun 2023 21:25:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=98=E6=96=97bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/battle/helper/board_helper.lua | 14 ++++++++++---- lua/app/ui/battle/battle_ui_pvp.lua | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lua/app/module/battle/helper/board_helper.lua b/lua/app/module/battle/helper/board_helper.lua index 0b387cf4..851864f5 100644 --- a/lua/app/module/battle/helper/board_helper.lua +++ b/lua/app/module/battle/helper/board_helper.lua @@ -24,13 +24,18 @@ end function BoardHelper:findPvpLinkOptimalSolution(battleController, startRow, endRow) local battleData = battleController.battleData local gridMap = BoardHelper:getEmptyTable() - local minRow = math.min(startRow, endRow) - local maxRow = math.max(startRow, endRow) - for row = minRow, maxRow do -- 遍历所有的可使用格子 + local gridEntities = BoardHelper:getEmptyTable() + local step = 1 + if startRow > endRow then + step = -1 + end + + for row = startRow, endRow, step do -- 遍历所有的可使用格子 for column = 1, BattleConst.COLUMN_COUNT do local posId = ModuleManager.BattleManager:getPosId(row, column) local gridEntity = battleData:getGridEnties()[posId] if gridEntity and gridEntity:canLink() then + table.insert(gridEntities, posId) gridMap[posId] = gridEntity end end @@ -38,7 +43,8 @@ function BoardHelper:findPvpLinkOptimalSolution(battleController, startRow, endR local maxPath local maxPathCount = 0 - for posId, entity in pairs(gridMap) do + for _, posId in pairs(gridEntities) do + local entity = gridMap[posId] local mainElementType if not entity:getSkillId() then mainElementType = entity:getElementType() diff --git a/lua/app/ui/battle/battle_ui_pvp.lua b/lua/app/ui/battle/battle_ui_pvp.lua index 9f20c9cd..e2077f9a 100644 --- a/lua/app/ui/battle/battle_ui_pvp.lua +++ b/lua/app/ui/battle/battle_ui_pvp.lua @@ -234,9 +234,9 @@ end function BattleBaseUI:enterHideBoardAni(callback) self:clearEnterShowBoardSeq() self.enterShowBoardSeq = self.root:createBindTweenSequence() + self.enterShowBoardSeq:AppendInterval(0.5) local w, h = GFunc.getUIExpandScreenSize() self.enterShowBoardSeq:Append(self:getBoardRootNode():getTransform():DOLocalMoveX(w / 2 + 360, 0.5)) - self.enterShowBoardSeq:AppendInterval(0.5) self.enterShowBoardSeq:AppendCallback(function() if callback then callback()