local this = {} --传入父脚本模块 local parent --传入特效层级 local sortingOrder=0 local QiJieStageBuff = ConfigManager.GetConfig(ConfigName.QijieStageBuff) --初始化组件(用于子类重写) function this:InitComponent(gameObject) this.addList = Util.GetGameObject(gameObject, "AddList") this.TextPre = Util.GetGameObject(this.addList, "TextPre") this.addTextList = {} end --绑定事件(用于子类重写) function this:BindEvent() end --添加事件监听(用于子类重写) function this:AddListener() end --移除事件监听(用于子类重写) function this:RemoveListener() end --界面打开时调用(用于子类重写) function this:OnShow(_parent,...) parent=_parent sortingOrder = _parent.sortingOrder local _args = {...} local data = _args[1] local pos = _args[2] if pos then parent.contents:GetComponent("RectTransform").localPosition = pos end if not this.addTextList then this.addTextList = {} end for k,v in ipairs(this.addTextList) do v.gameObject:SetActive(false) end for i = 1, #data.Buff do local attri = data.Buff[i] if not this.addTextList[i] then this.addTextList[i] = newObject(this.TextPre) this.addTextList[i].transform:SetParent(this.addList.transform) this.addTextList[i].transform.localScale = Vector3.one this.addTextList[i].transform.localPosition = Vector3.zero end this.addTextList[i]:SetActive(true) local str = QiJieStageBuff[attri].Describe this.addTextList[i]:GetComponent("Text").text = str this.addTextList[i]:GetComponent("Text").text = string.format("·%s",str) end end --界面关闭时调用(用于子类重写) function this:OnClose() if parent then parent.contents:GetComponent("RectTransform").localPosition = Vector2(0,0) end end --界面销毁时调用(用于子类重写) function this:OnDestroy() this.addTextList = {} end return this