require("Base/BasePanel")
RoleAwakeTalentPopup = Inherit(BasePanel)
local this = RoleAwakeTalentPopup
local heroConfig
local passiveSkillLogicConfig=ConfigManager.GetConfig(ConfigName.PassiveSkillLogicConfig)
local passiveSkillConfig=ConfigManager.GetConfig(ConfigName.PassiveSkillConfig)
local heroRankupConfig=ConfigManager.GetConfig(ConfigName.HeroRankupConfig)
--初始化组件(用于子类重写)
function RoleAwakeTalentPopup:InitComponent()
this.spLoader = SpriteLoader.New()
Util.GetGameObject(self.transform, "bg1/name/text"):GetComponent("Text").text = Language[11793]
Util.GetGameObject(self.transform, "bg2/name/text"):GetComponent("Text").text = Language[11794]
self.BackMask = Util.GetGameObject(self.transform, "BackMask")
this.prefab = Util.GetGameObject(self.gameObject, "pre")
this.ScrollParentView1 = Util.GetGameObject(self.gameObject, "bg1/ScrollFitter")
this.ScrollView1 = SubUIManager.Open(SubUIConfig.ScrollFitterView, this.ScrollParentView1.transform,
this.prefab, Vector2.New(417.8, 552.7), 1, 1)
this.ScrollParentView2 = Util.GetGameObject(self.gameObject, "bg2/ScrollFitter")
this.ScrollView2 = SubUIManager.Open(SubUIConfig.ScrollFitterView, this.ScrollParentView2.transform,
this.prefab, Vector2.New(417.8, 552.7), 1, 1)
end
--绑定事件(用于子类重写)
function RoleAwakeTalentPopup:BindEvent()
Util.AddClick(self.BackMask, function()
self:ClosePanel()
end)
end
--添加事件监听(用于子类重写)
function RoleAwakeTalentPopup:AddListener()
end
--移除事件监听(用于子类重写)
function RoleAwakeTalentPopup:RemoveListener()
end
--界面打开时调用(用于子类重写)
--传三个参数 是因为图鉴也要用
function RoleAwakeTalentPopup:OnOpen(_heroConfig)
heroConfig = _heroConfig
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function RoleAwakeTalentPopup:OnShow()
local OldTalentData = this.GetOldTalentDataShow()
local newTalentData = this.GetNewTalentDataShow()
this.ScrollView1:SetData(OldTalentData, function(index, go)
this.SingOldTalentDataShow(go, OldTalentData[index])
end)
this.ScrollView2:SetData(newTalentData, function(index, go)
this.SingOldTalentDataShow(go, newTalentData[index])
end)
end
function this.GetOldTalentDataShow()
local breakSkillDataList = {}
local upStarSkillDataList = {}
if heroConfig.OpenPassiveSkillRules then
for i = 1, #heroConfig.OpenPassiveSkillRules do
local Desc = GetLanguageStrById(passiveSkillConfig[heroConfig.OpenPassiveSkillRules[i][3]].Desc)
if heroConfig.OpenPassiveSkillRules[i][1] == 1 then--突破
local titleStr = NumToSimplenessFont[heroRankupConfig[heroConfig.OpenPassiveSkillRules[i][2]].Phase[2]] .. Language[11795]
local curBreakId = heroConfig.OpenPassiveSkillRules[i][2]
if breakSkillDataList[curBreakId] then
breakSkillDataList[curBreakId] = {index = curBreakId,type = 1,str = GetLanguageStrById(breakSkillDataList[curBreakId].str) .. " "..Desc..""}
else
breakSkillDataList[curBreakId] = {index = curBreakId,type = 1,str =""..titleStr..Desc..""}
end
else--升星
local curUpStarId = heroConfig.OpenPassiveSkillRules[i][2]
local titleStr = NumToSimplenessFont[heroRankupConfig[curUpStarId].Phase[2]] .. Language[11792]
local _passiveSkillId = passiveSkillConfig[heroConfig.OpenPassiveSkillRules[i][3]].Id
if upStarSkillDataList[curUpStarId] then
upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,type = 2,index = curUpStarId,str = GetLanguageStrById(upStarSkillDataList[curUpStarId].str) .. " "..Desc..""}
else
upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,type = 2,index = curUpStarId,str =""..titleStr..Desc..""}
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"..Desc..""}
else
breakSkillDataList[curBreakId] = {index = curBreakId,type = 1,str =""..titleStr..Desc..""}
end
else--升星
local curUpStarId = Awaken[i][2]
local titleStr = NumToSimplenessFont[heroRankupConfig[curUpStarId].Phase[2]] .. Language[11792]
local _passiveSkillId = passiveSkillConfig[Awaken[i][3]].Id
if upStarSkillDataList[curUpStarId] then
upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,type = 2,index = curUpStarId,str = GetLanguageStrById(upStarSkillDataList[curUpStarId].str) .. " "..Desc..""}
else
upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,type = 2,index = curUpStarId,str =""..titleStr..Desc..""}
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