fix bug
This commit is contained in:
parent
ba655fa257
commit
79bd76cf1d
@ -29,20 +29,27 @@ function TalentInfoUI:onLoadRootComplete()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
self.leftArrowBtn:addClickListener(function()
|
self.leftArrowBtn:addClickListener(function()
|
||||||
self.id = self.id - 1
|
self.idx = self.idx - 1
|
||||||
self:onRefresh()
|
self:onRefresh()
|
||||||
end)
|
end)
|
||||||
self.rightArrowBtn:addClickListener(function()
|
self.rightArrowBtn:addClickListener(function()
|
||||||
self.id = self.id + 1
|
self.idx = self.idx + 1
|
||||||
self:onRefresh()
|
self:onRefresh()
|
||||||
end)
|
end)
|
||||||
|
self.list = DataManager.TalentData:getActiveList()
|
||||||
|
for i, cfg in ipairs(self.list) do
|
||||||
|
if cfg.id == self.id then
|
||||||
|
self.idx = i
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function TalentInfoUI:onRefresh()
|
function TalentInfoUI:onRefresh()
|
||||||
self.list = DataManager.TalentData:getCfgList()
|
self.id = self.list[self.idx].id
|
||||||
self.talentCell:refresh(self.id, self.list[self.id])
|
self.talentCell:refresh(self.id, self.list[self.idx])
|
||||||
self.leftArrowBtn:setActive(self.id > 1)
|
self.leftArrowBtn:setActive(self.idx > 1 and #self.list ~= 1)
|
||||||
self.rightArrowBtn:setActive(self.id < #self.list)
|
self.rightArrowBtn:setActive(self.idx < #self.list and #self.list ~= 1)
|
||||||
local attr, num = DataManager.TalentData:getAttrById(self.id)
|
local attr, num = DataManager.TalentData:getAttrById(self.id)
|
||||||
local str = I18N:getText("talent", self.id, "desc")
|
local str = I18N:getText("talent", self.id, "desc")
|
||||||
if attr and #attr > 0 then
|
if attr and #attr > 0 then
|
||||||
|
|||||||
@ -28,6 +28,19 @@ function TalentData:getCfgList()
|
|||||||
return TalentCfg
|
return TalentCfg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function TalentData:getActiveList()
|
||||||
|
local list = {}
|
||||||
|
for id = 1, #TalentCfg do
|
||||||
|
local cfg = TalentCfg[id]
|
||||||
|
cfg.id = id
|
||||||
|
local lv = self:getLevels(id)
|
||||||
|
if lv and lv > 0 then
|
||||||
|
table.insert(list, cfg)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return list
|
||||||
|
end
|
||||||
|
|
||||||
function TalentData:getPlayerExpCfgList(stage)
|
function TalentData:getPlayerExpCfgList(stage)
|
||||||
if stage then
|
if stage then
|
||||||
return PlayerExpCfg[stage]
|
return PlayerExpCfg[stage]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user