Merge branch 'new_arena' into arena

This commit is contained in:
xiekaidong 2023-07-04 10:44:09 +08:00
commit 2d9c5b02b8
4 changed files with 121 additions and 111 deletions

View File

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

View File

@ -118,37 +118,26 @@ 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)
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 self.curActionSide == SIDE_ATK then
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, self.curActionSide)
end, side)
end
self:addTeamActionList(action, 1)
self:enterNextTeamAction()
end
function BattleControllerPVP:enterNextTeamAction()
self.atkTeam:onActionOver()
self.defTeam:onActionOver()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_TEAM_ACTION_OVER
self:hideCombo()
self:hideCounterAttack()
if self:checkTeamIsDead(function() self:enterRoundEnd() end) then
return
self:addTeamActionList(action, #self.battleTeamActionList + 1)
end
if not self.battleTeamActionList or not self.battleTeamActionList[1] then
local nextSide = self:getCurActionOtherSide()
local sideCount = self:getSideActionCount(nextSide)
if sideCount > 0 then
@ -157,13 +146,48 @@ function BattleControllerPVP:enterNextTeamAction()
self:enterElimination()
end)
else
self:enterRoundEnd()
self.battleUI:enterHideBoardAni(function()
self:enterBattleStep()
end)
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
local action = table.remove(self.battleTeamActionList, 1)
action()
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
self:checkDefBoard()
end
end
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

View File

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

View File

@ -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,12 +221,17 @@ 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()
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)
@ -243,17 +246,12 @@ function BattleUIPVP:enterShowBoardAni(callback)
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,7 +272,10 @@ end
function BattleUIPVP:enterHideBoardAni(callback)
self:dealBoardMaskOnShowAni()
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
@ -290,17 +291,14 @@ function BattleUIPVP:enterHideBoardAni(callback)
end
end
end
self:clearEnterShowBoardSeq()
self.enterShowBoardSeq = self.root:createBindTweenSequence()
self.enterShowBoardSeq:AppendInterval(0.5)
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