74 lines
2.2 KiB
Lua
Executable File
74 lines
2.2 KiB
Lua
Executable File
local SummonUnlockUI = class("SummonUnlockUI", BaseUI)
|
|
|
|
local CELL_HEIGHT = 230
|
|
local CELL_HEIGHT_1 = 120
|
|
local NOT_OWN_NODE_HEIGHT = 56
|
|
local DIFF_HEIGHT = 20
|
|
local ForceCell = "app/ui/summon/cell/summon_force_cell"
|
|
|
|
function SummonUnlockUI:isFullScreen()
|
|
return false
|
|
end
|
|
|
|
function SummonUnlockUI:ctor(params)
|
|
params = params or {}
|
|
self.unlockList = params.unlockList or {}
|
|
self.idx = 1
|
|
end
|
|
|
|
function SummonUnlockUI:getPrefabPath()
|
|
return "assets/prefabs/ui/summon/summon_unlock_ui.prefab"
|
|
end
|
|
|
|
function SummonUnlockUI:onClose()
|
|
self.heroNode:removeAllChildren()
|
|
end
|
|
|
|
function SummonUnlockUI:onLoadRootComplete()
|
|
local uiMap = self.root:genAllChildren()
|
|
self.root:addClickListener(function()
|
|
self:checkUnlockMap()
|
|
end)
|
|
|
|
self.heroNode = uiMap["summon_unlock_ui.hero_node"]
|
|
self.nameTx = uiMap["summon_unlock_ui.name_tx"]
|
|
self.matchTx = uiMap["summon_unlock_ui.match_tx"]
|
|
self.matchImg = uiMap["summon_unlock_ui.match_tx.match_img"]
|
|
self.qltBg = uiMap["summon_unlock_ui.qlt_bg"]
|
|
self.qltBgTx = uiMap["summon_unlock_ui.qlt_bg.qlt_tx"]
|
|
|
|
uiMap["summon_unlock_ui.title_bg.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACTIVITY_MOON_DESC_3))
|
|
uiMap["summon_unlock_ui.continue_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.CLICK_TO_CONTINUE))
|
|
end
|
|
|
|
function SummonUnlockUI:onRefresh()
|
|
self.heroNode:removeAllChildren()
|
|
self.heroId = table.remove(self.unlockList, 1)
|
|
local heroEntity = DataManager.HeroData:getHeroById(self.heroId)
|
|
local matchType = heroEntity:getMatchType()
|
|
local qlt = heroEntity:getQlt()
|
|
self.matchTx:setText(ModuleManager.HeroManager:getMatchTypeName(matchType))
|
|
self.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, ModuleManager.HeroManager:getMatchTypeIcon(matchType))
|
|
self.qltBg:setSprite(GFunc.getHeroQltImg(qlt))
|
|
self.qltBgTx:setText(GFunc.getHeroQltStr(qlt))
|
|
|
|
self:loadHero()
|
|
end
|
|
|
|
function SummonUnlockUI:loadHero()
|
|
local cfg = DataManager.HeroData:getHeroConfig(self.heroId)
|
|
SpineManager:loadHeroAsync(cfg.model_id, self.heroNode, function(spineObject)
|
|
spineObject:playAnimation("idle", true)
|
|
end)
|
|
end
|
|
|
|
function SummonUnlockUI:checkUnlockMap()
|
|
if #self.unlockList <= 0 then
|
|
self:closeUI()
|
|
return
|
|
end
|
|
self.idx = self.idx + 1
|
|
self:onRefresh()
|
|
end
|
|
|
|
return SummonUnlockUI |