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

@ -1041,11 +1041,16 @@ 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
callback()
if callback then
callback()
end
end
end

View File

@ -608,6 +608,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
@ -628,10 +629,13 @@ function BattleController:onLinkOver()
if not eliminationPosIds[posId] then
eliminationPosIds[posId] = true
table.insert(sequence, {posId = posId})
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()
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
if not influenceElementType then
influenceElementType = {}
end
@ -644,13 +648,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
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()
@ -674,7 +678,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
@ -1109,25 +1112,23 @@ 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)
end
fallEntity = self.battleData:getGridEntity(fallPosId)
if not fallEntity:getIsIdle() then
if not fallEntity:getPath()[1] then
local curPos = ModuleManager.BattleManager:getPosInfo(fallPosId)
fallEntity:addPath({x = curPos.x, y = curPos.y})
end
local curPos = ModuleManager.BattleManager:getPosInfo(posId)
if not fallEntity:isCantFallType() then
if fallEntity:getIsIdle() then
self:fillThisPos(fallPosId, columnCount, gridMap)
end
fallEntity = self.battleData:getGridEntity(fallPosId)
if not fallEntity:getIsIdle() then
if not fallEntity:getPath()[1] then
local curPos = ModuleManager.BattleManager:getPosInfo(fallPosId)
fallEntity:addPath({x = curPos.x, y = curPos.y})
self.battleData:exchangeGridEntities(posId, fallPosId)
self:fillThisPos(fallPosId, columnCount, gridMap)
return
end
local curPos = ModuleManager.BattleManager:getPosInfo(posId)
fallEntity:addPath({x = curPos.x, y = curPos.y})
self.battleData:exchangeGridEntities(posId, fallPosId)
self:fillThisPos(fallPosId, columnCount, gridMap)
return
end
end
end

View File

@ -87,12 +87,15 @@ 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 skillEntity = DataManager.BattleData:getSkillEntities()[elementType]
if skillEntity then
self.skillNodeCells[elementType]:refresh(skillEntity)
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
self.skillNodeCells[elementType]:getBaseObject():setActive(skillEntity ~= nil)
end
uiMap["battle_ui.bg_2.skill_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT):RefreshLayout()
@ -495,10 +498,13 @@ 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 entity = DataManager.BattleData:getNewGridEntity()
entity:setCell(cell)
self.generateSkillGridEntities[elementType] = entity
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

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