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

62 lines
1.6 KiB
Lua
Raw Normal View History

2021-12-08 17:27:22 +08:00
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 data = GemManager.GetAllAttri()
for key, value in pairs(self.itemList) do
value:SetActive(false)
end
for key, value in pairs(data) do
local go = self.itemList[key]
if not go then
go = newObjToParent(self.itemPre,self.Content.transform)
self.itemList[key] = go
end
go:SetActive(true)
2021-12-08 18:21:28 +08:00
go:GetComponent("Text").text = string.format("%s加成%s",propertyConfig[key].Info,value/100).."%"
2021-12-08 17:27:22 +08:00
end
end
--界面关闭时调用(用于子类重写)
function this:OnClose()
end
--界面销毁时调用(用于子类重写)
function this:OnDestroy()
this.spLoader:Destroy()
self.itemList = {}
end
return this