Merge branch 'dev' of git.juzugame.com:b6-client/b6-lua into dev

This commit is contained in:
chenxi 2023-04-19 17:20:43 +08:00
commit 1f86476cb0
3 changed files with 66 additions and 27 deletions

View File

@ -263,6 +263,17 @@ function BattleController:setTimeScale(timeScale)
BattleHelper:setTimeScale(timeScale) BattleHelper:setTimeScale(timeScale)
end end
function BattleController:_findNextDefUnit()
if self.isBossWave then -- 如果上一波是boss波次则重新生成棋盘
self:putBoardCacheSkill(function()
self:findNextDefUnit()
self:generateBoard()
end)
else
self:findNextDefUnit()
end
end
---- start 回合步骤 ---- start 回合步骤
function BattleController:enterNextWave() function BattleController:enterNextWave()
@ -290,13 +301,7 @@ function BattleController:enterNextWave()
end end
self.defTeam:prepare() self.defTeam:prepare()
if self.isBossWave then -- 如果上一波是boss波次则重新生成棋盘 self:enterRoundBegin()
self:putBoardCacheSkill(function()
self:generateBoard()
end)
else
self:enterRoundBegin()
end
self.isBossWave = self.defTeam:getMainUnit().unitEntity:getIsBoss() self.isBossWave = self.defTeam:getMainUnit().unitEntity:getIsBoss()
end end
@ -351,7 +356,7 @@ function BattleController:enterAtkStepOver()
if self.waveIndex >= self.maxWaveIndex then if self.waveIndex >= self.maxWaveIndex then
self:enterRoundEnd() self:enterRoundEnd()
else else
self:findNextDefUnit() self:enterRefreshBoard()
end end
return return
end end
@ -386,10 +391,8 @@ function BattleController:enterDefStepOver()
if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑 if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑
if self.waveIndex >= self.maxWaveIndex then if self.waveIndex >= self.maxWaveIndex then
self:enterRoundEnd() self:enterRoundEnd()
else return
self:findNextDefUnit()
end end
return
end end
self:enterRefreshBoard() self:enterRefreshBoard()
@ -418,6 +421,10 @@ function BattleController:enterRoundEnd()
self.atkTeam:onRoundEnd() self.atkTeam:onRoundEnd()
self.defTeam:onRoundEnd() self.defTeam:onRoundEnd()
self:onRoundEnd()
end
function BattleController:onRoundEnd()
if self.battleData:useAddlvCount() then if self.battleData:useAddlvCount() then
ModuleManager.BattleManager:showSelectSkillUI(self:getRandomSkillList()) ModuleManager.BattleManager:showSelectSkillUI(self:getRandomSkillList())
else else
@ -684,7 +691,6 @@ function BattleController:fillBoard()
end end
end end
for c = 1, BattleConst.COLUMN_COUNT do for c = 1, BattleConst.COLUMN_COUNT do
for r = BattleConst.ROW_COUNT, 1, -1 do for r = BattleConst.ROW_COUNT, 1, -1 do
local posId = ModuleManager.BattleManager:getPosId(r, c) local posId = ModuleManager.BattleManager:getPosId(r, c)
@ -705,7 +711,17 @@ end
function BattleController:onFillBoardOver() function BattleController:onFillBoardOver()
self:generateSkill(function() self:generateSkill(function()
self.battleUI:refreshSkill() self.battleUI:refreshSkill()
self:enterRoundEnd() local defTeam = self.battleData:getDefTeam()
if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑
if self.waveIndex >= self.maxWaveIndex then
self:enterRoundEnd()
else
self:_findNextDefUnit()
end
return
else
self:enterRoundEnd()
end
end) end)
end end
@ -865,9 +881,12 @@ function BattleController:generateBoard()
self.curBoardIndex = (self.curBoardIndex or 0) + 1 self.curBoardIndex = (self.curBoardIndex or 0) + 1
local board = boardList[self.curBoardIndex] local board = boardList[self.curBoardIndex]
self.battleData:refreshBoard(board) self.battleUI:switchBoard(function()
self.battleUI:initGridCell() self.battleData:refreshBoard(board)
self:enterRoundBegin() self.battleUI:initGridCell()
end, function()
self:enterRoundBegin()
end)
end end
function BattleController:putBoardCacheSkill(callback) function BattleController:putBoardCacheSkill(callback)
@ -1226,11 +1245,7 @@ function BattleController:onSelectSkill(skillId)
entity:gotUpSKill(skillId) entity:gotUpSKill(skillId)
end end
if self.battleData:useAddlvCount() then self:onRoundEnd()
ModuleManager.BattleManager:showSelectSkillUI(self:getRandomSkillList())
else
self:enterRoundBegin()
end
if self.battleUI then if self.battleUI then
self.battleUI:refreshBoard() self.battleUI:refreshBoard()
@ -1258,8 +1273,6 @@ function BattleController:changeElementType(count, elementType)
end end
function BattleController:addHeroAttr(attrName, value) function BattleController:addHeroAttr(attrName, value)
Logger.logHighlight("------addHeroAttr------ " .. attrName .. " " .. value)
Logger.logHighlight(self.battleData.atkTeam == nil)
if not self.battleData or not self.battleData.atkTeam then if not self.battleData or not self.battleData.atkTeam then
return return
end end
@ -1357,7 +1370,7 @@ function BattleController:findAttention()
local mainElementType = gridEntity:getElementType() local mainElementType = gridEntity:getElementType()
if skillId then if skillId then
local skillEntity = self.battleData:getSkillEntityBySkillId(skillId) local skillEntity = self.battleData:getSkillEntityBySkillId(skillId)
if skillEntity:ignoreElementType() then if skillEntity:getIgnoreElementType() then
mainElementType = nil mainElementType = nil
end end
end end
@ -1411,7 +1424,7 @@ function BattleController:findLinkLine(posId, posIdMap, hadSkill, mainElementTyp
local skillId = gridEntity:getSkillId() local skillId = gridEntity:getSkillId()
local skillEntity = self.battleData:getSkillEntityBySkillId(skillId) local skillEntity = self.battleData:getSkillEntityBySkillId(skillId)
if skillEntity then if skillEntity then
if skillEntity:ignoreElementType() or skillEntity:getPosition() == mainElementType then if skillEntity:getIgnoreElementType() or skillEntity:getPosition() == mainElementType then
local tempIdMap = GFunc.getTable(posIdMap) local tempIdMap = GFunc.getTable(posIdMap)
local newList = GFunc.getTable(lineList) local newList = GFunc.getTable(lineList)
local gotSkill = self:findLinkLine(aroundposId, tempIdMap, true, mainElementType, newList) local gotSkill = self:findLinkLine(aroundposId, tempIdMap, true, mainElementType, newList)

View File

@ -50,12 +50,12 @@ function BattleControllerStage:_stageGenerateNextMonster()
monsterComp:playEnterBattlefield(true, function() monsterComp:playEnterBattlefield(true, function()
self.atkTeam:stopRunAction() self.atkTeam:stopRunAction()
self:enterNextWave() self:enterNextWave()
self:enterRefreshBoard() self:onRoundEnd()
end) end)
else else
monsterComp:playEnterBattlefield(false, function() monsterComp:playEnterBattlefield(false, function()
self:enterNextWave() self:enterNextWave()
self:enterRefreshBoard() self:onRoundEnd()
end) end)
end end
end) end)

