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

This commit is contained in:
chenxi 2023-06-03 19:58:54 +08:00
commit a7a189bcbb
5 changed files with 62 additions and 24 deletions

View File

@ -264,6 +264,7 @@ function BattleController:init(params)
self.waveRoundCount = {}
self.lastRoundBreakedGridType = {}
self.waitingFillCount = 0
self.needWaitingBoardOver = nil
self.chapterId = self:getChapterId()
self.waveIndex = 0
@ -530,6 +531,7 @@ function BattleController:enterNextWave()
self.battleUI:refreshWave(self.waveIndex)
end
if self.waveIndex == 1 then -- 第一波
self.needWaitingBoardOver = true
self:generateBoard(true)
else
-- 上报关卡结束
@ -541,10 +543,13 @@ function BattleController:enterNextWave()
self.isBossWave = self.defTeam:getMainUnit().unitEntity:getIsBoss()
self:postFightStart()
if not self.needWaitingBoardOver then
self:enterRoundBegin()
end
end
function BattleController:enterRoundBegin()
self.needWaitingBoardOver = nil
self.waveRoundCount[self.waveIndex] = (self.waveRoundCount[self.waveIndex] or 0) + 1
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_BEGIN
self:takeGridEffect()
@ -1036,7 +1041,7 @@ function BattleController:calculateCurElimination(onlyCheck)
local randomPosList, influenceElementTypeMap
for i, info in ipairs(self.aniSequence) do
if info.isSkill then
if info.isSkill and skillEntity then
randomPosList, influenceElementTypeMap = self:dealSkillElement(info.timeIdx + skillTime, self.breakedMap, self.sequenceMap, self.aniSequence, self.boomGridIds, onlyCheck)
local aniUnit = self.aniSequence[i]
if not BattleConst.NO_EFFECT_GRID_SKILL_TYPE[skillEntity:getSkillType()] then
@ -1334,15 +1339,18 @@ end
function BattleController:generateBoard(isFirst)
local boardList, _, mysteryBoxIndexMap = self:getInitBoard()
if self.curBoardIndex and self.curBoardIndex >= #boardList then
self.needWaitingBoardOver = false
return
end
if not self.battleUI then
self.needWaitingBoardOver = false
return
end
self.curBoardIndex = (self.curBoardIndex or 0) + 1
if not boardList[self.curBoardIndex] then -- 容错
self.needWaitingBoardOver = false
return
end
local board = boardList[self.curBoardIndex].board
@ -1352,7 +1360,9 @@ function BattleController:generateBoard(isFirst)
end
self.battleUI:switchBoard(function()
self.battleData:refreshBoard(board, self:getBlockIcon())
self.battleUI:initGridCell()
self.battleUI:initGridCell(function()
self.needWaitingBoardOver = false
end)
end, function()
-- self:enterRoundBegin()
end, isFirst)
@ -1389,11 +1399,21 @@ function BattleController:popBoardCacheSkill(callback)
if self.popSkillPosIdList[1] then
self.popNewSkillId[index] = info
self.popNewSkillId[index].posId = table.remove(self.popSkillPosIdList)
self:setGridSkillId(self.popNewSkillId[index].posId, info.skillId, true)
else
break
end
end
self.battleUI:cacheSkillAni(self.popNewSkillId, true, callback)
self.battleUI:cacheSkillAni(self.popNewSkillId, true, function()
for index, info in ipairs(self.popNewSkillId) do
self.battleData:setGridDirty(info.posId)
end
if callback then
callback()
end
end)
else
if callback then
callback()
@ -1436,13 +1456,13 @@ function BattleController:generateSkill(callback)
end)
end
function BattleController:setGridSkillId(posId, skillId)
function BattleController:setGridSkillId(posId, skillId, noDirty)
local entity = self.battleData:getGridEntity(posId)
if entity then
entity:setSkilId(skillId)
entity:setSkilId(skillId, noDirty)
local skillEntity = self.battleData:getSkillEntityBySkillId(skillId)
if skillEntity and entity:getElementType() ~= skillEntity:getPosition() then
entity:setElementType(skillEntity:getPosition())
entity:setElementType(skillEntity:getPosition(), noDirty)
end
end
end
@ -2498,6 +2518,9 @@ function BattleController:_tick(dt)
if self.isPause then
return
end
if self.needWaitingBoardOver == false then
self:enterRoundBegin()
end
if self.waitingFillCount <= 0 and self.isWaitingFill and self.isRoundBeginCheck then
self:fillBoard(self.isRoundBeginCheck)
end

