火蛇海蛇效果
This commit is contained in:
parent
0e143e3a81
commit
7dae3a6ab5
@ -479,6 +479,8 @@ local grid_type = {
|
||||
[36]={
|
||||
["icon"]="battle_obstacle_lava",
|
||||
["next_type"]=0,
|
||||
["spine_name"]="ui_battle_obstacle_firesnake",
|
||||
["spine_idle"]="idle",
|
||||
["can_fall"]=1,
|
||||
["cant_link"]=1,
|
||||
["element_invalid"]=1,
|
||||
@ -490,6 +492,8 @@ local grid_type = {
|
||||
[37]={
|
||||
["icon"]="battle_obstacle_poisonous_mist",
|
||||
["next_type"]=0,
|
||||
["spine_name"]="ui_battle_obstacle_watersnake",
|
||||
["spine_idle"]="idle",
|
||||
["can_fall"]=1,
|
||||
["cant_link"]=1,
|
||||
["element_invalid"]=1,
|
||||
|
||||
@ -330,6 +330,20 @@ function BattleManager:getPosIdsByDirection(posId, direction)
|
||||
return list
|
||||
end
|
||||
|
||||
function BattleManager:getPosDirection(originPosId, posId)
|
||||
local originR, originC = self:getPosRC(originPosId).r, self:getPosRC(originPosId).c
|
||||
local r, c = self:getPosRC(posId).r, self:getPosRC(posId).c
|
||||
if originR < r and originC == c then
|
||||
return BattleConst.BOARD_RANGE_TYPE.DOWN
|
||||
elseif originR > r and originC == c then
|
||||
return BattleConst.BOARD_RANGE_TYPE.UP
|
||||
elseif originR == r and originC < c then
|
||||
return BattleConst.BOARD_RANGE_TYPE.RIGHT
|
||||
elseif originR == r and originC > c then
|
||||
return BattleConst.BOARD_RANGE_TYPE.LEFT
|
||||
end
|
||||
end
|
||||
|
||||
----------------------- end 一些公共相关的方法 -----------------------------
|
||||
|
||||
function BattleManager:bindBattleUnitAttribute(hashCode, side)
|
||||
|
||||
@ -125,6 +125,19 @@ local function _crossMoveNotBreak(entity, gridEntities, battleController, onlyCh
|
||||
for _, posId in ipairs(tempList) do
|
||||
local gridEntity = gridEntities[posId]
|
||||
if gridEntity:isEmptyIdle() and not map[posId] then
|
||||
local direction = ModuleManager.BattleManager:getPosDirection(entity:getPosId(), posId)
|
||||
local cell = entity:getCell()
|
||||
if cell then
|
||||
if direction == BattleConst.BOARD_RANGE_TYPE.UP then
|
||||
cell:playAnim("up", true, false, false)
|
||||
elseif direction == BattleConst.BOARD_RANGE_TYPE.DOWN then
|
||||
cell:playAnim("down", true, false, false)
|
||||
elseif direction == BattleConst.BOARD_RANGE_TYPE.LEFT then
|
||||
cell:playAnim("left", true, false, false)
|
||||
elseif direction == BattleConst.BOARD_RANGE_TYPE.RIGHT then
|
||||
cell:playAnim("right", true, false, false)
|
||||
end
|
||||
end
|
||||
map[entity:getPosId()] = entity
|
||||
map[posId] = gridEntity
|
||||
battleController.battleData:exchangeGridEntities(entity:getPosId(), posId)
|
||||
@ -135,7 +148,13 @@ local function _crossMoveNotBreak(entity, gridEntities, battleController, onlyCh
|
||||
end
|
||||
end
|
||||
if succ then
|
||||
battleController.battleUI:moveGridCells(map)
|
||||
battleController.battleUI:moveGridCells(map, function()
|
||||
for _, entity in ipairs(allSnake) do
|
||||
if entity:getCell() then
|
||||
entity:getCell():playAnim(entity:getSpineIdleName(), true, false, false)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
return succ
|
||||
end
|
||||
|
||||
@ -32,17 +32,24 @@ function GridCell:refresh(gridEntity, curElement, skillPosId)
|
||||
self.lastGridType = gridEntity:getGridType()
|
||||
local spineObj = uiMap["grid_cell.touch_node.ani_node.up_bg.ui_spine_obj"]
|
||||
local upBg = uiMap["grid_cell.touch_node.ani_node.up_bg"]
|
||||
self.spineAssetLoadOver = false
|
||||
if gridEntity:getSpineAsset() then
|
||||
local scale = gridEntity:getSpineScale()
|
||||
spineObj:setLocalScale(scale, scale, scale)
|
||||
spineObj:setActive(true)
|
||||
spineObj:loadAssetAsync(gridEntity:getSpineAsset(), function()
|
||||
self.spineAssetLoadOver = true
|
||||
local finalAniname = gridEntity:getSpineIdleName()
|
||||
if self.nextSpineAniName then
|
||||
finalAniname = self.nextSpineAniName
|
||||
self.nextSpineAniName = nil
|
||||
end
|
||||
if gridEntity:getSpineChangeName() then
|
||||
spineObj:playAnimComplete(gridEntity:getSpineChangeName(), false, true, function()
|
||||
spineObj:playAnim(gridEntity:getSpineIdleName(), true, false, true)
|
||||
spineObj:playAnim(finalAniname, true, false, true)
|
||||
end, true)
|
||||
else
|
||||
spineObj:playAnim(gridEntity:getSpineIdleName(), true, false, true)
|
||||
spineObj:playAnim(finalAniname, true, false, true)
|
||||
end
|
||||
end)
|
||||
upBg:setSprite(GConst.ATLAS_PATH.COMMON, "common_alpha")
|
||||
@ -265,4 +272,16 @@ function GridCell:setGridTypeIcon(icon)
|
||||
uiMap["grid_cell.touch_node.ani_node.up_bg.ui_spine_obj"]:setActive(false)
|
||||
end
|
||||
|
||||
function GridCell:playAnim(aniName, loop, forceRefresh, forceGetSG)
|
||||
if not self.spineAssetLoadOver then
|
||||
self.nextSpineAniName = aniName
|
||||
return
|
||||
end
|
||||
self.nextSpineAniName = nil
|
||||
|
||||
local uiMap = self:getUIMap()
|
||||
local spineObj = uiMap["grid_cell.touch_node.ani_node.up_bg.ui_spine_obj"]
|
||||
spineObj:playAnim(aniName, loop, forceRefresh, forceGetSG)
|
||||
end
|
||||
|
||||
return GridCell
|
||||
@ -168,7 +168,7 @@ function BattleTeamEntity:getWeakness(matchType)
|
||||
end
|
||||
|
||||
function BattleTeamEntity:getCrittime()
|
||||
return self.attr.crittime or 0
|
||||
return self.attr.crit_time or 0
|
||||
end
|
||||
|
||||
function BattleTeamEntity:getCrit()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user