miduo_client/Assets/ManagedResources/~Lua/Modules/Incarnation/IncarnationUpHelpPopup.lua

114 lines
3.5 KiB
Lua
Raw Normal View History

2022-04-24 22:13:28 +08:00
require("Base/BasePanel")
IncarnationUpHelpPopup = Inherit(BasePanel)
2024-09-06 10:38:56 +08:00
local this = IncarnationUpHelpPopup
2022-04-24 22:13:28 +08:00
local PropertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
function this:InitComponent()
2024-09-06 10:38:56 +08:00
this.btnBack = Util.GetGameObject(self.gameObject, "BackMask")
2022-04-24 22:13:28 +08:00
this.back = Util.GetGameObject(self.gameObject, "BG/BackBtn")
2024-09-06 10:38:56 +08:00
this.itemList = {}
for i = 1, 5 do
local item = Util.GetGameObject(self.gameObject, "scroll/grid/item" .. i)
table.insert(this.itemList, item)
2022-11-02 17:20:28 +08:00
end
2022-04-24 22:13:28 +08:00
end
function this:BindEvent()
Util.AddClick(this.btnBack, function()
self:ClosePanel()
end)
Util.AddClick(this.back, function()
self:ClosePanel()
end)
end
--添加事件监听(用于子类重写)
function this:AddListener()
end
--移除事件监听(用于子类重写)
function this:RemoveListener()
end
function this:OnSortingOrderChange()
2024-09-06 10:38:56 +08:00
2022-04-24 22:13:28 +08:00
end
function this:OnOpen(_cardId)
2022-11-02 17:20:28 +08:00
for i = 1, #this.itemList do
2024-09-06 10:38:56 +08:00
this.UpdateItemInfo(this.itemList[i], _cardId, i)
2022-11-02 17:20:28 +08:00
end
end
2024-09-06 10:38:56 +08:00
function this.UpdateItemInfo(go, _cardId, star)
local maxLevel = Util.GetGameObject(go, "maxLevel"):GetComponent("Text")
local propGrid = Util.GetGameObject(go, "propLayout/grid")
local skillDes = Util.GetGameObject(go, "skillDes"):GetComponent("Text")
local starList = {}
for i = 1, 5 do
local starObj = Util.GetGameObject(go, "maxStar/Image" .. i)
if i <= star then
2022-11-02 17:20:28 +08:00
starObj:SetActive(true)
else
starObj:SetActive(false)
end
--table.insert(starList,star)
end
2024-09-06 10:38:56 +08:00
local cardData = IncarnationManager.itemDataList[_cardId]
local cardConfig = ConfigManager.GetConfigData(ConfigName.ChangingCard, _cardId)
local starConfig = ConfigManager.GetConfigDataByDoubleKey(ConfigName.ChangingCardStar, "PoolId", cardConfig.Star,
"Level", star)
local maxStarProp = starConfig.Exp
local levelConfig = ConfigManager.GetConfigDataByDoubleKey(ConfigName.ChangingCardLevel, "PoolId",
cardConfig.LevelUpPool, "Level", cardConfig.LevelMax)
local maxLevelProp = levelConfig.PropList
maxLevel.text = cardConfig.LevelMax .. Language[10065]
skillDes.text = IncarnationManager.GetSkillDesStr(_cardId, star)
local propList = {}
2023-07-07 17:48:19 +08:00
-- for k,v in pairs(maxStarProp) do
-- if propList[v[1]] then
-- propList[v[1]]=propList[v[1]]+v[2]
-- else
-- propList[v[1]]=v[2]
-- end
-- end
-- for k,v in pairs(maxLevelProp) do
-- if propList[v[1]] then
-- propList[v[1]]=propList[v[1]]+v[2]
-- else
-- propList[v[1]]=v[2]
-- end
-- end
2024-09-06 10:38:56 +08:00
propList = IncarnationManager.GetChangeCardPropertyAdd(_cardId, cardConfig.LevelMax, star)
local index = 1
LogError("#propList=======" .. #propList)
2023-07-07 17:48:19 +08:00
for i = 1, 6 do
2024-09-06 10:38:56 +08:00
LogError("i===============" .. i)
Util.GetGameObject(go, "propLayout/grid/propText" .. i).gameObject:SetActive(false)
2022-04-25 15:52:46 +08:00
end
2024-09-06 10:38:56 +08:00
for k, v in pairs(propList) do
local propText = Util.GetGameObject(go, "propLayout/grid/propText" .. index):GetComponent("Text") --propGrid.transform:GetChild(index):GetComponent("Text")
2024-10-30 15:44:26 +08:00
propText.text = GetLanguageStrById(PropertyConfig[k].Info) ..
"+" .. GetPropertyFormatStrOne(PropertyConfig[k].Style, v)
2023-07-07 17:48:19 +08:00
propText.gameObject:SetActive(true)
2024-09-06 10:38:56 +08:00
index = index + 1
2022-04-24 22:13:28 +08:00
end
end
2022-11-02 17:20:28 +08:00
2022-04-24 22:13:28 +08:00
function this:OnShow()
2024-09-06 10:38:56 +08:00
end
2022-04-24 22:13:28 +08:00
function this:OnClose()
end
--界面销毁时调用(用于子类重写)
function this:OnDestroy()
2024-09-06 10:38:56 +08:00
this.itemList = {}
2022-04-24 22:13:28 +08:00
end
2024-09-06 10:38:56 +08:00
return this