diff --git a/lua/app/config/grid_type.lua b/lua/app/config/grid_type.lua index bf437785..51eda885 100644 --- a/lua/app/config/grid_type.lua +++ b/lua/app/config/grid_type.lua @@ -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, diff --git a/lua/app/module/battle/battle_manager.lua b/lua/app/module/battle/battle_manager.lua index cd2ea012..0935f870 100644 --- a/lua/app/module/battle/battle_manager.lua +++ b/lua/app/module/battle/battle_manager.lua @@ -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) diff --git a/lua/app/module/battle/skill/battle_grid_effect_handle.lua b/lua/app/module/battle/skill/battle_grid_effect_handle.lua index 60b7af14..95c71bd8 100644 --- a/lua/app/module/battle/skill/battle_grid_effect_handle.lua +++ b/lua/app/module/battle/skill/battle_grid_effect_handle.lua @@ -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 diff --git a/lua/app/ui/battle/cell/grid_cell.lua b/lua/app/ui/battle/cell/grid_cell.lua index 0611260a..f48a2588 100644 --- a/lua/app/ui/battle/cell/grid_cell.lua +++ b/lua/app/ui/battle/cell/grid_cell.lua @@ -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 \ No newline at end of file diff --git a/lua/app/userdata/battle/team/battle_team_entity.lua b/lua/app/userdata/battle/team/battle_team_entity.lua index 1d7b38c7..a74cf6a8 100644 --- a/lua/app/userdata/battle/team/battle_team_entity.lua +++ b/lua/app/userdata/battle/team/battle_team_entity.lua @@ -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()