Merge branch 'dev' of git.juzugame.com:b6-client/b6-lua into dev
This commit is contained in:
commit
ee3e56af2a
@ -26,6 +26,13 @@ BattleConst.GRID_TYPE = {
|
||||
ICE = 5,
|
||||
}
|
||||
|
||||
BattleConst.GRID_TYPE_ICON = {
|
||||
[BattleConst.GRID_TYPE.SNOW_BOX] = "snow_1",
|
||||
[BattleConst.GRID_TYPE.SOLID_SNOW] = "snow_2",
|
||||
[BattleConst.GRID_TYPE.VINES] = "vine",
|
||||
[BattleConst.GRID_TYPE.ICE] = "ice",
|
||||
}
|
||||
|
||||
---- 周围格子消除一次后会变成什么格子
|
||||
BattleConst.AROUND_ELIMINATION_TO_TYPE_COUNT = {
|
||||
[BattleConst.GRID_TYPE.SNOW_BOX] = {BattleConst.GRID_TYPE.EMPTY},
|
||||
@ -35,6 +42,7 @@ BattleConst.AROUND_ELIMINATION_TO_TYPE_COUNT = {
|
||||
|
||||
---- 不可下落的格子类型
|
||||
BattleConst.CANT_FALL_GRID_TYPE = {
|
||||
[BattleConst.GRID_TYPE.OBSTACLE] = true,
|
||||
[BattleConst.GRID_TYPE.VINES] = true,
|
||||
[BattleConst.GRID_TYPE.ICE] = true,
|
||||
}
|
||||
|
||||
@ -32,8 +32,8 @@ function BattleManager:getElementIcon(elementType)
|
||||
return GConst.ATLAS_PATH.BATTLE, icon
|
||||
end
|
||||
|
||||
function BattleManager:getGridTypeIcon(elementType)
|
||||
local icon = GConst.BattleConst.ELEMENT_ICON[elementType]
|
||||
function BattleManager:getGridTypeIcon(gridType)
|
||||
local icon = GConst.BattleConst.GRID_TYPE_ICON[gridType]
|
||||
if not icon then
|
||||
return GConst.ATLAS_PATH.COMMON, "common_alpha"
|
||||
end
|
||||
|
||||
@ -117,17 +117,30 @@ function BattleController:onEliminationAniOver()
|
||||
eliminationPosIds[posId] = true
|
||||
end
|
||||
|
||||
local newIdleList = {}
|
||||
local cellList = {}
|
||||
for posId, status in pairs(boomGridIds) do
|
||||
if not eliminationPosIds[posId] then
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
if entity then
|
||||
entity:addAroundEliminationCount()
|
||||
if entity:getIsIdle() then
|
||||
table.insert(newIdleList, entity)
|
||||
table.insert(cellList, entity:getCell())
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
DataManager.BattleData:clearGridSequence()
|
||||
|
||||
if cellList[1] then
|
||||
self.battleUI:eliminationAni(cellList, function()
|
||||
self:fillBoard()
|
||||
end)
|
||||
return
|
||||
end
|
||||
|
||||
self:fillBoard()
|
||||
end
|
||||
|
||||
|
||||
@ -1,15 +1,27 @@
|
||||
local GridCell = class("GridCell", BaseCell)
|
||||
|
||||
function GridCell:refresh(gridEntity, curElement)
|
||||
local atlas, icon = ModuleManager.BattleManager:getElementIcon(gridEntity:getElementType())
|
||||
local uiMap = self:getUIMap()
|
||||
if self.lastIcon ~= icon then
|
||||
self.lastIcon = icon
|
||||
local elementType = gridEntity:getElementType()
|
||||
if self.lastElementType ~= elementType then
|
||||
self.lastElementType = elementType
|
||||
local atlas, icon = ModuleManager.BattleManager:getElementIcon(elementType)
|
||||
uiMap["grid_cell.touch_node.ani_node.middle_bg"]:setSprite(atlas, icon)
|
||||
end
|
||||
|
||||
uiMap["grid_cell.touch_node.ani_node.mask"]:setVisible(curElement and curElement ~= gridEntity:getElementType())
|
||||
uiMap["grid_cell.touch_node.ani_node.obstacle"]:setVisible(gridEntity:isCantFallType())
|
||||
local showMask = false
|
||||
if curElement and (curElement ~= elementType or not gridEntity:canLink()) then
|
||||
showMask = true
|
||||
end
|
||||
|
||||
uiMap["grid_cell.touch_node.ani_node.mask"]:setVisible(showMask)
|
||||
uiMap["grid_cell.touch_node.ani_node.obstacle"]:setVisible(gridEntity:isObstacleType())
|
||||
|
||||
if self.lastGridType ~= gridEntity:getGridType() then
|
||||
self.lastGridType = gridEntity:getGridType()
|
||||
local atlas, icon = ModuleManager.BattleManager:getGridTypeIcon(self.lastGridType)
|
||||
uiMap["grid_cell.touch_node.ani_node.up_bg"]:setSprite(atlas, icon)
|
||||
end
|
||||
|
||||
--- 测试代码
|
||||
uiMap["grid_cell.touch_node.ani_node.count"]:setText(gridEntity:getAroundEliminationCount())
|
||||
|
||||
@ -34,6 +34,10 @@ function BattleGridEntity:isCantFallType()
|
||||
return BattleConst.CANT_FALL_GRID_TYPE[self.gridType] or false
|
||||
end
|
||||
|
||||
function BattleGridEntity:isObstacleType()
|
||||
return self.gridType == BattleConst.GRID_TYPE.OBSTACLE
|
||||
end
|
||||
|
||||
function BattleGridEntity:getAroundEliminationCount()
|
||||
return self.aroundEliminationCount
|
||||
end
|
||||
@ -41,10 +45,13 @@ end
|
||||
function BattleGridEntity:addAroundEliminationCount(count)
|
||||
count = count or 1
|
||||
self.aroundEliminationCount = self.aroundEliminationCount + count
|
||||
local gridTypeList = BattleConst.AROUND_ELIMINATION_TO_EMPTY_TYPE_COUNT[self.gridType]
|
||||
local gridTypeList = BattleConst.AROUND_ELIMINATION_TO_TYPE_COUNT[self.gridType]
|
||||
if gridTypeList and gridTypeList[self.aroundEliminationCount] then
|
||||
self:setGridType(gridTypeList[self.aroundEliminationCount])
|
||||
self.aroundEliminationCount = self.aroundEliminationCount - 1
|
||||
local gridType = gridTypeList[self.aroundEliminationCount]
|
||||
self:setGridType(gridType)
|
||||
if gridType == BattleConst.GRID_TYPE.EMPTY then
|
||||
self:setIsIdle(true)
|
||||
end
|
||||
end
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user