----- 神应属性弹窗 ----- 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") self.close =Util.GetGameObject(gameObject, "close") end function this:BindEvent() Util.AddClick(self.close,function() parent:ClosePanel() end) 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].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