优化逻辑

This commit is contained in:
xiekaidong 2023-08-11 11:59:47 +08:00
parent f5ed280271
commit 213e82f2c1

View File

@ -2102,34 +2102,38 @@ function BattleBaseController:fillThisPos(posId, columnCount, gridMap, reverse)
end
function BattleBaseController:judgeGridEdgeCanFall(posId, fallPosId, reverse)
local direction = ModuleManager.BattleManager:getPosDirection(posId, fallPosId)
local reverseDirection = ModuleManager.BattleManager:getReverseDirection(direction)
local fallDownPosId
if reverse then
--竖向
local gridEdgeEntity = self.battleData:getGridEdgeEntity(fallPosId, BattleConst.BOARD_RANGE_TYPE.UP)
if gridEdgeEntity and not gridEdgeEntity:getIsIdle() then
return
end
fallDownPosId = ModuleManager.BattleManager:getPosByDirection(fallPosId, BattleConst.BOARD_RANGE_TYPE.UP)
if fallDownPosId then
local gridEdgeEntity = self.battleData:getGridEdgeEntity(fallDownPosId, BattleConst.BOARD_RANGE_TYPE.DOWN)
if reverseDirection then
if reverse then
--竖向
local gridEdgeEntity = self.battleData:getGridEdgeEntity(fallPosId, BattleConst.BOARD_RANGE_TYPE.UP)
if gridEdgeEntity and not gridEdgeEntity:getIsIdle() then
return
end
end
else
--竖向
local gridEdgeEntity = self.battleData:getGridEdgeEntity(fallPosId, BattleConst.BOARD_RANGE_TYPE.DOWN)
if gridEdgeEntity and not gridEdgeEntity:getIsIdle() then
return
end
fallDownPosId = ModuleManager.BattleManager:getPosByDirection(fallPosId, BattleConst.BOARD_RANGE_TYPE.DOWN)
if fallDownPosId then
local gridEdgeEntity = self.battleData:getGridEdgeEntity(fallDownPosId, BattleConst.BOARD_RANGE_TYPE.UP)
fallDownPosId = ModuleManager.BattleManager:getPosByDirection(fallPosId, BattleConst.BOARD_RANGE_TYPE.UP)
if fallDownPosId then
local gridEdgeEntity = self.battleData:getGridEdgeEntity(fallDownPosId, BattleConst.BOARD_RANGE_TYPE.DOWN)
if gridEdgeEntity and not gridEdgeEntity:getIsIdle() then
return
end
end
else
--竖向
local gridEdgeEntity = self.battleData:getGridEdgeEntity(fallPosId, BattleConst.BOARD_RANGE_TYPE.DOWN)
if gridEdgeEntity and not gridEdgeEntity:getIsIdle() then
return
end
fallDownPosId = ModuleManager.BattleManager:getPosByDirection(fallPosId, BattleConst.BOARD_RANGE_TYPE.DOWN)
if fallDownPosId then
local gridEdgeEntity = self.battleData:getGridEdgeEntity(fallDownPosId, BattleConst.BOARD_RANGE_TYPE.UP)
if gridEdgeEntity and not gridEdgeEntity:getIsIdle() then
return
end
end
end
end