miduo_client/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleTalentPopup.lua

215 lines
11 KiB
Lua
Raw Normal View History

2021-04-21 13:12:04 +08:00
require("Base/BasePanel")
2020-05-09 13:31:21 +08:00
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()
2023-09-18 15:41:32 +08:00
-- self.canvas.overrideSorting = true
-- self.canvas.sortingOrder = self.sortingOrder
2021-04-21 13:12:04 +08:00
self.spLoader = SpriteLoader.New()
2020-05-09 13:31:21 +08:00
self.breakSkillGoList = {}
self.upStarSkillGoList = {}
self.BackMask = Util.GetGameObject(self.transform, "BackMask")
2023-09-18 15:41:32 +08:00
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")
2021-10-14 17:14:51 +08:00
self.breakSkillTextPre =Util.GetGameObject(self.transform, "breakSkillTextPre")
self.breakOpenSkillGrid =Util.GetGameObject(self.transform, "GameObject/grid/bg/breakOpenSkill/Mask")
2021-10-14 17:14:51 +08:00
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")
2024-01-12 15:48:14 +08:00
self.title=Util.GetGameObject(self.transform, "GameObject/equipInfo/name/text"):GetComponent("Text")
self.title.text="英雄天赋"
2020-05-09 13:31:21 +08:00
end
--绑定事件(用于子类重写)
function RoleTalentPopup:BindEvent()
Util.AddClick(self.BackMask, function()
self:ClosePanel()
end)
end
--添加事件监听(用于子类重写)
function RoleTalentPopup:AddListener()
end
--移除事件监听(用于子类重写)
function RoleTalentPopup:RemoveListener()
end
2023-09-18 15:41:32 +08:00
function RoleTalentPopup:OnSortingOrderChange()
RoleTalentPopup.sortingOrder = self.sortingOrder
2020-05-09 13:31:21 +08:00
2023-09-18 15:41:32 +08:00
end
2020-05-09 13:31:21 +08:00
--界面打开时调用(用于子类重写)
--传三个参数 是因为图鉴也要用
function RoleTalentPopup:OnOpen(_heroConfig,_breakId,_upStarId)
heroConfig = _heroConfig
breakId = _breakId
upStarId = _upStarId
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function RoleTalentPopup:OnShow()
self:GetTalentDataShow()
end
function RoleTalentPopup:GetTalentDataShow()
breakSkillDataList = {}
upStarSkillDataList = {}
2020-11-10 18:35:37 +08:00
local heroRankUpConfig = ConfigManager.GetConfig(ConfigName.HeroRankupConfig)
LogError("upstarid =="..upStarId)
local openNum=0
2021-12-28 16:20:07 +08:00
local OpenPassiveSkillRules = (upStarId and upStarId ~=0 and heroRankUpConfig[upStarId].OpenStar >= HeroManager.awakeNextStarIndex) and heroConfig.Awaken or heroConfig.OpenPassiveSkillRules
OpenPassiveSkillRules=GetPassiveByMaxStar(heroConfig,OpenPassiveSkillRules)
2020-11-10 18:35:37 +08:00
if OpenPassiveSkillRules then
for i = 1, #OpenPassiveSkillRules do
if OpenPassiveSkillRules[i][1] == 1 then--突破
2021-03-02 16:53:12 +08:00
local titleStr = NumToSimplenessFont[heroRankupConfig[OpenPassiveSkillRules[i][2]].Phase[2]] .. Language[11795]
2020-11-10 18:35:37 +08:00
local curBreakId = OpenPassiveSkillRules[i][2]
2020-05-09 13:31:21 +08:00
if breakId >= curBreakId then
if breakSkillDataList[curBreakId] then
2023-08-11 19:03:48 +08:00
breakSkillDataList[curBreakId] = {index = curBreakId,str = breakSkillDataList[curBreakId].str .. "  <color=#03FE93>"..GetLanguageStrById(passiveSkillConfig[OpenPassiveSkillRules[i][3]].Desc).."</color>"}
2020-05-09 13:31:21 +08:00
else
openNum=openNum+1
2023-08-11 19:03:48 +08:00
breakSkillDataList[curBreakId] = {index = curBreakId,str ="<color=#F78A5B>"..titleStr.."</color>"..GetLanguageStrById(passiveSkillConfig[OpenPassiveSkillRules[i][3]].Desc)}
2020-05-09 13:31:21 +08:00
end
else
if breakSkillDataList[curBreakId] then
2023-08-11 19:03:48 +08:00
breakSkillDataList[curBreakId] = {index = curBreakId,str =breakSkillDataList[curBreakId].str .. " <color=#03FE93>"..GetLanguageStrById(passiveSkillConfig[OpenPassiveSkillRules[i][3]].Desc).."</color>"}
2020-05-09 13:31:21 +08:00
else
openNum=openNum+1
2023-08-11 19:03:48 +08:00
breakSkillDataList[curBreakId] = {index = curBreakId,str ="<color=#03FE93>"..titleStr..GetLanguageStrById(passiveSkillConfig[OpenPassiveSkillRules[i][3]].Desc).."</color>"}
2020-05-09 13:31:21 +08:00
end
end
else--升星
2021-01-26 17:08:39 +08:00
2020-11-10 18:35:37 +08:00
local curUpStarId = OpenPassiveSkillRules[i][2]
local titleStr = ""
if curUpStarId>11 then
--self.grid.sizeDelta=Vector2.New(969,1000)
2021-12-31 13:50:49 +08:00
kongStr=" "
2021-12-28 16:20:07 +08:00
if curUpStarId==25 then
titleStr="飞升一阶激活:\n"
2021-12-28 16:20:07 +08:00
elseif curUpStarId==26 then
titleStr="飞升二阶激活:\n"
2021-12-28 16:20:07 +08:00
elseif curUpStarId==27 then
titleStr="飞升三阶激活:\n"
2022-11-02 15:47:17 +08:00
elseif curUpStarId==28 then
titleStr="飞升四阶激活:\n"
elseif curUpStarId==29 then
titleStr="飞升五阶激活:\n"
end
else
titleStr = NumToSimplenessFont[heroRankupConfig[curUpStarId].Phase[2]] .. Language[11792]
end
2020-11-10 18:35:37 +08:00
local _passiveSkillId = passiveSkillConfig[OpenPassiveSkillRules[i][3]].Id
LogError("upstarid=="..upStarId.." curupstarid=="..curUpStarId)
if upStarId >= curUpStarId then
if upStarSkillDataList[curUpStarId] then
2023-10-27 20:48:34 +08:00
upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,index = curUpStarId,str = "<color=#F78A5B>".. GetLanguageStrById(upStarSkillDataList[curUpStarId].str) .."</color>"..GetLanguageStrById(passiveSkillConfig[OpenPassiveSkillRules[i][3]].Desc),isHide=true}
else
openNum=openNum+1
2023-10-27 20:48:34 +08:00
upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,index = curUpStarId,str ="<color=#F78A5B>"..GetLanguageStrById(titleStr).."</color>"..GetLanguageStrById(passiveSkillConfig[OpenPassiveSkillRules[i][3]].Desc),isHide=true}
end
2020-05-09 13:31:21 +08:00
else
if upStarSkillDataList[curUpStarId] then
2023-10-27 20:48:34 +08:00
upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,index = curUpStarId,str =GetLanguageStrById(upStarSkillDataList[curUpStarId].str) .. "<color=#B9AC97>"..GetLanguageStrById(passiveSkillConfig[OpenPassiveSkillRules[i][3]].Desc).."</color>",isHide=false}
else
openNum=openNum+1
2023-10-27 20:48:34 +08:00
upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,index = curUpStarId,str ="<color=#6a4444>"..GetLanguageStrById(titleStr).."</color>".."<color=#FFFFFF>"..GetLanguageStrById(passiveSkillConfig[OpenPassiveSkillRules[i][3]].Desc).."</color>",isHide=false}
end
2020-05-09 13:31:21 +08:00
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
2020-05-09 13:31:21 +08:00
end
local breakSkillDataList2 = {}
for i, v in pairs(breakSkillDataList) do
table.insert(breakSkillDataList2,v)
end
table.sort(breakSkillDataList2, function(a,b) return a.index<b.index end)
for i = 1, math.max(#breakSkillDataList2, #self.breakSkillGoList) do
local go = self.breakSkillGoList[i]
if not go then
go = newObject(self.breakSkillTextPre)
go.transform:SetParent(self.breakOpenSkillGrid.transform)
go.transform.localScale = Vector3.one
go.transform.localPosition = Vector3.zero
self.breakSkillGoList[i] = go
end
go.gameObject:SetActive(false)
end
for i = 1, #breakSkillDataList2 do
local go = self.breakSkillGoList[i]
go.gameObject:SetActive(true)
go:GetComponent("Text").text = breakSkillDataList2[i].str
end
local upStarSkillDataList2 = {}
for i, v in pairs(upStarSkillDataList) do
table.insert(upStarSkillDataList2,v)
end
table.sort(upStarSkillDataList2, function(a,b) return a.index<b.index end)
for i = 1, math.max(#upStarSkillDataList2, #self.upStarSkillGoList) do
2020-05-09 13:31:21 +08:00
local go = self.upStarSkillGoList[i]
if not go then
go = newObject(self.upStarSkillTextPre)
go.transform:SetParent(self.upStarOpenSkill.transform)
go.transform.localScale = Vector3.one
go.transform.localPosition = Vector3.zero
self.upStarSkillGoList[i] = go
end
go.gameObject:SetActive(false)
end
2021-12-31 13:50:49 +08:00
LogError("lem=="..#upStarSkillDataList2)
for i = 1, #upStarSkillDataList2 do
2020-05-09 13:31:21 +08:00
local go = self.upStarSkillGoList[i]
go.gameObject:SetActive(true)
2021-12-31 13:50:49 +08:00
local flyImg= Util.GetGameObject(go, "flyImg")
2023-10-27 20:48:34 +08:00
local mask= Util.GetGameObject(go, "mask")
2020-05-09 13:31:21 +08:00
local kongStr = ""
if passiveSkillLogicConfig[upStarSkillDataList2[i].passiveSkillId].Judge == 1 then
2021-03-02 16:53:12 +08:00
kongStr = Language[11835]
2021-12-31 13:50:49 +08:00
end
if i>5 then
2023-09-01 18:27:39 +08:00
kongStr = " "
2021-12-31 13:50:49 +08:00
flyImg.gameObject:SetActive(true)
2020-05-09 13:31:21 +08:00
else
2021-12-31 13:50:49 +08:00
kongStr =""
flyImg.gameObject:SetActive(false)
2020-05-09 13:31:21 +08:00
end
2023-10-27 20:48:34 +08:00
-- mask:SetActive(not upStarSkillDataList2[i].isHide)
2021-01-26 17:08:39 +08:00
-- 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
2023-10-27 20:48:34 +08:00
--Util.GetGameObject(go,"mask/upText"):GetComponent("Text").text = kongStr .. upStarSkillDataList2[i].str
2020-05-09 13:31:21 +08:00
end
end
--界面关闭时调用(用于子类重写)
function RoleTalentPopup:OnClose()
end
--界面销毁时调用(用于子类重写)
function RoleTalentPopup:OnDestroy()
2021-04-21 13:12:04 +08:00
self.spLoader:Destroy()
2020-05-09 13:31:21 +08:00
end
return RoleTalentPopup