require("Base/BasePanel")
RoleTalentPopup = Inherit(BasePanel)
local heroConfig,breakId,upStarId
local breakSkillDataList = {}
local upStarSkillDataList = {}
local passiveSkillLogicConfig=ConfigManager.GetConfig(ConfigName.PassiveSkillLogicConfig)
local passiveSkillConfig=ConfigManager.GetConfig(ConfigName.PassiveSkillConfig)
local heroRankupConfig=ConfigManager.GetConfig(ConfigName.HeroRankupConfig)
--初始化组件(用于子类重写)
function RoleTalentPopup:InitComponent()
self.spLoader = SpriteLoader.New()
self.breakSkillGoList = {}
self.upStarSkillGoList = {}
self.BackMask = Util.GetGameObject(self.transform, "BackMask")
self.breakOpenSkill =Util.GetGameObject(self.transform, "bg/breakOpenSkill")
self.upStarOpenSkill =Util.GetGameObject(self.transform, "bg/upStarOpenSkill")
self.breakSkillTextPre =Util.GetGameObject(self.transform, "bg/breakSkillTextPre")
self.breakOpenSkillGrid =Util.GetGameObject(self.transform, "bg/breakOpenSkill/Mask")
self.upStarSkillTextPre =Util.GetGameObject(self.transform, "bg/upStarSkillTextPre")
self.upStarOpenSkill =Util.GetGameObject(self.transform, "bg/upStarOpenSkill/Mask")
end
--绑定事件(用于子类重写)
function RoleTalentPopup:BindEvent()
Util.AddClick(self.BackMask, function()
self:ClosePanel()
end)
end
--添加事件监听(用于子类重写)
function RoleTalentPopup:AddListener()
end
--移除事件监听(用于子类重写)
function RoleTalentPopup:RemoveListener()
end
--界面打开时调用(用于子类重写)
--传三个参数 是因为图鉴也要用
function RoleTalentPopup:OnOpen(_heroConfig,_breakId,_upStarId)
heroConfig = _heroConfig
breakId = _breakId
upStarId = _upStarId
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function RoleTalentPopup:OnShow()
self:GetTalentDataShow()
end
function RoleTalentPopup:GetTalentDataShow()
breakSkillDataList = {}
upStarSkillDataList = {}
local heroRankUpConfig = ConfigManager.GetConfig(ConfigName.HeroRankupConfig)
local OpenPassiveSkillRules = (upStarId and upStarId ~=0 and heroRankUpConfig[upStarId].OpenStar == HeroManager.awakeNextStarIndex) and heroConfig.Awaken or heroConfig.OpenPassiveSkillRules
if OpenPassiveSkillRules then
for i = 1, #OpenPassiveSkillRules do
if OpenPassiveSkillRules[i][1] == 1 then--突破
local titleStr = NumToSimplenessFont[heroRankupConfig[OpenPassiveSkillRules[i][2]].Phase[2]] .. Language[11795]
local curBreakId = OpenPassiveSkillRules[i][2]
if breakId >= curBreakId then
if breakSkillDataList[curBreakId] then
breakSkillDataList[curBreakId] = {index = curBreakId,str = breakSkillDataList[curBreakId].str .. " "..GetLanguageStrById(passiveSkillConfig[OpenPassiveSkillRules[i][3]].Desc)..""}
else
breakSkillDataList[curBreakId] = {index = curBreakId,str =""..titleStr..GetLanguageStrById(passiveSkillConfig[OpenPassiveSkillRules[i][3]].Desc)..""}
end
else
if breakSkillDataList[curBreakId] then
breakSkillDataList[curBreakId] = {index = curBreakId,str =breakSkillDataList[curBreakId].str .. " "..GetLanguageStrById(passiveSkillConfig[OpenPassiveSkillRules[i][3]].Desc)..""}
else
breakSkillDataList[curBreakId] = {index = curBreakId,str =""..titleStr..GetLanguageStrById(passiveSkillConfig[OpenPassiveSkillRules[i][3]].Desc)..""}
end
end
else--升星
local curUpStarId = OpenPassiveSkillRules[i][2]
local titleStr = NumToSimplenessFont[heroRankupConfig[curUpStarId].Phase[2]] .. Language[11792]
local _passiveSkillId = passiveSkillConfig[OpenPassiveSkillRules[i][3]].Id
if upStarId >= curUpStarId then
if upStarSkillDataList[curUpStarId] then
upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,index = curUpStarId,str = GetLanguageStrById(upStarSkillDataList[curUpStarId].str) .. " "..GetLanguageStrById(passiveSkillConfig[OpenPassiveSkillRules[i][3]].Desc)..""}
else
upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,index = curUpStarId,str =""..GetLanguageStrById(titleStr)..GetLanguageStrById(passiveSkillConfig[OpenPassiveSkillRules[i][3]].Desc)..""}
end
else
if upStarSkillDataList[curUpStarId] then
upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,index = curUpStarId,str =GetLanguageStrById(upStarSkillDataList[curUpStarId].str) .. " "..GetLanguageStrById(passiveSkillConfig[OpenPassiveSkillRules[i][3]].Desc)..""}
else
upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,index = curUpStarId,str =""..GetLanguageStrById(titleStr)..GetLanguageStrById(passiveSkillConfig[OpenPassiveSkillRules[i][3]].Desc)..""}
end
end
end
end
end
local breakSkillDataList2 = {}
for i, v in pairs(breakSkillDataList) do
table.insert(breakSkillDataList2,v)
end
table.sort(breakSkillDataList2, function(a,b) return a.index