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

This commit is contained in:
chenxi 2023-04-19 21:07:38 +08:00
commit 87d7f9b597
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.GRID_TYPE.ICE] = "ice",
} }
---- 周围格子消除一次后会变成什么格子 ---- 周围格子或自己消除一次后会变成什么格子
BattleConst.AROUND_ELIMINATION_TO_TYPE_COUNT = { BattleConst.AROUND_ELIMINATION_TO_TYPE_COUNT = {
[BattleConst.GRID_TYPE.SNOW_BOX] = {BattleConst.GRID_TYPE.EMPTY}, [BattleConst.GRID_TYPE.SNOW_BOX] = {BattleConst.GRID_TYPE.EMPTY},
[BattleConst.GRID_TYPE.SOLID_SNOW] = {BattleConst.GRID_TYPE.SNOW_BOX}, [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}, [BattleConst.GRID_TYPE.ICE] = {BattleConst.GRID_TYPE.EMPTY},
} }
@ -288,6 +289,7 @@ BattleConst.CANT_LINK_GRID_TYPE = {
---- 元素类型 ---- 元素类型
BattleConst.ELEMENT_TYPE = { BattleConst.ELEMENT_TYPE = {
NONE = 0,
RED = 1, RED = 1,
YELLOW = 2, YELLOW = 2,
GREEN = 3, GREEN = 3,

View File

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

View File

@ -608,6 +608,7 @@ function BattleController:onLinkOver()
linkElementType = elementType linkElementType = elementType
lineCount = lineCount + 1 lineCount = lineCount + 1
end end
boomGridIds[info.posId] = true
local outline = BattleConst.GRID_OUT_LINE_POS_ID[info.posId] local outline = BattleConst.GRID_OUT_LINE_POS_ID[info.posId]
for aroundPosId, _ in pairs(outline) do for aroundPosId, _ in pairs(outline) do
@ -628,10 +629,13 @@ function BattleController:onLinkOver()
if not eliminationPosIds[posId] then if not eliminationPosIds[posId] then
eliminationPosIds[posId] = true eliminationPosIds[posId] = true
table.insert(sequence, {posId = posId}) table.insert(sequence, {posId = posId})
end
if not entity:getSkillId() then if not entity:getSkillId() then
local elementType = entity:getElementType() local elementType = entity:getElementType()
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1 elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
end
end
if not entity:getSkillId() then
local elementType = entity:getElementType()
if not influenceElementType then if not influenceElementType then
influenceElementType = {} influenceElementType = {}
end end
@ -644,13 +648,13 @@ function BattleController:onLinkOver()
end end
for posId, status in pairs(boomGridIds) do for posId, status in pairs(boomGridIds) do
if not eliminationPosIds[posId] then
local entity = self.battleData:getGridEntity(posId) local entity = self.battleData:getGridEntity(posId)
if entity then if entity then
local elementTypeInvalid = entity:isElmentTypeInvalid() local elementTypeInvalid = entity:isElmentTypeInvalid()
entity:addAroundEliminationCount() entity:addAroundEliminationCount()
if entity:getIsIdle() then if entity:getIsIdle() then
eliminationPosIds[posId] = true eliminationPosIds[posId] = true
if not eliminationPosIds[posId] then
table.insert(sequence, {posId = posId, noAni = elementTypeInvalid}) table.insert(sequence, {posId = posId, noAni = elementTypeInvalid})
if not entity:getSkillId() and not elementTypeInvalid then if not entity:getSkillId() and not elementTypeInvalid then
local elementType = entity:getElementType() local elementType = entity:getElementType()
@ -674,7 +678,6 @@ end
function BattleController:fillBoard() function BattleController:fillBoard()
local pathMap = {} local pathMap = {}
local columnCount = {} local columnCount = {}
local gridMap = {} local gridMap = {}
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
@ -1109,7 +1112,6 @@ function BattleController:fillThisPos(posId, columnCount, gridMap)
if not fallEntity then -- 异常情况,理论上不可能不存在 if not fallEntity then -- 异常情况,理论上不可能不存在
return return
end end
if fallEntity then
if not fallEntity:isCantFallType() then if not fallEntity:isCantFallType() then
if fallEntity:getIsIdle() then if fallEntity:getIsIdle() then
self:fillThisPos(fallPosId, columnCount, gridMap) self:fillThisPos(fallPosId, columnCount, gridMap)
@ -1131,7 +1133,6 @@ function BattleController:fillThisPos(posId, columnCount, gridMap)
end end
end end
end end
end
end end
function BattleController:getRandomGridInfo() function BattleController:getRandomGridInfo()

View File

@ -87,13 +87,16 @@ function BattleUI:initSkill()
local uiMap = self.root:genAllChildren() local uiMap = self.root:genAllChildren()
for name, elementType in pairs(GConst.BattleConst.ELEMENT_TYPE) do 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] local skillEntity = DataManager.BattleData:getSkillEntities()[elementType]
if skillEntity then if skillEntity then
self.skillNodeCells[elementType]:refresh(skillEntity) self.skillNodeCells[elementType]:refresh(skillEntity)
end end
self.skillNodeCells[elementType]:getBaseObject():setActive(skillEntity ~= nil) self.skillNodeCells[elementType]:getBaseObject():setActive(skillEntity ~= nil)
end end
end
uiMap["battle_ui.bg_2.skill_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT):RefreshLayout() uiMap["battle_ui.bg_2.skill_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT):RefreshLayout()
end end
@ -495,12 +498,15 @@ function BattleUI:hideGenerateSkillGridCells()
local uiMap = self.root:genAllChildren() local uiMap = self.root:genAllChildren()
self.generateSkillGridEntities = {} self.generateSkillGridEntities = {}
for name, elementType in pairs(GConst.BattleConst.ELEMENT_TYPE) do 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() local entity = DataManager.BattleData:getNewGridEntity()
entity:setCell(cell) entity:setCell(cell)
self.generateSkillGridEntities[elementType] = entity self.generateSkillGridEntities[elementType] = entity
end end
end end
end
for _, entity in pairs(self.generateSkillGridEntities) do for _, entity in pairs(self.generateSkillGridEntities) do
if entity:getCell() then if entity:getCell() then

View File

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