格子支持一下spine

This commit is contained in:
xiekaidong 2023-05-31 20:11:00 +08:00
parent ededa19132
commit 694ef22777
2 changed files with 33 additions and 2 deletions

View File

@ -29,8 +29,27 @@ function GridCell:refresh(gridEntity, curElement, skillPosId)
if self.lastGridType ~= gridEntity:getGridType() then
self.lastGridType = gridEntity:getGridType()
local atlas, icon = gridEntity:getIcon()
uiMap["grid_cell.touch_node.ani_node.up_bg"]:setSprite(atlas, icon)
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"]
if gridEntity:getSpineAsset() then
spineObj:setActive(true)
Logger.logHighlight(gridEntity:getSpineIdleName())
spineObj:loadAssetAsync(gridEntity:getSpineAsset(), function()
if gridEntity:getSpineChangeName() then
spineObj:playAnimComplete(gridEntity:getSpineChangeName(), false, true, function()
spineObj:playAnim(gridEntity:getSpineIdleName(), true, false, true)
end, true)
else
Logger.logHighlight("----")
spineObj:playAnim(gridEntity:getSpineIdleName(), true, false, true)
end
end)
upBg:setSprite(GConst.ATLAS_PATH.COMMON, "common_alpha")
else
spineObj:setActive(false)
local atlas, icon = gridEntity:getIcon()
upBg:setSprite(atlas, icon)
end
end
local skillIcon = uiMap["grid_cell.touch_node.ani_node.skill_icon"]

View File

@ -394,4 +394,16 @@ function BattleGridEntity:getBreakFlyToCharacterIcon()
return self:getGridTypeConfig().bftc_icon
end
function BattleGridEntity:getSpineAsset()
return self:getGridTypeConfig().spine_name
end
function BattleGridEntity:getSpineIdleName()
return self:getGridTypeConfig().spine_idle
end
function BattleGridEntity:getSpineChangeName()
return self:getGridTypeConfig().spine_change
end
return BattleGridEntity