Merge branch 'dev' of git.juzugame.com:b6-client/b6-lua into dev
This commit is contained in:
commit
39fed0bb6d
@ -65,7 +65,6 @@ function DataManager:clear()
|
|||||||
end
|
end
|
||||||
self.cdCallBack = {}
|
self.cdCallBack = {}
|
||||||
self.PlayerData:clear()
|
self.PlayerData:clear()
|
||||||
self.BattleData:clear()
|
|
||||||
self.ChapterData:clear()
|
self.ChapterData:clear()
|
||||||
self.HeroData:clear()
|
self.HeroData:clear()
|
||||||
self.BagData:clear()
|
self.BagData:clear()
|
||||||
|
|||||||
@ -318,7 +318,7 @@ function BattleController:onLinkOver()
|
|||||||
for posId, _ in pairs(DataManager.BattleData:getSkillInfluenceGrids()) do
|
for posId, _ in pairs(DataManager.BattleData:getSkillInfluenceGrids()) do
|
||||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||||
if not entity:getIsIdle() then
|
if not entity:getIsIdle() then
|
||||||
if entity:isEmptyType() then
|
if entity:isEmptyIdle() then
|
||||||
entity:setIsIdle(true)
|
entity:setIsIdle(true)
|
||||||
if not eliminationPosIds[posId] then
|
if not eliminationPosIds[posId] then
|
||||||
eliminationPosIds[posId] = true
|
eliminationPosIds[posId] = true
|
||||||
@ -342,11 +342,12 @@ function BattleController:onLinkOver()
|
|||||||
if not eliminationPosIds[posId] then
|
if not eliminationPosIds[posId] then
|
||||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||||
if entity then
|
if entity then
|
||||||
|
local elementTypeInvalid = entity:isElmentTypeInvalid()
|
||||||
entity:addAroundEliminationCount()
|
entity:addAroundEliminationCount()
|
||||||
if entity:getIsIdle() then
|
if entity:getIsIdle() then
|
||||||
eliminationPosIds[posId] = true
|
eliminationPosIds[posId] = true
|
||||||
table.insert(sequence, {posId = posId})
|
table.insert(sequence, {posId = posId, noAni = elementTypeInvalid})
|
||||||
if not entity:getSkillId() then
|
if not entity:getSkillId() and not elementTypeInvalid 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
|
||||||
@ -371,16 +372,36 @@ function BattleController:fillBoard()
|
|||||||
local pathMap = {}
|
local pathMap = {}
|
||||||
local columnCount = {}
|
local columnCount = {}
|
||||||
|
|
||||||
|
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
|
||||||
local posId = ModuleManager.BattleManager:getPosId(r, c)
|
local posId = ModuleManager.BattleManager:getPosId(r, c)
|
||||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||||
if entity:getIsIdle() then
|
if entity:getIsIdle() then
|
||||||
self:fillThisPos(posId, columnCount)
|
self:fillThisPos(posId, columnCount, gridMap)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
while true do
|
||||||
|
local find = false
|
||||||
|
for c = 1, BattleConst.COLUMN_COUNT do
|
||||||
|
local list = gridMap[c]
|
||||||
|
if list and list[1] then -- 此列有需要填充的元素
|
||||||
|
local entity = table.remove(list, 1)
|
||||||
|
if entity then
|
||||||
|
DataManager.BattleData:setGridInfo(entity:getPosId(), self:getRandomGridInfo())
|
||||||
|
end
|
||||||
|
find = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not find then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
local posId = ModuleManager.BattleManager:getPosId(r, c)
|
local posId = ModuleManager.BattleManager:getPosId(r, c)
|
||||||
@ -397,7 +418,10 @@ function BattleController:fillBoard()
|
|||||||
self.battleUI:enableUITouch()
|
self.battleUI:enableUITouch()
|
||||||
|
|
||||||
---- 临时
|
---- 临时
|
||||||
ModuleManager.BattleManager:showSelectSkillUI(self:getRandomSkillList())
|
-- local list = {BattleConst.GRID_TYPE.SNOW_BOX, BattleConst.GRID_TYPE.SOLID_SNOW, BattleConst.GRID_TYPE.VINES, BattleConst.GRID_TYPE.ICE}
|
||||||
|
-- local gridType = list[math.random(1, 4)]
|
||||||
|
-- self:generateGridType(gridType)
|
||||||
|
-- ModuleManager.BattleManager:showSelectSkillUI(self:getRandomSkillList())
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -504,6 +528,25 @@ function BattleController:generateSkill()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleController:generateGridType(gridType)
|
||||||
|
if not gridType then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local list = {}
|
||||||
|
local count = 0
|
||||||
|
for posId, entity in pairs(DataManager.BattleData:getGridEnties()) do
|
||||||
|
if entity:isEmptyIdle() then
|
||||||
|
table.insert(list, entity)
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if count > 0 then
|
||||||
|
local entity = list[math.random(1, count)]
|
||||||
|
DataManager.BattleData:setGridInfo(entity:getPosId(), {gridType = gridType, elementType = entity:getElementType()})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function BattleController:getSkillElementList(elementType, count, useAlternate)
|
function BattleController:getSkillElementList(elementType, count, useAlternate)
|
||||||
local result = {}
|
local result = {}
|
||||||
local gridEntities = DataManager.BattleData:getGridEnties()
|
local gridEntities = DataManager.BattleData:getGridEnties()
|
||||||
@ -566,7 +609,7 @@ function BattleController:getSkillElementList(elementType, count, useAlternate)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---- 从一个点直接遍历所有相关的路径
|
---- 从一个点直接遍历所有相关的路径
|
||||||
function BattleController:fillThisPos(posId, columnCount)
|
function BattleController:fillThisPos(posId, columnCount, gridMap)
|
||||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||||
if not entity or not entity:getIsIdle() then
|
if not entity or not entity:getIsIdle() then
|
||||||
return
|
return
|
||||||
@ -598,7 +641,10 @@ function BattleController:fillThisPos(posId, columnCount)
|
|||||||
fallEntity:addPath({x = curPos.x, y = curPos.y})
|
fallEntity:addPath({x = curPos.x, y = curPos.y})
|
||||||
|
|
||||||
DataManager.BattleData:exchangeGridEntities(posId, fallPosId)
|
DataManager.BattleData:exchangeGridEntities(posId, fallPosId)
|
||||||
DataManager.BattleData:setGridInfo(posId, self:getRandomGridInfo())
|
if not gridMap[c] then
|
||||||
|
gridMap[c] = {}
|
||||||
|
end
|
||||||
|
table.insert(gridMap[c], fallEntity)
|
||||||
else
|
else
|
||||||
for index, fallPosId in ipairs(list) do
|
for index, fallPosId in ipairs(list) do
|
||||||
local fallEntity = DataManager.BattleData:getGridEntity(fallPosId)
|
local fallEntity = DataManager.BattleData:getGridEntity(fallPosId)
|
||||||
@ -608,7 +654,7 @@ function BattleController:fillThisPos(posId, columnCount)
|
|||||||
if fallEntity then
|
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)
|
self:fillThisPos(fallPosId, columnCount, gridMap)
|
||||||
end
|
end
|
||||||
fallEntity = DataManager.BattleData:getGridEntity(fallPosId)
|
fallEntity = DataManager.BattleData:getGridEntity(fallPosId)
|
||||||
if not fallEntity:getIsIdle() then
|
if not fallEntity:getIsIdle() then
|
||||||
@ -621,7 +667,7 @@ function BattleController:fillThisPos(posId, columnCount)
|
|||||||
fallEntity:addPath({x = curPos.x, y = curPos.y})
|
fallEntity:addPath({x = curPos.x, y = curPos.y})
|
||||||
|
|
||||||
DataManager.BattleData:exchangeGridEntities(posId, fallPosId)
|
DataManager.BattleData:exchangeGridEntities(posId, fallPosId)
|
||||||
self:fillThisPos(fallPosId, columnCount)
|
self:fillThisPos(fallPosId, columnCount, gridMap)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -660,6 +706,7 @@ function BattleController:getRandomGridInfo()
|
|||||||
local index = GFunc.getRandomIndex(indexs)
|
local index = GFunc.getRandomIndex(indexs)
|
||||||
elementType = typeList[index]
|
elementType = typeList[index]
|
||||||
end
|
end
|
||||||
|
|
||||||
return {gridType = gridType, elementType = elementType}
|
return {gridType = gridType, elementType = elementType}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -768,7 +815,7 @@ function BattleController:addHeroAttr(attrName, value)
|
|||||||
-- -- body
|
-- -- body
|
||||||
-- elseif attrName == then
|
-- elseif attrName == then
|
||||||
-- -- body
|
-- -- body
|
||||||
-- elseif attrName == then
|
-- elseif attrName == then'
|
||||||
-- -- body
|
-- -- body
|
||||||
-- elseif attrName == then
|
-- elseif attrName == then
|
||||||
-- -- body
|
-- -- body
|
||||||
|
|||||||
@ -195,7 +195,7 @@ function BattleUI:eliminationAni(sequence, callback)
|
|||||||
if entity and entity:getCell() then
|
if entity and entity:getCell() then
|
||||||
local baseObject = entity:getCell():getBaseObject()
|
local baseObject = entity:getCell():getBaseObject()
|
||||||
baseObject:getTransform():SetAsLastSibling()
|
baseObject:getTransform():SetAsLastSibling()
|
||||||
if entity:getSkillId() then
|
if entity:getSkillId() or info.noAni then
|
||||||
baseObject:setAnchoredPositionX(DEFAULT_X)
|
baseObject:setAnchoredPositionX(DEFAULT_X)
|
||||||
else
|
else
|
||||||
self.eliminationAniSeq:Insert(index * 0.01, baseObject:getTransform():DOScale(1.3, 0.1))
|
self.eliminationAniSeq:Insert(index * 0.01, baseObject:getTransform():DOScale(1.3, 0.1))
|
||||||
|
|||||||
@ -71,6 +71,9 @@ function BattleGridEntity:isEmptyType()
|
|||||||
return self.gridType == BattleConst.GRID_TYPE.EMPTY
|
return self.gridType == BattleConst.GRID_TYPE.EMPTY
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleGridEntity:isElmentTypeInvalid()
|
||||||
|
return BattleConst.AROUND_ELIMINATION_TO_TYPE_COUNT[self.gridType] ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
function BattleGridEntity:getAroundEliminationCount()
|
function BattleGridEntity:getAroundEliminationCount()
|
||||||
return self.aroundEliminationCount
|
return self.aroundEliminationCount
|
||||||
@ -175,6 +178,13 @@ function BattleGridEntity:canInfluenceBySkill()
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleGridEntity:isEmptyIdle()
|
||||||
|
if self:isEmptyType() and not self:getSkillId() then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
function BattleGridEntity:setNeedElimination(need)
|
function BattleGridEntity:setNeedElimination(need)
|
||||||
self.needElimination = need
|
self.needElimination = need
|
||||||
self:setDirty()
|
self:setDirty()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user