公司
This commit is contained in:
parent
2878bff888
commit
010b6deb02
@ -4,6 +4,8 @@ function CompanyComp:init()
|
||||
self.uiMap = self:getBaseObject():genAllChildren()
|
||||
|
||||
self.talentBtn = self.uiMap["company_comp.talent_btn"]
|
||||
self.talentBtnTx = self.uiMap["company_comp.talent_btn.text"]
|
||||
self.talentBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.TALENT_DESC_1))
|
||||
self.talentBtn:addClickListener(function()
|
||||
ModuleManager.TalentManager:showMainUI()
|
||||
end)
|
||||
|
||||
@ -43,7 +43,14 @@ function TalentInfoUI:onRefresh()
|
||||
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"))
|
||||
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
|
||||
@ -106,7 +106,15 @@ function TalentMainUI:onUpgrade()
|
||||
end
|
||||
self.upNode:setActive(true)
|
||||
self.upTalentCell:refresh(upData.id, self.list[upData.id], true)
|
||||
self.upDescTx:setText(I18N:getText("talent", upData.id, "desc"))
|
||||
|
||||
local attr, num = DataManager.TalentData:getAttrById(upData.id)
|
||||
local str = I18N:getText("talent", upData.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.upDescTx:setText(str)
|
||||
self.upDescTx:setActive(false)
|
||||
self.root:performWithDelayGlobal(function()
|
||||
self.upDescTx:setActive(true)
|
||||
|
||||
@ -60,4 +60,43 @@ function TalentData:getUpData()
|
||||
return data
|
||||
end
|
||||
|
||||
--@region 属性
|
||||
function TalentData:getAttrById(id)
|
||||
local cfg = TalentCfg[id]
|
||||
if not cfg then
|
||||
return {}
|
||||
end
|
||||
local lv = self:getLevels(id)
|
||||
local allAttr = {}
|
||||
local num = 0
|
||||
if not cfg.attr then
|
||||
num = cfg.value
|
||||
else
|
||||
for i,v in ipairs(cfg.attr) do
|
||||
local attr = {}
|
||||
attr.type = v.type
|
||||
attr.num = v.num * lv
|
||||
table.insert(allAttr, attr)
|
||||
end
|
||||
end
|
||||
return allAttr, num
|
||||
end
|
||||
|
||||
function TalentData:getAllAttr()
|
||||
local allAttr = {}
|
||||
for id = 1, #TalentCfg do
|
||||
local cfg = TalentCfg[id]
|
||||
local lv = self:getLevels(id)
|
||||
if cfg.attr then
|
||||
for _,v in ipairs(cfg.attr) do
|
||||
local attr = {}
|
||||
attr.type = v.type
|
||||
attr.num = v.num * lv
|
||||
table.insert(allAttr, attr)
|
||||
end
|
||||
end
|
||||
end
|
||||
return allAttr
|
||||
end
|
||||
--@endregion
|
||||
return TalentData
|
||||
Loading…
x
Reference in New Issue
Block a user