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

184 lines
8.6 KiB
Lua
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

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) .. "  <color=#66FF00>"..Desc.."</color>"}
else
breakSkillDataList[curBreakId] = {index = curBreakId,type = 1,str ="<color=#66FF00>"..titleStr..Desc.."</color>"}
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) .. "  <color=#66FF00>"..Desc.."</color>"}
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
return breakSkillDataList2
end
function this.GetNewTalentDataShow()
local breakSkillDataList = {}
local upStarSkillDataList = {}
if heroConfig.Awaken then
local Awaken=heroConfig.Awaken
Awaken=GetPassiveByMaxStar2(heroConfig,heroConfig.Awaken,11)
for i = 1, #Awaken do
local Desc = GetLanguageStrById(passiveSkillConfig[Awaken[i][3]].Desc)
if heroConfig.Awaken[i][1] == 1 then--突破
local titleStr = NumToSimplenessFont[heroRankupConfig[Awaken[i][2]].Phase[2]] .. Language[11795]
local curBreakId = Awaken[i][2]
if breakSkillDataList[curBreakId] then
breakSkillDataList[curBreakId] = {index = curBreakId,type = 1,str = GetLanguageStrById(breakSkillDataList[curBreakId].str) .. "  <color=#66FF00>"..Desc.."</color>"}
else
breakSkillDataList[curBreakId] = {index = curBreakId,type = 1,str ="<color=#66FF00>"..titleStr..Desc.."</color>"}
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) .. "  <color=#66FF00>"..Desc.."</color>"}
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
return breakSkillDataList2
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()
this.spLoader:Destroy()
end
return RoleAwakeTalentPopup