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, "GameObject/grid/bg/breakOpenSkill") self.upStarOpenSkill =Util.GetGameObject(self.transform, "GameObject/grid/bg/upStarOpenSkill") self.breakSkillTextPre =Util.GetGameObject(self.transform, "breakSkillTextPre") self.breakOpenSkillGrid =Util.GetGameObject(self.transform, "GameObject/grid/bg/breakOpenSkill/Mask") self.upStarSkillTextPre =Util.GetGameObject(self.transform, "upStarSkillTextPre") self.upStarOpenSkill =Util.GetGameObject(self.transform, "GameObject/grid/bg/upStarOpenSkill/Mask") self.grid =Util.GetGameObject(self.transform, "GameObject/grid"):GetComponent("RectTransform") self.gridVerticalL =Util.GetGameObject(self.transform, "GameObject/grid"):GetComponent("VerticalLayoutGroup") self.gridLayoutE =Util.GetGameObject(self.transform, "GameObject/grid"):GetComponent("LayoutElement") self.gridBg =Util.GetGameObject(self.transform, "GameObject/grid/bg"):GetComponent("RectTransform") 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) LogError("upstarid =="..upStarId) local openNum=0 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 openNum=openNum+1 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 openNum=openNum+1 breakSkillDataList[curBreakId] = {index = curBreakId,str =""..titleStr..GetLanguageStrById(passiveSkillConfig[OpenPassiveSkillRules[i][3]].Desc)..""} end end else--升星 local curUpStarId = OpenPassiveSkillRules[i][2] local titleStr = "" if curUpStarId>11 then --self.grid.sizeDelta=Vector2.New(969,1000) kongStr=" " if curUpStarId==25 then titleStr="飞升一阶激活:\n" elseif curUpStarId==26 then titleStr="飞升二阶激活:\n" elseif curUpStarId==27 then titleStr="飞升三阶激活:\n" end else titleStr = NumToSimplenessFont[heroRankupConfig[curUpStarId].Phase[2]] .. Language[11792] end local _passiveSkillId = passiveSkillConfig[OpenPassiveSkillRules[i][3]].Id LogError("upstarid=="..upStarId.." curupstarid=="..curUpStarId) 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 openNum=openNum+1 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 openNum=openNum+1 upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,index = curUpStarId,str =""..GetLanguageStrById(titleStr)..GetLanguageStrById(passiveSkillConfig[OpenPassiveSkillRules[i][3]].Desc)..""} end end end end if openNum>10 then self.gridVerticalL.enabled=false self.gridLayoutE.enabled=true self.gridBg.anchoredPosition=Vector2.New(380,840) else self.gridVerticalL.enabled=true self.gridLayoutE.enabled=false end end local breakSkillDataList2 = {} for i, v in pairs(breakSkillDataList) do table.insert(breakSkillDataList2,v) end table.sort(breakSkillDataList2, function(a,b) return a.index5 then kongStr = " " flyImg.gameObject:SetActive(true) else kongStr ="" flyImg.gameObject:SetActive(false) end -- Util.GetGameObject(go.transform, "Image"):SetActive(passiveSkillLogicConfig[upStarSkillDataList2[i].passiveSkillId].Judge == 1) -- Util.GetGameObject(go.transform, "Image"):SetActive(false) go:GetComponent("Text").text = kongStr .. upStarSkillDataList2[i].str end end --界面关闭时调用(用于子类重写) function RoleTalentPopup:OnClose() end --界面销毁时调用(用于子类重写) function RoleTalentPopup:OnDestroy() self.spLoader:Destroy() end return RoleTalentPopup