2025-03-14 11:58:20 +08:00
|
|
|
----- 进阶成功面板 -----
|
2020-05-09 13:31:21 +08:00
|
|
|
require("Base/BasePanel")
|
|
|
|
|
TalismanUpStarSuccessPanel = Inherit(BasePanel)
|
2024-09-06 10:38:56 +08:00
|
|
|
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
|
|
|
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
|
|
|
|
local passiveSkillConfig = ConfigManager.GetConfig(ConfigName.PassiveSkillConfig)
|
|
|
|
|
local curHeroData = {} --当前英雄数据
|
|
|
|
|
local curTalismanData = {} --当前法宝数据
|
|
|
|
|
local maxLv = 0 --法宝最大进阶等级
|
|
|
|
|
local curLv = 0 --当前法宝等级
|
|
|
|
|
local isMaxStar = false --默认不是最大进阶等级
|
2020-05-09 13:31:21 +08:00
|
|
|
local callBack1
|
|
|
|
|
local callBack2
|
|
|
|
|
--属性容器
|
|
|
|
|
local proList = {}
|
|
|
|
|
local orginLayer = 20
|
|
|
|
|
|
|
|
|
|
function TalismanUpStarSuccessPanel:InitComponent()
|
2021-04-21 13:12:04 +08:00
|
|
|
self.spLoader = SpriteLoader.New()
|
2020-05-09 13:31:21 +08:00
|
|
|
orginLayer = 20
|
|
|
|
|
self.BtnBack = Util.GetGameObject(self.transform, "backBtn")
|
|
|
|
|
self.mask = Util.GetGameObject(self.transform, "mask")
|
|
|
|
|
self.icon = Util.GetGameObject(self.transform, "icon"):GetComponent("Image")
|
|
|
|
|
|
|
|
|
|
self.heroName = Util.GetGameObject(self.transform, "heroInfo/nameAndPossLayout/heroName"):GetComponent("Text")
|
2024-09-06 10:38:56 +08:00
|
|
|
self.UI_Effect_chouka = Util.GetGameObject(self.transform, "UI_Effect_chouka")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
--基础属性
|
2024-09-06 10:38:56 +08:00
|
|
|
self.basics = Util.GetGameObject(self.gameObject, "Info/Panel/Basics")
|
|
|
|
|
self.proRoot = Util.GetGameObject(self.basics, "Root")
|
|
|
|
|
self.proPre = Util.GetGameObject(self.basics, "Root/Pre")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
--特性提升
|
2024-09-06 10:38:56 +08:00
|
|
|
self.speciality = Util.GetGameObject(self.gameObject, "Info/Panel/Speciality")
|
|
|
|
|
self.specialityText = Util.GetGameObject(self.speciality, "Scroll/Text"):GetComponent("Text")
|
2020-05-09 13:31:21 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function TalismanUpStarSuccessPanel:BindEvent()
|
|
|
|
|
Util.AddClick(self.BtnBack, function()
|
|
|
|
|
--未达顶级 返回进阶
|
|
|
|
|
if callBack1 and not isMaxStar then
|
|
|
|
|
callBack1()
|
|
|
|
|
end
|
|
|
|
|
--已达顶级 返回法宝详情
|
|
|
|
|
if callBack2 and isMaxStar then
|
|
|
|
|
callBack2()
|
|
|
|
|
end
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function TalismanUpStarSuccessPanel:AddListener()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function TalismanUpStarSuccessPanel:RemoveListener()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function TalismanUpStarSuccessPanel:OnOpen(...)
|
2024-09-06 10:38:56 +08:00
|
|
|
local args = { ... }
|
|
|
|
|
curHeroData = args[1]
|
|
|
|
|
callBack1 = args[2]
|
|
|
|
|
callBack2 = args[3]
|
2020-05-09 13:31:21 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function TalismanUpStarSuccessPanel:OnShow()
|
|
|
|
|
self:ShowProAndSkillData()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function TalismanUpStarSuccessPanel:OnSortingOrderChange()
|
|
|
|
|
Util.AddParticleSortLayer(self.UI_Effect_chouka, self.sortingOrder - orginLayer)
|
|
|
|
|
self.mask:GetComponent("Canvas").overrideSorting = true
|
|
|
|
|
self.mask:GetComponent("Canvas").sortingOrder = self.sortingOrder - 30
|
|
|
|
|
orginLayer = self.sortingOrder
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function TalismanUpStarSuccessPanel:ShowProAndSkillData()
|
|
|
|
|
self.speciality:SetActive(false)
|
2024-09-06 10:38:56 +08:00
|
|
|
local data = {} --英雄表下法宝属性
|
|
|
|
|
data = ConfigManager.GetConfigData(ConfigName.HeroConfig, curHeroData.id)
|
|
|
|
|
.EquipTalismana --当前法宝数据 data[1]星级 data[2]法宝ID
|
2020-05-09 13:31:21 +08:00
|
|
|
--获取法宝最大等级
|
|
|
|
|
TalismanManager.GetStartAndEndStar()
|
2024-09-06 10:38:56 +08:00
|
|
|
maxLv = TalismanManager.AllTalismanEndStar[data[2]]
|
2020-05-09 13:31:21 +08:00
|
|
|
--获取当前法宝等级(-1的作用是当打开进阶成功时 英雄已经升级了 应该-1与进阶前保持一致)
|
2024-09-06 10:38:56 +08:00
|
|
|
curLv = HeroManager.GetTalismanLv(curHeroData.dynamicId) - 1
|
|
|
|
|
if curLv < 1 then curLv = 1 end
|
2020-05-09 13:31:21 +08:00
|
|
|
--获取当前等级与下一等级表数据
|
2024-09-06 10:38:56 +08:00
|
|
|
local nextLv = 0
|
|
|
|
|
if curLv <= maxLv then nextLv = curLv + 1 end
|
|
|
|
|
isMaxStar = (curLv + 1) >= maxLv
|
|
|
|
|
curTalismanData = ConfigManager.GetConfigDataByDoubleKey(ConfigName.EquipTalismana, "TalismanaId", data[2], "Level",
|
|
|
|
|
curLv)
|
|
|
|
|
local nextTalismanConFig = {}
|
2020-05-09 13:31:21 +08:00
|
|
|
if not isMaxStar then
|
2024-09-06 10:38:56 +08:00
|
|
|
nextTalismanConFig = ConfigManager.GetConfigDataByDoubleKey(ConfigName.EquipTalismana, "TalismanaId", data[2],
|
|
|
|
|
"Level", nextLv)
|
2020-05-09 13:31:21 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--法宝图面 名称 等级
|
2021-04-21 13:12:04 +08:00
|
|
|
self.icon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfig[data[2]].ResourceID))
|
2024-09-06 10:38:56 +08:00
|
|
|
self.heroName.text = string.format("%s +%s", GetLanguageStrById(itemConfig[data[2]].Name), curHeroData.talismanList)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
--显示基础属性
|
2024-09-06 10:38:56 +08:00
|
|
|
for i = 1, #curTalismanData.Property do
|
|
|
|
|
local item = proList[i]
|
2020-05-09 13:31:21 +08:00
|
|
|
if not item then
|
2024-09-06 10:38:56 +08:00
|
|
|
item = newObjToParent(self.proPre, self.proRoot)
|
|
|
|
|
item.name = "ProPre" .. i
|
|
|
|
|
proList[i] = item
|
2020-05-09 13:31:21 +08:00
|
|
|
end
|
2024-09-06 10:38:56 +08:00
|
|
|
local curName = Util.GetGameObject(proList[i], "CurName"):GetComponent("Text")
|
|
|
|
|
local curValue = Util.GetGameObject(proList[i], "CurValue"):GetComponent("Text")
|
|
|
|
|
local nextName = Util.GetGameObject(proList[i], "NextName"):GetComponent("Text")
|
|
|
|
|
local nextValue = Util.GetGameObject(proList[i], "NextValue"):GetComponent("Text")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
2024-09-06 10:38:56 +08:00
|
|
|
curName.text = GetLanguageStrById(propertyConfig[curTalismanData.Property[i][1]].Info)
|
|
|
|
|
curValue.text = curTalismanData.Property[i][2]
|
2020-05-09 13:31:21 +08:00
|
|
|
if not isMaxStar then
|
2024-09-06 10:38:56 +08:00
|
|
|
nextName.text = "" --GetLanguageStrById(propertyConfig[nextTalismanConFig.Property[i][1]].Info)
|
|
|
|
|
nextValue.text = nextTalismanConFig.Property[i][2]
|
2020-05-09 13:31:21 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--显示法宝天赋
|
|
|
|
|
--筛选出符合要求的数据
|
2024-09-06 10:38:56 +08:00
|
|
|
local dowerAllData = {} --当前法宝全部天赋数据(天赋可能为空)
|
|
|
|
|
dowerAllData = ConfigManager.GetAllConfigsDataByKey(ConfigName.EquipTalismana, "TalismanaId", data[2])
|
|
|
|
|
local dowerData = {} --当前法宝全部技能数据(天赋不为空)
|
|
|
|
|
for i = 1, #dowerAllData do
|
2020-05-09 13:31:21 +08:00
|
|
|
if dowerAllData[i].OpenSkillRules then
|
2024-09-06 10:38:56 +08:00
|
|
|
table.insert(dowerData, dowerAllData[i])
|
2020-05-09 13:31:21 +08:00
|
|
|
end
|
|
|
|
|
end
|
2024-09-06 10:38:56 +08:00
|
|
|
table.sort(dowerData, function(a, b) return a.OpenSkillRules[1] < b.OpenSkillRules[1] end)
|
2020-05-09 13:31:21 +08:00
|
|
|
--赋值到表现
|
2024-09-06 10:38:56 +08:00
|
|
|
local strTable = {}
|
|
|
|
|
for n = 1, #dowerData do
|
|
|
|
|
if (curLv + 1) == dowerData[n].Level then
|
2020-05-09 13:31:21 +08:00
|
|
|
self.speciality:SetActive(true)
|
2024-09-06 10:38:56 +08:00
|
|
|
self.specialityText.text = GetLanguageStrById(passiveSkillConfig[dowerData[n].OpenSkillRules[1]].Desc)
|
2021-11-08 13:39:29 +08:00
|
|
|
self.specialityText.transform.localPosition = Vector3.New(0, -100, 0)
|
2020-05-09 13:31:21 +08:00
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function TalismanUpStarSuccessPanel:OnClose()
|
|
|
|
|
callBack = nil
|
|
|
|
|
self.speciality:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function TalismanUpStarSuccessPanel:OnDestroy()
|
2021-04-21 13:12:04 +08:00
|
|
|
self.spLoader:Destroy()
|
2024-09-06 10:38:56 +08:00
|
|
|
proList = {}
|
2020-05-09 13:31:21 +08:00
|
|
|
end
|
|
|
|
|
|
2024-09-06 10:38:56 +08:00
|
|
|
return TalismanUpStarSuccessPanel
|