View File

@ -64,12 +64,11 @@ local function _crossSpreadNotBreak(entity, gridEntities, battleController, only
for _, posId in ipairs(tempList) do
local gridEntity = gridEntities[posId]
if gridEntity:isEmptyIdle() then
battleController.battleData:setGridType(posId, entity:getGridType() or BattleConst.GRID_TYPE.JELLY, true)
if battleController.battleUI and entity:getEffectSfx() then
battleController.battleUI:showGridEffectSfx(posId, entity:getEffectSfx(), function()
battleController.battleData:setGridType(posId, entity:getGridType() or BattleConst.GRID_TYPE.JELLY)
battleController.battleData:setGridDirty(posId)
end)
else
battleController.battleData:setGridType(posId, entity:getGridType() or BattleConst.GRID_TYPE.JELLY)
end
succ = true
break

View File

@ -778,7 +778,8 @@ function BattleUI:shakeScreen(shakeType, duration)
self.shakeTween.timeScale = DataManager.BattleData:getTimeScale()
end
function BattleUI:initGridCell()
function BattleUI:initGridCell(callback)
self.onInitGridCellOverCallback = callback
if self.root.gridCells then
self.gridCells = self.root.gridCells
self.gridInitOver = true
@ -831,6 +832,12 @@ function BattleUI:onInitGridCellOver()
end
end
local callback = self.onInitGridCellOverCallback
self.onInitGridCellOverCallback = nil
if callback then
callback()
end
---- 检查引导
ModuleManager.TutorialManager:checkFuncTutorial(GConst.TutorialConst.START_TUTORIAL)
end
@ -1551,11 +1558,6 @@ function BattleUI:doCachePopAni(skillInfo, callback)
end
self.cacheSkillAniSeq:AppendCallback(function()
for index, info in ipairs(skillInfo) do
if self.battleController then
self.battleController:setGridSkillId(info.posId, info.skillId)
end
end
self.boardCacheNode:setVisible(false)
self:enableUITouch()
if callback then

View File

@ -334,15 +334,23 @@ function BattleData:setInfoBySnapshop(posId, snapInfo)
entity:setInfoBySnapshop(snapInfo)
end
function BattleData:setGridType(posId, gridType)
function BattleData:setGridType(posId, gridType, noDirty)
local entity = self.gridEntities[posId]
if not entity then
return
end
entity:setGridType(gridType)
entity:setGridType(gridType, noDirty)
entity:determineIdleStatus()
end
function BattleData:setGridDirty(posId)
local entity = self.gridEntities[posId]
if not entity then
return
end
entity:setDirty()
end
function BattleData:lockAllSkillGrid(lock)
if not self.gridEntities then
return

View File

@ -191,20 +191,24 @@ function BattleGridEntity:clearPath()
self.pathList = {}
end
function BattleGridEntity:setGridType(gridType)
function BattleGridEntity:setGridType(gridType, noDirty)
if self.gridType ~= gridType then
self.gridType = gridType
self.breakCount = 0
if not noDirty then
self:setDirty()
end
end
end
function BattleGridEntity:setElementType(elementType)
function BattleGridEntity:setElementType(elementType, noDirty)
self.elementType = elementType
if DataManager.BattleData:getCacheLockedElement(self.elementType) then
self:setGridType(BattleConst.GRID_TYPE.LOCK)
end
if not noDirty then
self:setDirty()
end
end
function BattleGridEntity:getSkillId()
@ -214,10 +218,12 @@ function BattleGridEntity:getSkillId()
return self.skillId
end
function BattleGridEntity:setSkilId(skillId)
function BattleGridEntity:setSkilId(skillId, noDirty)
self.skillId = skillId
self.linkSkillCount = 0
if not noDirty then
self:setDirty()
end
end
function BattleGridEntity:canChangeInfo()