From a51ee6d872991b465297405f139aa7d7d18a7c92 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Fri, 30 Jun 2023 20:47:22 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=AB=9E=E6=8A=80=E5=9C=BA=E6=88=98?= =?UTF-8?q?=E6=96=97=E6=B5=81=E7=A8=8B=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/battle_base_controller.lua | 12 +- .../controller/battle_controller_pvp.lua | 136 +++++++++--------- lua/app/ui/battle/battle_base_ui.lua | 2 +- lua/app/ui/battle/battle_ui_pvp.lua | 53 +++---- 4 files changed, 108 insertions(+), 95 deletions(-) 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..ce80c8d0 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_DEF) + 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 2d055c4a..b5ba8801 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,40 @@ 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 + self:clearEnterShowBoardSeq() + self.boardNode:setVisible(true) + self.boardNode:setAnchoredPositionX(0) + self.enterShowBoardSeq = self.root:createBindTweenSequence() + if not self.root.tag then + self.root.tag = true + 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 - if parent then - entity:getCell():getBaseObject():setParent(parent, true) - 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) @@ -293,14 +294,14 @@ function BattleUIPVP:enterHideBoardAni(callback) self:clearEnterShowBoardSeq() self.enterShowBoardSeq = self.root:createBindTweenSequence() - self.enterShowBoardSeq:AppendInterval(0.5) + self.enterShowBoardSeq:AppendInterval(1) 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 From f672783ab59f903efbd84424d7865b98520c9314 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Fri, 30 Jun 2023 20:54:17 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=8A=82=E5=A5=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/battle/battle_ui_pvp.lua | 67 ++++++++++++++--------------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/lua/app/ui/battle/battle_ui_pvp.lua b/lua/app/ui/battle/battle_ui_pvp.lua index b5ba8801..dabfe4ba 100644 --- a/lua/app/ui/battle/battle_ui_pvp.lua +++ b/lua/app/ui/battle/battle_ui_pvp.lua @@ -231,25 +231,22 @@ function BattleUIPVP:enterShowBoardAni(callback) self.boardNode:setVisible(true) self.boardNode:setAnchoredPositionX(0) self.enterShowBoardSeq = self.root:createBindTweenSequence() - if not self.root.tag then - self.root.tag = true - 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 + 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 + end) self.enterShowBoardSeq:Join(self.defBoardImg:getTransform():DOAnchorPosX(0, 0.5)) self.enterShowBoardSeq:Join(self.atkBoardImg:getTransform():DOAnchorPosX(0, 0.5)) @@ -275,26 +272,26 @@ 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(1) + 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)) From 9b738529fce3ad387574db63d4b55f856d109fe7 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Mon, 3 Jul 2023 09:46:39 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=AB=9E=E6=8A=80=E5=9C=BA=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E8=87=AA=E5=B7=B1=E5=85=88=E6=89=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/battle/controller/battle_controller_pvp.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/app/module/battle/controller/battle_controller_pvp.lua b/lua/app/module/battle/controller/battle_controller_pvp.lua index ce80c8d0..cc6c704f 100644 --- a/lua/app/module/battle/controller/battle_controller_pvp.lua +++ b/lua/app/module/battle/controller/battle_controller_pvp.lua @@ -297,7 +297,7 @@ function BattleControllerPVP:enterRoundBegin(...) return end self:resetSideActionCount() - self:setCurActionSide(SIDE_DEF) + self:setCurActionSide(SIDE_ATK) self.needWaitingBoardOver = nil self.waveRoundCount[self.waveIndex] = (self.waveRoundCount[self.waveIndex] or 0) + 1 self.battleUI:enterShowBoardAni(function()