miduo_client/Assets/ManagedResources/~Lua/Modules/GeneralPanel/View/GeneralBigPopup_WuJinShuXin...

88 lines
2.7 KiB
Lua
Raw Normal View History

2021-05-21 16:39:08 +08:00
----- 神应属性弹窗 -----
local this = {}
local PropertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
--传入父脚本模块
local parent
local sortingOrder=0
local attriList = {}
function this:InitComponent(gameObject)
self.bg =Util.GetGameObject(gameObject, "bg")
self.proGroup =Util.GetGameObject(gameObject, "proGroup")
self.proTitle =Util.GetGameObject(gameObject, "title")
self.proValue =Util.GetGameObject(gameObject, "pro")
2021-05-22 14:08:34 +08:00
self.close =Util.GetGameObject(gameObject, "close")
2021-05-21 16:39:08 +08:00
end
function this:BindEvent()
2021-05-22 14:08:34 +08:00
Util.AddClick(self.close,function()
parent:ClosePanel()
end)
2021-05-21 16:39:08 +08:00
end
function this:AddListener()
end
function this:RemoveListener()
end
function this:OnShow(_parent,...)
parent=_parent
sortingOrder = _parent.sortingOrder
parent.BG:SetActive(false)
local args = {...}
local data = args[1]
for i = 1, #data do
if not attriList[i] then
attriList[i] = {}
attriList[i].proGroup = newObjToParent(self.proGroup,self.bg)
end
attriList[i].proGroup.gameObject:SetActive(false)
if not attriList[i].title then
attriList[i].title = newObjToParent(self.proTitle,attriList[i].proGroup)
attriList[i].titleCom = Util.GetGameObject(attriList[i].title,"name/text"):GetComponent("Text")
end
attriList[i].title.gameObject:SetActive(false)
for j = 1, #data[i].pro do
if not attriList[i].pro then
attriList[i].pro = {}
end
if not attriList[i].TextCom then
attriList[i].TextCom = {}
end
if not attriList[i].pro[j] then
attriList[i].pro[j] = newObjToParent(self.proValue,attriList[i].proGroup)
attriList[i].TextCom[j] = Util.GetGameObject(attriList[i].pro[j],"name"):GetComponent("Text")
end
attriList[i].pro[j].gameObject:SetActive(false)
end
attriList[i].proGroup.gameObject:SetActive(false)
end
for i = 1, #data do
attriList[i].proGroup.gameObject:SetActive(true)
if data[i].title and data[i].title ~= "" then
attriList[i].title.gameObject:SetActive(true)
attriList[i].titleCom.text = data[i].title
else
attriList[i].title.gameObject:SetActive(false)
end
for j = 1, #data[i].pro do
attriList[i].pro[j].gameObject:SetActive(true)
attriList[i].TextCom[j].text = data[i].pro[j]
end
end
end
function this:OnClose()
Util.ClearChild(self.bg.transform)
attriList = {}
end
function this:OnDestroy()
Util.ClearChild(self.bg.transform)
attriList = {}
end
return this