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

184 lines
8.6 KiB
Lua
Raw Normal View History

2021-04-21 13:12:04 +08:00
require("Base/BasePanel")
2020-11-06 16:23:02 +08:00
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()
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
2021-03-02 16:53:12 +08:00
Util.GetGameObject(self.transform, "bg1/name/text"):GetComponent("Text").text = Language[11793]
Util.GetGameObject(self.transform, "bg2/name/text"):GetComponent("Text").text = Language[11794]
2020-11-06 16:23:02 +08:00
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)
2020-11-06 16:23:02 +08:00
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)
2020-11-06 16:23:02 +08:00
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
2021-03-05 14:00:45 +08:00
local Desc = GetLanguageStrById(passiveSkillConfig[heroConfig.OpenPassiveSkillRules[i][3]].Desc)
2020-11-06 16:23:02 +08:00
if heroConfig.OpenPassiveSkillRules[i][1] == 1 then--突破
2021-03-02 16:53:12 +08:00
local titleStr = NumToSimplenessFont[heroRankupConfig[heroConfig.OpenPassiveSkillRules[i][2]].Phase[2]] .. Language[11795]
2020-11-06 16:23:02 +08:00
local curBreakId = heroConfig.OpenPassiveSkillRules[i][2]
if breakSkillDataList[curBreakId] then
2021-03-05 14:00:45 +08:00
breakSkillDataList[curBreakId] = {index = curBreakId,type = 1,str = GetLanguageStrById(breakSkillDataList[curBreakId].str) .. "  <color=#66FF00>"..Desc.."</color>"}
2020-11-06 16:23:02 +08:00
else
breakSkillDataList[curBreakId] = {index = curBreakId,type = 1,str ="<color=#66FF00>"..titleStr..Desc.."</color>"}
end
else--升星
local curUpStarId = heroConfig.OpenPassiveSkillRules[i][2]
2021-03-02 16:53:12 +08:00
local titleStr = NumToSimplenessFont[heroRankupConfig[curUpStarId].Phase[2]] .. Language[11792]
2020-11-06 16:23:02 +08:00
local _passiveSkillId = passiveSkillConfig[heroConfig.OpenPassiveSkillRules[i][3]].Id
if upStarSkillDataList[curUpStarId] then
2021-03-05 14:00:45 +08:00
upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,type = 2,index = curUpStarId,str = GetLanguageStrById(upStarSkillDataList[curUpStarId].str) .. "  <color=#66FF00>"..Desc.."</color>"}
2020-11-06 16:23:02 +08:00
else
upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,type = 2,index = curUpStarId,str ="<color=#66FF00>"..titleStr..Desc.."</color>"}
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<b.index 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, #upStarSkillDataList2 do
table.insert(breakSkillDataList2,upStarSkillDataList2[i])
end
2020-11-07 15:15:49 +08:00
return breakSkillDataList2
2020-11-06 16:23:02 +08:00
end
function this.GetNewTalentDataShow()
local breakSkillDataList = {}
local upStarSkillDataList = {}
if heroConfig.Awaken then
local Awaken=heroConfig.Awaken
2022-02-21 14:25:52 +08:00
Awaken=GetPassiveByMaxStar2(heroConfig,heroConfig.Awaken,11)
for i = 1, #Awaken do
local Desc = GetLanguageStrById(passiveSkillConfig[Awaken[i][3]].Desc)
2020-11-06 16:23:02 +08:00
if heroConfig.Awaken[i][1] == 1 then--突破
local titleStr = NumToSimplenessFont[heroRankupConfig[Awaken[i][2]].Phase[2]] .. Language[11795]
local curBreakId = Awaken[i][2]
2020-11-06 16:23:02 +08:00
if breakSkillDataList[curBreakId] then
2021-03-05 14:00:45 +08:00
breakSkillDataList[curBreakId] = {index = curBreakId,type = 1,str = GetLanguageStrById(breakSkillDataList[curBreakId].str) .. "  <color=#66FF00>"..Desc.."</color>"}
2020-11-06 16:23:02 +08:00
else
breakSkillDataList[curBreakId] = {index = curBreakId,type = 1,str ="<color=#66FF00>"..titleStr..Desc.."</color>"}
end
else--升星
local curUpStarId = Awaken[i][2]
2021-03-02 16:53:12 +08:00
local titleStr = NumToSimplenessFont[heroRankupConfig[curUpStarId].Phase[2]] .. Language[11792]
local _passiveSkillId = passiveSkillConfig[Awaken[i][3]].Id
2020-11-06 16:23:02 +08:00
if upStarSkillDataList[curUpStarId] then
2021-03-05 14:00:45 +08:00
upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,type = 2,index = curUpStarId,str = GetLanguageStrById(upStarSkillDataList[curUpStarId].str) .. "  <color=#66FF00>"..Desc.."</color>"}
2020-11-06 16:23:02 +08:00
else
upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,type = 2,index = curUpStarId,str ="<color=#66FF00>"..titleStr..Desc.."</color>"}
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<b.index 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, #upStarSkillDataList2 do
table.insert(breakSkillDataList2,upStarSkillDataList2[i])
end
2020-11-07 15:15:49 +08:00
return breakSkillDataList2
2020-11-06 16:23:02 +08:00
end
function this.SingOldTalentDataShow(go,data)
local breakGo = Util.GetGameObject(go, "breakSkillTextPre")
local upStarGo = Util.GetGameObject(go, "upStarSkillTextPre")
if data.type == 1 then--突破
breakGo:SetActive(true)
upStarGo:SetActive(false)
breakGo:GetComponent("Text").text = data.str
else
breakGo:SetActive(false)
upStarGo:SetActive(true)
local kongStr = ""
if passiveSkillLogicConfig[data.passiveSkillId].Judge == 1 then
kongStr = "   "
else
kongStr = ""
end
Util.GetGameObject(upStarGo.transform, "Image"):SetActive(passiveSkillLogicConfig[data.passiveSkillId].Judge == 1)
upStarGo:GetComponent("Text").text = kongStr .. data.str
end
end
function this.SingNewTalentDataShow(go,data)
-- go:GetComponent("Text").text = breakSkillDataList2[i].str
-- local kongStr = ""
-- if passiveSkillLogicConfig[upStarSkillDataList2[i].passiveSkillId].Judge == 1 then
-- kongStr = "   "
-- else
-- kongStr = ""
-- end
-- Util.GetGameObject(go.transform, "Image"):SetActive(passiveSkillLogicConfig[upStarSkillDataList2[i].passiveSkillId].Judge == 1)
-- go:GetComponent("Text").text = kongStr .. upStarSkillDataList2[i].str
end
--界面关闭时调用(用于子类重写)
function RoleAwakeTalentPopup:OnClose()
end
--界面销毁时调用(用于子类重写)
function RoleAwakeTalentPopup:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2020-11-06 16:23:02 +08:00
end
return RoleAwakeTalentPopup