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

114 lines
3.5 KiB
Lua

require("Base/BasePanel")
IncarnationUpHelpPopup = Inherit(BasePanel)
local this = IncarnationUpHelpPopup
local PropertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
function this:InitComponent()
this.btnBack = Util.GetGameObject(self.gameObject, "BackMask")
this.back = Util.GetGameObject(self.gameObject, "BG/BackBtn")
this.itemList = {}
for i = 1, 5 do
local item = Util.GetGameObject(self.gameObject, "scroll/grid/item" .. i)
table.insert(this.itemList, item)
end
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()
end
function this:OnOpen(_cardId)
for i = 1, #this.itemList do
this.UpdateItemInfo(this.itemList[i], _cardId, i)
end
end
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
starObj:SetActive(true)
else
starObj:SetActive(false)
end
--table.insert(starList,star)
end
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 = {}
-- 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
propList = IncarnationManager.GetChangeCardPropertyAdd(_cardId, cardConfig.LevelMax, star)
local index = 1
LogError("#propList=======" .. #propList)
for i = 1, 6 do
LogError("i===============" .. i)
Util.GetGameObject(go, "propLayout/grid/propText" .. i).gameObject:SetActive(false)
end
for k, v in pairs(propList) do
local propText = Util.GetGameObject(go, "propLayout/grid/propText" .. index):GetComponent("Text") --propGrid.transform:GetChild(index):GetComponent("Text")
propText.text = GetLanguageStrById(PropertyConfig[k].Info) ..
"+" .. GetPropertyFormatStrOne(PropertyConfig[k].Style, v)
propText.gameObject:SetActive(true)
index = index + 1
end
end
function this:OnShow()
end
function this:OnClose()
end
--界面销毁时调用(用于子类重写)
function this:OnDestroy()
this.itemList = {}
end
return this