填充bug修复

This commit is contained in:
xiekaidong 2023-04-19 21:03:53 +08:00
parent 90070e8798
commit 7afa7f77b5
5 changed files with 57 additions and 40 deletions

View File

@ -264,10 +264,11 @@ BattleConst.GRID_TYPE_ICON = {
[BattleConst.GRID_TYPE.ICE] = "ice",
}
---- 周围格子消除一次后会变成什么格子
---- 周围格子或自己消除一次后会变成什么格子
BattleConst.AROUND_ELIMINATION_TO_TYPE_COUNT = {
[BattleConst.GRID_TYPE.SNOW_BOX] = {BattleConst.GRID_TYPE.EMPTY},
[BattleConst.GRID_TYPE.SOLID_SNOW] = {BattleConst.GRID_TYPE.SNOW_BOX},
[BattleConst.GRID_TYPE.VINES] = {BattleConst.GRID_TYPE.EMPTY},
[BattleConst.GRID_TYPE.ICE] = {BattleConst.GRID_TYPE.EMPTY},
}
@ -288,6 +289,7 @@ BattleConst.CANT_LINK_GRID_TYPE = {
---- 元素类型
BattleConst.ELEMENT_TYPE = {
NONE = 0,
RED = 1,
YELLOW = 2,
GREEN = 3,

View File

@ -1039,13 +1039,18 @@ function BattleUnitComp:playDead(callback)
self.deadOverCallback = callback
if self:getIsClear() then
self.deadOverCallback = nil
return callback()
if callback then
callback()
end
return
end
if self.currState ~= UNIT_STATE.DEAD and not self:changeState(UNIT_STATE.DEAD) then
self.deadOverCallback = nil
if callback then
callback()
end
end
end
function BattleUnitComp:playEnterBattlefield(isBoss, callback)
self.finishEnterBattlefieldCallback = callback

View File

@ -604,6 +604,7 @@ function BattleController:onLinkOver()
linkElementType = elementType
lineCount = lineCount + 1
end
boomGridIds[info.posId] = true
local outline = BattleConst.GRID_OUT_LINE_POS_ID[info.posId]
for aroundPosId, _ in pairs(outline) do
@ -624,10 +625,13 @@ function BattleController:onLinkOver()
if not eliminationPosIds[posId] then
eliminationPosIds[posId] = true
table.insert(sequence, {posId = posId})
end
if not entity:getSkillId() then
local elementType = entity:getElementType()
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
end
end
if not entity:getSkillId() then
local elementType = entity:getElementType()
if not influenceElementType then
influenceElementType = {}
end
@ -640,13 +644,13 @@ function BattleController:onLinkOver()
end
for posId, status in pairs(boomGridIds) do
if not eliminationPosIds[posId] then
local entity = self.battleData:getGridEntity(posId)
if entity then
local elementTypeInvalid = entity:isElmentTypeInvalid()
entity:addAroundEliminationCount()
if entity:getIsIdle() then
eliminationPosIds[posId] = true
if not eliminationPosIds[posId] then
table.insert(sequence, {posId = posId, noAni = elementTypeInvalid})
if not entity:getSkillId() and not elementTypeInvalid then
local elementType = entity:getElementType()
@ -670,7 +674,6 @@ end
function BattleController:fillBoard()
local pathMap = {}
local columnCount = {}
local gridMap = {}
for c = 1, BattleConst.COLUMN_COUNT do
for r = BattleConst.ROW_COUNT, 1, -1 do
@ -1105,7 +1108,6 @@ function BattleController:fillThisPos(posId, columnCount, gridMap)
if not fallEntity then -- 异常情况,理论上不可能不存在
return
end
if fallEntity then
if not fallEntity:isCantFallType() then
if fallEntity:getIsIdle() then
self:fillThisPos(fallPosId, columnCount, gridMap)
@ -1128,7 +1130,6 @@ function BattleController:fillThisPos(posId, columnCount, gridMap)
end
end
end
end
function BattleController:getRandomGridInfo()
local list, fixedRandomGrid = self:getInitBoard()

View File

@ -59,13 +59,16 @@ function BattleUI:initSkill()
local uiMap = self.root:genAllChildren()
for name, elementType in pairs(GConst.BattleConst.ELEMENT_TYPE) do
self.skillNodeCells[elementType] = CellManager:addCellComp(uiMap["battle_ui.bg_2.skill_node_cell_" .. elementType], SKILL_NODE_CELL)
local obj = uiMap["battle_ui.bg_2.skill_node_cell_" .. elementType]
if obj then
self.skillNodeCells[elementType] = CellManager:addCellComp(obj, SKILL_NODE_CELL)
local skillEntity = DataManager.BattleData:getSkillEntities()[elementType]
if skillEntity then
self.skillNodeCells[elementType]:refresh(skillEntity)
end
self.skillNodeCells[elementType]:getBaseObject():setActive(skillEntity ~= nil)
end
end
uiMap["battle_ui.bg_2.skill_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT):RefreshLayout()
end
@ -467,12 +470,15 @@ function BattleUI:hideGenerateSkillGridCells()
local uiMap = self.root:genAllChildren()
self.generateSkillGridEntities = {}
for name, elementType in pairs(GConst.BattleConst.ELEMENT_TYPE) do
local cell = CellManager:addCellComp(uiMap["battle_ui.bg_2.board_node.ani_node.grid_cell_" .. elementType], GRID_CELL)
local obj = uiMap["battle_ui.bg_2.board_node.ani_node.grid_cell_" .. elementType]
if obj then
local cell = CellManager:addCellComp(obj, GRID_CELL)
local entity = DataManager.BattleData:getNewGridEntity()
entity:setCell(cell)
self.generateSkillGridEntities[elementType] = entity
end
end
end
for _, entity in pairs(self.generateSkillGridEntities) do
if entity:getCell() then

View File

@ -5,12 +5,15 @@ function BattleGridEntity:ctor(data)
self:clear()
self.posId = data.posId or 0
self.gridType = data.gridType or BattleConst.GRID_TYPE.EMPTY
self.elementType = data.elementType or BattleConst.ELEMENT_TYPE.RED
self.elementType = data.elementType or BattleConst.ELEMENT_TYPE.NONE
self.aroundEliminationCount = data.aroundEliminationCount or 0 -- 周围消除次数
self.skillId = data.skillId
self.linkSkillCount = data.linkSkillCount or 0 -- 任意链接技能激活次数
self.isIdle = false
self.data.isDirty = false
if self.gridType == BattleConst.GRID_TYPE.EMPTY and self.elementType == BattleConst.ELEMENT_TYPE.NONE then
self.isIdle = true
end
end
function BattleGridEntity:clear()
@ -71,7 +74,7 @@ function BattleGridEntity:getElementType(skillEntity)
end
function BattleGridEntity:isCantFallType()
return BattleConst.CANT_FALL_GRID_TYPE[self.gridType] or false
return not self:isEmptyType()
end
function BattleGridEntity:isObstacleType()