diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index 32e96cb1..104d97be 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -310,7 +310,25 @@ function BattleController:enterEliminationBegin() self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_BEGIN self:onEliminationBegin() self:popBoardCacheSkill(function() - self:enterElimination() + -- 检查棋盘 + local find, pathList = self:findAttention() + if not find then -- 如果没找到,就要打乱棋盘 + -- todo + Logger.logHighlight("----- 处于无法消除状态 -----") + else + self.attentionList = pathList + -- ModuleManager.BattleManager:performWithDelayGlobal(function() + -- for _, posId in ipairs(pathList) do + -- local entity = self.battleData:getGridEntity(posId) + -- Logger.logHighlight(entity:getCell() == nil) + -- if entity and entity:getCell() then + -- entity:getCell():showAni() + -- end + -- end + -- end, 2) + + self:enterElimination() + end end) end @@ -374,7 +392,6 @@ function BattleController:enterDefStepOver() return end - ---- 临时直接调用 self:enterRefreshBoard() end @@ -1274,6 +1291,60 @@ function BattleController:snapshotBoard() return snapshot end +function BattleController:showAttention() + if not self.attentionList then + return + end + + if self.attentionSid then + ModuleManager.BattleManager:unscheduleGlobal(self.attentionSid) + self.attentionSid = nil + end + + self.attentionSid = ModuleManager.BattleManager:performWithDelayGlobal(function() + for _, posId in ipairs(self.attentionList) do + local entity = self.battleData:getGridEntity(posId) + if entity and entity:getCell() then + entity:getCell():showAni() + end + end + end, 2) +end + +function BattleController:shuffleBoard() + -- local posList = {} + -- local gridEntityList = {} + -- local elementList = {} + -- for posId, entity in pairs(self.battleData:getGridEnties()) do + -- table.insert(posList, posId) + -- table.insert(gridEntityList, entity) + -- if entity:canLink() then + -- table.insert(elementList, entity) + -- end + -- end + + -- local needCount = self:getMinEliminationCount() + -- local tempMap = {} + -- while needCount > 0 do + -- local find = false + -- for _, entity1 in ipairs(elementList) do + -- if not tempMap[entity1:getPosId] then + -- tempMap[entity1:getPosId] = true + -- for _, entity2 in ipairs(elementList) do + -- if not tempMap[entity2:getPosId] then + -- if entity2: then + -- -- body + -- end + -- end + -- end + -- end + -- end + -- if not find then + -- break + -- end + -- end +end + function BattleController:findAttention() local find = false local posIdMap = {} diff --git a/lua/app/ui/battle/cell/grid_cell.lua b/lua/app/ui/battle/cell/grid_cell.lua index 4eeb9c1e..d9f9d18b 100644 --- a/lua/app/ui/battle/cell/grid_cell.lua +++ b/lua/app/ui/battle/cell/grid_cell.lua @@ -114,4 +114,14 @@ function GridCell:resetTranform() end +function GridCell:showAni() + local uiMap = self:getUIMap() + GFunc.getShakeSeq(uiMap["grid_cell.touch_node.ani_node"], false, 1, true) +end + +function GridCell:hideAni() + local uiMap = self:getUIMap() + GFunc.getShakeSeq(uiMap["grid_cell.touch_node.ani_node"], true) +end + return GridCell \ No newline at end of file