----- 献祭弹窗 ----- local this = {} --传入父脚本模块 local parent --传入特效层级 local sortingOrder=0 local fun local itemList = {} --传入选择英雄 local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig) this.timer = Timer.New() function this:InitComponent(gameObject) this.spLoader = SpriteLoader.New() this.backBtn=Util.GetGameObject(gameObject,"bg/backBtn") this.Root=Util.GetGameObject(gameObject,"Root") this.proPre=Util.GetGameObject(gameObject,"proPre") this.shengxingIma=Util.GetGameObject(gameObject,"bg/shengxing"):GetComponent("Image") itemList = {} end function this:BindEvent() Util.AddClick(this.backBtn,function() if parent then parent:ClosePanel() end end) end function this:AddListener() end function this:RemoveListener() end function this:OnShow(_parent,...) FightPointPassManager.SetIsOpenRewardUpTip(false) parent=_parent sortingOrder = _parent.sortingOrder --不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参 local _args = {...} local data = _args[1] fun = _args[2] this.shengxingIma = this.spLoader:LoadSprite(data.title) --itemList if data then for i = 1, math.max(#itemList, #data.itemList) do if not itemList[i] then itemList[i] = {} itemList[i].go = newObject(this.proPre) itemList[i].go.transform:SetParent(this.Root.transform) itemList[i].go.transform.localScale = Vector3.one itemList[i].go.transform.localPosition = Vector3.zero itemList[i].add = Util.GetGameObject(itemList[i].go,"Image (1)") itemList[i].icon = Util.GetGameObject(itemList[i].go,"Image"):GetComponent("Image") itemList[i].proName = Util.GetGameObject(itemList[i].go, "proName"):GetComponent("Text") itemList[i].proValue = Util.GetGameObject(itemList[i].go, "proValue"):GetComponent("Text") itemList[i].nextproValue = Util.GetGameObject(itemList[i].go, "nextproValue"):GetComponent("Text") end itemList[i].go.gameObject:SetActive(false) end for i = 1, #data.itemList do local go = itemList[i].go go.gameObject:SetActive(true) if not data.itemList[i].icon then itemList[i].icon.gameObject:SetActive(false) else itemList[i].icon.gameObject:SetActive(true) itemList[i].icon.sprite = SetIcon(self.spLoader, data.itemList[i].icon) end itemList[i].proName.text = data.itemList[i].proName if not data.itemList[i].proValue and not data.itemList[i].proValue1 then itemList[i].add.gameObject:SetActive(false) else itemList[i].add.gameObject:SetActive(true) end if not data.itemList[i].proValue then itemList[i].proValue.gameObject:SetActive(false) else itemList[i].proValue.gameObject:SetActive(true) itemList[i].proValue.text = data.itemList[i].proValue end if not data.itemList[i].proValue1 then itemList[i].nextproValue.gameObject:SetActive(false) else itemList[i].nextproValue.gameObject:SetActive(true) itemList[i].nextproValue.text = data.itemList[i].proValue1 end end end if this.timer then this.timer:Stop() this.timer = nil end this.timer = Timer.New(function() if parent then parent:ClosePanel() end end,2):Start() end function this:OnClose() if this.timer then this.timer:Stop() this.timer = nil end if parent then parent:ClosePanel() end end function this:OnDestroy() this.spLoader:Destroy() itemList = {} if this.timer then this.timer:Stop() this.timer = nil end end return this