29 lines
871 B
Lua
29 lines
871 B
Lua
local TalentCell = class("TalentCell", BaseCell)
|
|
|
|
function TalentCell:init()
|
|
local uiMap = self:getUIMap()
|
|
|
|
self.animator = self.baseObject:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR)
|
|
self.bg = uiMap["talent_cell.bg"]
|
|
self.descTx1 = uiMap["talent_cell.desc_tx_1"]
|
|
self.descTx2 = uiMap["talent_cell.desc_tx_2"]
|
|
self.animator.enabled = false
|
|
end
|
|
|
|
function TalentCell:refresh(idx, cfg, showAni)
|
|
self.bg:setSprite(GConst.ATLAS_PATH.UI_TALENT, "talent_" .. idx)
|
|
self.descTx1:setText(I18N:getText("talent", idx, "name"))
|
|
local lv = DataManager.TalentData:getLevels(idx)
|
|
self.descTx2:setText("Lv." .. lv)
|
|
self.bg:setSprite(GConst.ATLAS_PATH.ICON_TALENT, "talent_" .. idx)
|
|
if showAni then
|
|
self.animator.enabled = true
|
|
self.animator:SetTrigger("t_open")
|
|
end
|
|
end
|
|
|
|
function TalentCell:setActive(active)
|
|
self.baseObject:setActive(active)
|
|
end
|
|
|
|
return TalentCell |