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.talentCell = uiMap["talent_info_ui.node.talent_cell"]:addLuaComponent(TALENT_CELL) 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) local attr, num = DataManager.TalentData:getAttrById(self.id) local str = I18N:getText("talent", self.id, "desc") if attr and #attr > 0 then str = str .. GFunc.getPerStr(attr[1].type, attr[1].num / GConst.DEFAULT_FACTOR) -- else -- str = str .. (num or 0) end self.descTx:setText(str) end return TalentInfoUI