diff --git a/lua/app/module/battle/controller/battle_base_controller.lua b/lua/app/module/battle/controller/battle_base_controller.lua index 0ea70f46..bfb616ae 100644 --- a/lua/app/module/battle/controller/battle_base_controller.lua +++ b/lua/app/module/battle/controller/battle_base_controller.lua @@ -1109,10 +1109,7 @@ function BattleBaseController:onLinkOver() self.battleUI:disableUITouch() self.battleUI:eliminationAni(aniSequence, effectGridMap, function() self:enterRefreshBoard(nil, function() - self.battleUI:enterHideBoardAni(function() - self:generateInstructions(skillEntity, linkElementType, lineCount, influenceElementTypeMap, elementTypeMap) - self:enterBattleStep() - end) + self:onLinkOverDone(skillEntity, linkElementType, lineCount, influenceElementTypeMap, elementTypeMap) end) end, self.curActionSide) @@ -1123,6 +1120,13 @@ function BattleBaseController:onLinkOver() end end +function BattleBaseController:onLinkOverDone(skillEntity, linkElementType, lineCount, influenceElementTypeMap, elementTypeMap) + self.battleUI:enterHideBoardAni(function() + self:generateInstructions(skillEntity, linkElementType, lineCount, influenceElementTypeMap, elementTypeMap) + self:enterBattleStep() + end) +end + function BattleBaseController:calculateCurElimination(onlyCheck) local sequence = self.battleData:getGridSequence() local skillId = self.battleData:getSequenceHadSkill() diff --git a/lua/app/module/battle/controller/battle_controller_pvp.lua b/lua/app/module/battle/controller/battle_controller_pvp.lua index 8523cb98..cc6c704f 100644 --- a/lua/app/module/battle/controller/battle_controller_pvp.lua +++ b/lua/app/module/battle/controller/battle_controller_pvp.lua @@ -118,52 +118,76 @@ function BattleControllerPVP:onLoadComplete(...) BattleBaseController.onLoadComplete(self, ...) end -function BattleControllerPVP:enterBattleStep() - self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_TEAM_ACTION - self.battleTeamActionList = table.clearOrCreate(self.battleTeamActionList) - - local action = function() - if self.curActionSide == SIDE_ATK then - self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP - else - self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_DEF_STEP +function BattleControllerPVP:onLinkOverDone(skillEntity, linkElementType, lineCount, influenceElementTypeMap, elementTypeMap) + if linkElementType then + self:generateInstructions(skillEntity, linkElementType, lineCount, influenceElementTypeMap, elementTypeMap) + local instructions = self.instructions + local side = self.curActionSide + self.instructions = nil + local action = function() + if side == SIDE_ATK then + self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP + else + self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_DEF_STEP + end + self.instructions = instructions + self:exeInstructions(function() + self:enterNextTeamAction() + end, side) end - self:exeInstructions(function() - self:enterNextTeamAction() - end, self.curActionSide) + self:addTeamActionList(action, #self.battleTeamActionList + 1) + end + + local nextSide = self:getCurActionOtherSide() + local sideCount = self:getSideActionCount(nextSide) + if sideCount > 0 then + self:setCurActionSide(nextSide) + self.battleUI:enterShowBoardAni(function() + self:enterElimination() + end) + else + self.battleUI:enterHideBoardAni(function() + self:enterBattleStep() + end) end - self:addTeamActionList(action, 1) - self:enterNextTeamAction() end -function BattleControllerPVP:enterNextTeamAction() - self.atkTeam:onActionOver() - self.defTeam:onActionOver() +function BattleControllerPVP:enterElimination(needDelay) + if self.showSelectSkillSid then + ModuleManager.BattleManager:unscheduleGlobal(self.showSelectSkillSid) + self.showSelectSkillSid = nil + end - self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_TEAM_ACTION_OVER - self:hideCombo() - self:hideCounterAttack() - - if self:checkTeamIsDead(function() self:enterRoundEnd() end) then + if self.battleData:useAddlvCount() then + self:tryShowSelectSkillComp(needDelay) return end - if not self.battleTeamActionList or not self.battleTeamActionList[1] then - local nextSide = self:getCurActionOtherSide() - local sideCount = self:getSideActionCount(nextSide) - if sideCount > 0 then - self:setCurActionSide(nextSide) - self.battleUI:enterShowBoardAni(function() - self:enterElimination() - end) - else - self:enterRoundEnd() + self.battleUI:hideAllBoardSfxs() + + -- 检查棋盘 + local find, pathList = self:findAttention() + if not find then -- 如果没找到,就要打乱棋盘 + self:shuffleBoard(function() + self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION + if self:skipEliminationAction() then + return + end + self:checkDefBoard() + end) + else + self.attentionList = pathList + self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION + if self:skipEliminationAction() then + return end - return + self:checkDefBoard() end +end - local action = table.remove(self.battleTeamActionList, 1) - action() +function BattleControllerPVP:enterBattleStep() + self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_TEAM_ACTION + self:enterNextTeamAction() end function BattleControllerPVP:setCurActionSide(side) @@ -209,19 +233,7 @@ function BattleControllerPVP:onFillBoardOver(...) end end -function BattleControllerPVP:enterElimination(needDelay) - if self.showSelectSkillSid then - ModuleManager.BattleManager:unscheduleGlobal(self.showSelectSkillSid) - self.showSelectSkillSid = nil - end - - if self.battleData:useAddlvCount() then - self:tryShowSelectSkillComp(needDelay) - return - end - - self.battleUI:hideAllBoardSfxs() - +function BattleControllerPVP:skipEliminationAction() local curActionUnitComp = self:getCurActionUnitComp() if curActionUnitComp:getIsLimit() then if curActionUnitComp:getIsFrozen() then @@ -231,22 +243,10 @@ function BattleControllerPVP:enterElimination(needDelay) elseif curActionUnitComp:getIsStun() then GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ARENA_BATTLE_DESC_3)) end - self:enterNextTeamAction() - return - end - - -- 检查棋盘 - local find, pathList = self:findAttention() - if not find then -- 如果没找到,就要打乱棋盘 - self:shuffleBoard(function() - self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION - self:checkDefBoard() - end) - else - self.attentionList = pathList - self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION - self:checkDefBoard() + self:onLinkOverDone() + return true end + return false end function BattleControllerPVP:checkDefBoard() @@ -296,7 +296,15 @@ function BattleControllerPVP:enterRoundBegin(...) self:battleEnd() return end - BattleBaseController.enterRoundBegin(self, ...) + self:resetSideActionCount() + self:setCurActionSide(SIDE_ATK) + self.needWaitingBoardOver = nil + self.waveRoundCount[self.waveIndex] = (self.waveRoundCount[self.waveIndex] or 0) + 1 + self.battleUI:enterShowBoardAni(function() + self:takeGridEffect() + self:enterEliminationBegin() + end) + self.battleTeamActionList = table.clearOrCreate(self.battleTeamActionList) self:refreshWave() end diff --git a/lua/app/ui/battle/battle_base_ui.lua b/lua/app/ui/battle/battle_base_ui.lua index e64bfb10..f06c90da 100644 --- a/lua/app/ui/battle/battle_base_ui.lua +++ b/lua/app/ui/battle/battle_base_ui.lua @@ -1154,7 +1154,7 @@ function BattleBaseUI:onInitGridCellOver() cell:refresh(entity, elementType) end) local pos = entity:getPos() - cell:getBaseObject():setParent(self.gridNode, false) + cell:getBaseObject():setParent(self.gridNode, true) cell:getBaseObject():setAnchoredPosition(pos.x, pos.y) entity:setCell(cell) end diff --git a/lua/app/ui/battle/battle_ui_pvp.lua b/lua/app/ui/battle/battle_ui_pvp.lua index c7c06cd8..665f946f 100644 --- a/lua/app/ui/battle/battle_ui_pvp.lua +++ b/lua/app/ui/battle/battle_ui_pvp.lua @@ -11,6 +11,7 @@ function BattleUIPVP:initBaseInfo() self.boardNode = uiMap["battle_ui_pvp.board_root_node"] self.boardCenterNode = uiMap["battle_ui_pvp.board_root_node.board_center_node"] self.boardNode:setAnchoredPositionX(DEFAULT_X) + self.boardNode:setVisible(true) self.boardMask2D = self.gridNode:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_RECT_MASK_2D) self.boardMask = uiMap["battle_ui_pvp.board_root_node.board_mask"] self.boardMask:setVisible(false) @@ -27,6 +28,8 @@ function BattleUIPVP:initBaseInfo() self.atkBoard = self.uiMap["battle_ui_pvp.board_root_node.board_center_node.board_node_atk.grid_node.board_atk"] self.defBoard = self.uiMap["battle_ui_pvp.board_root_node.board_center_node.board_node_atk.grid_node.board_def"] self.boardRootNodeMask = self.uiMap["battle_ui_pvp.board_root_node.mask"] + self.atkBoardImg:setAnchoredPositionX(0) + self.defBoardImg:setAnchoredPositionX(0) end function BattleUIPVP:initBg() @@ -165,11 +168,6 @@ function BattleUIPVP:_addListeners() end) end -function BattleUIPVP:getBoardRootNode() - local uiMap = self.root:genAllChildren() - return uiMap["battle_ui_pvp.board_root_node"] -end - function BattleUIPVP:refreshAvatar() -- 等数据 local defInfo = self.battleController:getControllerParams().defInfo @@ -223,37 +221,37 @@ function BattleUIPVP:dealBoardMaskOnShowAni(isOver) end function BattleUIPVP:enterShowBoardAni(callback) + self:showMask(false) local isAtkAction = self.battleController.curActionSide == GConst.BattleConst.SIDE_ATK if self.touchMask then self.touchMask:setVisible(not isAtkAction) end - self:dealBoardMaskOnShowAni() - for posId, entity in pairs(self.battleController.battleData:getGridEnties()) do - if entity:getCell() then - local inCurRange = self.battleController:getPosIdInCurActionBoardRowRange(posId) - local parent - if isAtkAction then - parent = inCurRange and self.atkBoard or self.defBoard - else - parent = inCurRange and self.defBoard or self.atkBoard - end - if parent then - entity:getCell():getBaseObject():setParent(parent, true) + self:clearEnterShowBoardSeq() + self.boardNode:setVisible(true) + self.boardNode:setAnchoredPositionX(0) + self.enterShowBoardSeq = self.root:createBindTweenSequence() + self.enterShowBoardSeq:AppendCallback(function() + for posId, entity in pairs(self.battleController.battleData:getGridEnties()) do + if entity:getCell() then + local inCurRange = self.battleController:getPosIdInCurActionBoardRowRange(posId) + local parent + if isAtkAction then + parent = inCurRange and self.atkBoard or self.defBoard + else + parent = inCurRange and self.defBoard or self.atkBoard + end + if parent then + entity:getCell():getBaseObject():setParent(parent, true) + end end end - end + end) - self:clearEnterShowBoardSeq() - self:getBoardRootNode():setVisible(true) - self:getBoardRootNode():setAnchoredPositionX(0) - self.enterShowBoardSeq = self.root:createBindTweenSequence() self.enterShowBoardSeq:Join(self.defBoardImg:getTransform():DOAnchorPosX(0, 0.5)) self.enterShowBoardSeq:Join(self.atkBoardImg:getTransform():DOAnchorPosX(0, 0.5)) self.enterShowBoardSeq:Join(self.boardRootNodeMask:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE):DOFade(0.9, 0.5)) self.enterShowBoardSeq:AppendCallback(function() - self:dealBoardMaskOnShowAni(true) - for posId, entity in pairs(self.battleController.battleData:getGridEnties()) do if entity:getCell() then entity:getCell():getBaseObject():setParent(self.gridNode, true) @@ -274,33 +272,33 @@ end function BattleUIPVP:enterHideBoardAni(callback) self:dealBoardMaskOnShowAni() - - local isAtkAction = self.battleController.curActionSide == GConst.BattleConst.SIDE_ATK - for posId, entity in pairs(self.battleController.battleData:getGridEnties()) do - if entity:getCell() then - local inCurRange = self.battleController:getPosIdInCurActionBoardRowRange(posId) - local parent - if isAtkAction then - parent = inCurRange and self.atkBoard or self.defBoard - else - parent = inCurRange and self.defBoard or self.atkBoard - end - if parent then - entity:getCell():getBaseObject():setParent(parent, true) - end - end - end - self:clearEnterShowBoardSeq() self.enterShowBoardSeq = self.root:createBindTweenSequence() self.enterShowBoardSeq:AppendInterval(0.5) + self.enterShowBoardSeq:AppendCallback(function() + local isAtkAction = self.battleController.curActionSide == GConst.BattleConst.SIDE_ATK + for posId, entity in pairs(self.battleController.battleData:getGridEnties()) do + if entity:getCell() then + local inCurRange = self.battleController:getPosIdInCurActionBoardRowRange(posId) + local parent + if isAtkAction then + parent = inCurRange and self.atkBoard or self.defBoard + else + parent = inCurRange and self.defBoard or self.atkBoard + end + if parent then + entity:getCell():getBaseObject():setParent(parent, true) + end + end + end + end) local w, h = GFunc.getUIExpandScreenSize() self.enterShowBoardSeq:Join(self.defBoardImg:getTransform():DOAnchorPosX(w + 360, 0.5)) self.enterShowBoardSeq:Join(self.atkBoardImg:getTransform():DOAnchorPosX(-(w + 360), 0.5)) self.enterShowBoardSeq:Join(self.boardRootNodeMask:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE):DOFade(0, 0.5)) self.enterShowBoardSeq:AppendCallback(function() self:dealBoardMaskOnShowAni(true) - self:getBoardRootNode():setVisible(false) + self.boardNode:setVisible(false) if callback then callback() end