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

100 lines
3.3 KiB
Lua

----- 神应属性弹窗 -----
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.proTip =Util.GetGameObject(gameObject, "tip")
self.proValue =Util.GetGameObject(gameObject, "pro")
self.proNum =Util.GetGameObject(self.proValue, "name")
end
function this:BindEvent()
end
function this:AddListener()
end
function this:RemoveListener()
end
function this:OnShow(_parent,_Data)
parent=_parent
sortingOrder = _parent.sortingOrder
parent.BG:SetActive(false)
local args = _Data
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].proParent then
attriList[i].proParent = newObjToParent(self.proValue,attriList[i].proGroup)
end
if not attriList[i].pro[j] then
attriList[i].pro[j] = newObjToParent(self.proNum,attriList[i].proParent)
attriList[i].TextCom[j] = attriList[i].pro[j]:GetComponent("Text")
end
attriList[i].pro[j].gameObject:SetActive(false)
end
if not attriList[i].tip then
attriList[i].tip = newObjToParent(self.proTip,attriList[i].proGroup)
attriList[i].tipComp = Util.GetGameObject(attriList[i].tip,"name"):GetComponent("Text")
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
if data[i].tip and data[i].tip ~= "" then
attriList[i].tip.gameObject:SetActive(true)
attriList[i].tipComp.text = data[i].tip
else
attriList[i].tip.gameObject:SetActive(false)
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