View File

@ -4,6 +4,8 @@ local GRID_CELL_PATH = "assets/prefabs/ui/battle/cell/grid_cell.prefab"
local SKILL_NODE_CELL = "app/ui/battle/cell/skill_node_cell" local SKILL_NODE_CELL = "app/ui/battle/cell/skill_node_cell"
local DEFAULT_X = 10000 local DEFAULT_X = 10000
local BOARD_POS_UP = BF.Vector2(0, 47)
local BOARD_POS_DOWN = BF.Vector2(0, -740)
function BattleUI:getPrefabPath() function BattleUI:getPrefabPath()
return "assets/prefabs/ui/battle/battle_ui.prefab" return "assets/prefabs/ui/battle/battle_ui.prefab"
@ -307,6 +309,27 @@ function BattleUI:onInitGridCellOver()
end end
end end
function BattleUI:switchBoard(downCallback, callback)
if self.switchBoardSeq then
self.switchBoardSeq:Kill()
self.switchBoardSeq = nil
end
self.switchBoardSeq = self.root:createBindTweenSequence()
self.switchBoardSeq:Append(self.boardNode:getTransform():DOAnchorPos(BOARD_POS_DOWN, 0.5))
self.switchBoardSeq:AppendCallback(function()
if downCallback then
downCallback()
end
end)
self.switchBoardSeq:Append(self.boardNode:getTransform():DOAnchorPos(BOARD_POS_UP, 0.5))
self.switchBoardSeq:AppendCallback(function()
if callback then
callback()
end
end)
end
function BattleUI:setController(controller) function BattleUI:setController(controller)
self.battleController = controller self.battleController = controller
end end
@ -477,6 +500,9 @@ function BattleUI:fallGrid(listInfo, callback)
end) end)
end end
end end
if self.fallAniCount == 0 and callback then
callback()
end
end end
function BattleUI:cacheSkillAni(skillInfo, isPop, callback) function BattleUI:cacheSkillAni(skillInfo, isPop, callback)