一些spine
This commit is contained in:
parent
64862d77d9
commit
e45172d4f5
@ -4,6 +4,7 @@ local UISpineObject = class("SpineObject", BaseObject)
|
||||
local BF_UI_TOUCH_EVENT = GConst.TYPEOF_UNITY_CLASS.BF_UI_TOUCH_EVENT
|
||||
local TYPE_OF_SPINE_ASSET = GConst.TYPEOF_UNITY_CLASS.SKELETON_DATA_ASSET
|
||||
local SPINE_ASSET_PATH = "assets/arts/spines/ui/%s/%s_skeletondata.asset"
|
||||
local CHARACTERS_SPINE_ASSET_PATH = "assets/arts/spines/characters/%s/%s_skeletondata.asset"
|
||||
|
||||
function UISpineObject:ctor()
|
||||
end
|
||||
@ -168,8 +169,14 @@ function UISpineObject:loadAssetSync(assetName)
|
||||
skeletonGraphic:Initialize(true)
|
||||
end
|
||||
|
||||
function UISpineObject:loadAssetAsync(assetName, callback)
|
||||
local path = string.format(SPINE_ASSET_PATH, assetName, assetName)
|
||||
function UISpineObject:loadAssetAsync(assetName, callback, useCharacterPath)
|
||||
local path
|
||||
if useCharacterPath then
|
||||
path = string.format(CHARACTERS_SPINE_ASSET_PATH, assetName, assetName)
|
||||
else
|
||||
path = string.format(SPINE_ASSET_PATH, assetName, assetName)
|
||||
end
|
||||
|
||||
if self.curAssetPath == path and not self.loadingAsset then
|
||||
return callback and callback()
|
||||
end
|
||||
|
||||
@ -11,7 +11,7 @@ function HeroCell:init()
|
||||
self.progressTx = uiMap["hero_cell.hero_bg.progress_tx"]
|
||||
self.lvTx = uiMap["hero_cell.hero_bg.lv_tx"]
|
||||
self.unlockTx = uiMap["hero_cell.hero_bg.unlock_tx"]
|
||||
self.lvUpArrow = uiMap["hero_cell.hero_bg.progress_bg.arrow"]
|
||||
self.lvUpArrow = uiMap["hero_cell.hero_bg.effect_node.ui_spine_obj"]
|
||||
self.fragmenImg = uiMap["hero_cell.hero_bg.progress_bg.fragment_img"]
|
||||
self.isGray = false
|
||||
self.baseObject:addClickListener(function()
|
||||
@ -27,6 +27,9 @@ function HeroCell:refresh(heroEntity, isGray)
|
||||
|
||||
local canLvUp = heroEntity:canLvUp()
|
||||
self.lvUpArrow:setVisible(canLvUp)
|
||||
if canLvUp then
|
||||
self.lvUpArrow:playAnim("animation", true, false)
|
||||
end
|
||||
self.fragmenImg:setVisible(not canLvUp)
|
||||
local materials = heroEntity:getLvUpMaterials() or {}
|
||||
local fragmentCount = DataManager.BagData.ItemData:getItemNumById(heroEntity:getFragmentId())
|
||||
|
||||
@ -18,12 +18,13 @@ function HeroDetailUI:ctor(parmas)
|
||||
end
|
||||
|
||||
function HeroDetailUI:onLoadRootComplete()
|
||||
self:_initSpineObjs()
|
||||
self:_display()
|
||||
self:_addListeners()
|
||||
self:_bind()
|
||||
end
|
||||
|
||||
function HeroDetailUI:_display()
|
||||
function HeroDetailUI:_display(lvChange)
|
||||
local uiMap = self.root:genAllChildren()
|
||||
uiMap["hero_detail_ui.bg.title_desc"]:setText(self.heroEntity:getName())
|
||||
uiMap["hero_detail_ui.bg.lv_desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, self.heroEntity:getLv()))
|
||||
@ -32,8 +33,7 @@ function HeroDetailUI:_display()
|
||||
uiMap["hero_detail_ui.bg.hp_name"]:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_2))
|
||||
uiMap["hero_detail_ui.bg.atk_name"]:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_3))
|
||||
|
||||
uiMap["hero_detail_ui.bg.skill_icon"]:setSprite(GConst.ATLAS_PATH.ICON_SKILL, ModuleManager.HeroManager:getSkillIcon(self.heroEntity:getBaseSkill()))
|
||||
uiMap["hero_detail_ui.bg.hero_icon"]:setSprite(GConst.ATLAS_PATH.ICON_HERO, self.heroEntity:getIcon())
|
||||
uiMap["hero_detail_ui.bg.skill_icon"]:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, ModuleManager.HeroManager:getSkillRogueIcon(self.heroEntity:getUnlockRogueId()))
|
||||
uiMap["hero_detail_ui.bg.hero_element"]:setSprite(GConst.ATLAS_PATH.ICON_HERO, ModuleManager.HeroManager:getMatchTypeIcon(self.heroEntity:getMatchType()))
|
||||
|
||||
local materials = self.heroEntity:getLvUpMaterials() or {}
|
||||
@ -62,6 +62,12 @@ function HeroDetailUI:_display()
|
||||
else
|
||||
skillLv:setText(GConst.EMPTY_STRING)
|
||||
skillBg:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, ModuleManager.HeroManager:getSkillRogueBg(skillId, true))
|
||||
if i == activeCount and lvChange then
|
||||
local x, y = skillBg:fastGetAnchoredPosition()
|
||||
self.spineObjSkill:setLocalPositionX(x)
|
||||
self.spineObjSkill:setVisible(true)
|
||||
self.spineObjSkill:playAnim("idle", false, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -69,7 +75,6 @@ function HeroDetailUI:_display()
|
||||
uiMap["hero_detail_ui.bg.fragment_bg"]:setVisible(not self.heroEntity:isMaxLv())
|
||||
|
||||
local canLvUp = self.heroEntity:canLvUp()
|
||||
uiMap["hero_detail_ui.bg.fragment_bg.arrow"]:setVisible(canLvUp)
|
||||
uiMap["hero_detail_ui.bg.fragment_icon"]:setVisible(not canLvUp)
|
||||
|
||||
local lv = self.heroEntity:getLv()
|
||||
@ -105,13 +110,20 @@ function HeroDetailUI:_display()
|
||||
uiMap["hero_detail_ui.bg.atk"]:setText(atkStr)
|
||||
|
||||
local btn = uiMap["hero_detail_ui.bg.up_btn"]
|
||||
self.spineObjLv:setVisible(canLvUp)
|
||||
if canLvUp then
|
||||
btn:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[1])
|
||||
self.spineObjLv:playAnim("animation", true, false)
|
||||
else
|
||||
btn:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[2])
|
||||
end
|
||||
btn:setTouchEnable(true)
|
||||
btn:setActive(not self.heroEntity:isMaxLv())
|
||||
|
||||
if lvChange then
|
||||
self.spineObj:setVisible(true)
|
||||
self.spineObj:playAnim("idle", false, true)
|
||||
end
|
||||
end
|
||||
|
||||
function HeroDetailUI:_addListeners()
|
||||
@ -127,8 +139,24 @@ end
|
||||
|
||||
function HeroDetailUI:_bind()
|
||||
self:bind(self.heroEntity, "lv", function()
|
||||
self:_display()
|
||||
self:_display(true)
|
||||
end)
|
||||
end
|
||||
|
||||
function HeroDetailUI:_initSpineObjs()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
self.spineObjSkill = uiMap["hero_detail_ui.bg.spine_node.ui_spine_obj_skill"]
|
||||
self.spineObjLv = uiMap["hero_detail_ui.bg.spine_node.ui_spine_obj_lv"]
|
||||
self.spineObj = uiMap["hero_detail_ui.bg.spine_node.ui_spine_obj"]
|
||||
self.spineObjAvatar = uiMap["hero_detail_ui.bg.spine_node.ui_spine_obj_avatar"]
|
||||
|
||||
self.spineObjAvatar:loadAssetAsync(self.heroEntity:getModelId(), function()
|
||||
self.spineObjAvatar:playAnim("idle", true, true, true)
|
||||
end, true)
|
||||
|
||||
self.spineObjSkill:setVisible(false)
|
||||
self.spineObjLv:setVisible(false)
|
||||
self.spineObj:setVisible(false)
|
||||
end
|
||||
|
||||
return HeroDetailUI
|
||||
Loading…
x
Reference in New Issue
Block a user