miduo_client/Assets/ManagedResources/~Lua/Modules/GeneralPanel/View2/GeneralInfoPopup_Gem.lua

68 lines
1.9 KiB
Lua

local this = {}
--传入父脚本模块
local parent
--传入特效层级
local sortingOrder=0
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
--初始化组件(用于子类重写)
function this:InitComponent(gameObject)
this.spLoader = SpriteLoader.New()
self.itemPre = Util.GetGameObject(gameObject, "TextPre")
self.Content = Util.GetGameObject(gameObject, "Scroll/Content")
self.itemList = {}
end
--绑定事件(用于子类重写)
function this:BindEvent()
end
--添加事件监听(用于子类重写)
function this:AddListener()
end
--移除事件监听(用于子类重写)
function this:RemoveListener()
end
--界面打开时调用(用于子类重写)
function this:OnShow(_parent,...)
parent=_parent
sortingOrder = _parent.sortingOrder
local _args = {...}
self:Refresh()
end
function this:Refresh()
local tempData = GemManager.GetSortAttri()
for key, value in pairs(self.itemList) do
value:SetActive(false)
end
for index, value in ipairs(tempData) do
local go = self.itemList[value.id]
if not go then
go = newObjToParent(self.itemPre,self.Content.transform)
self.itemList[value.id] = go
end
go:SetActive(true)
local str=""
if propertyConfig[value.id].Style==1 then
str=string.format( "全体英雄%s+%s",propertyConfig[value.id].Info,value.num)
elseif propertyConfig[value.id].Style==2 then
str=string.format( "全体英雄%s+%s",propertyConfig[value.id].Info,value.num/100).."%"
end
go:GetComponent("Text").text = str--string.format("%s+%s",propertyConfig[value.id].Info,value.num/100).."%"
end
end
--界面关闭时调用(用于子类重写)
function this:OnClose()
end
--界面销毁时调用(用于子类重写)
function this:OnDestroy()
this.spLoader:Destroy()
self.itemList = {}
end
return this