54 lines
1.6 KiB
Lua
54 lines
1.6 KiB
Lua
local TalentInfoUI = class("TalentInfoUI", BaseUI)
|
|
|
|
local TALENT_CELL = "app/ui/talent/cell/talent_cell"
|
|
|
|
function TalentInfoUI:ctor(parmas)
|
|
parmas = parmas or {}
|
|
self.id = parmas.id or 1
|
|
end
|
|
|
|
function TalentInfoUI:isFullScreen()
|
|
return false
|
|
end
|
|
|
|
function TalentInfoUI:getPrefabPath()
|
|
return "assets/prefabs/ui/talent/talent_info_ui.prefab"
|
|
end
|
|
|
|
function TalentInfoUI:onLoadRootComplete()
|
|
local uiMap = self.root:genAllChildren()
|
|
-- self.root:addClickListener(function()
|
|
-- self:closeUI()
|
|
-- end)
|
|
|
|
self.talentCell = uiMap["talent_info_ui.talent_cell"]:addLuaComponent(TALENT_CELL)
|
|
-- self.animator = uiMap["talent_info_ui.talent_cell"]:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR)
|
|
-- self.animator.enabled = false
|
|
self.descTx = uiMap["talent_info_ui.desc_tx"]
|
|
self.leftArrowBtn = uiMap["talent_info_ui.left_arrow_btn"]
|
|
self.rightArrowBtn = uiMap["talent_info_ui.right_arrow_btn"]
|
|
local continue = uiMap["talent_info_ui.continue"]
|
|
continue:setText(I18N:getGlobalText(I18N.GlobalConst.CLICK_TO_CONTINUE))
|
|
continue:addClickListener(function()
|
|
self:closeUI()
|
|
end)
|
|
|
|
self.leftArrowBtn:addClickListener(function()
|
|
self.id = self.id - 1
|
|
self:onRefresh()
|
|
end)
|
|
self.rightArrowBtn:addClickListener(function()
|
|
self.id = self.id + 1
|
|
self:onRefresh()
|
|
end)
|
|
end
|
|
|
|
function TalentInfoUI:onRefresh()
|
|
self.list = DataManager.TalentData:getCfgList()
|
|
self.talentCell:refresh(self.id, self.list[self.id])
|
|
self.leftArrowBtn:setActive(self.id > 1)
|
|
self.rightArrowBtn:setActive(self.id < #self.list)
|
|
self.descTx:setText(I18N:getText("talent", self.id, "desc"))
|
|
end
|
|
|
|
return TalentInfoUI |