----- 通用恭喜弹窗 ----- require("Base/BasePanel") CongratulationPopup = Inherit(BasePanel) local this = CongratulationPopup local sorting = 0 --local SkeletonGraphic local idleFunc = function() SkeletonGraphic.AnimationState:SetAnimation(0, "idle2", true) end --子模块脚本 local contentScripts = { --神印信息 [CONGRATULATION_TYPE.Practice] = {view = require("Modules/GeneralPanel/View3/CongratulationPopup_Practice"), panelName = "CongratulationPopup_Practice",idleName = "idle1"}, } --子模块预设 local contentPrefabs={} --初始化组件(用于子类重写) function CongratulationPopup:InitComponent() sorting = 0 this.mask = Util.GetGameObject(this.gameObject,"Mask") this.contents = Util.GetGameObject(this.gameObject,"Contents/Pages") this.effect = Util.GetGameObject(this.gameObject,"Contents/Pages/Shows/UI_effect_FightEndLvUp") this.roleEffect=Util.GetGameObject(self.transform, "Contents/Pages/Shows/npc") this.roleEffect.gameObject:SetActive(true) --SkeletonGraphic = this.roleEffect:GetComponent("SkeletonGraphic") --SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete + idleFunc this.title=Util.GetGameObject(this.gameObject,"Contents/Pages/Shows/titleBg (1)/Text"):GetComponent("Text") this.title.text="名望突破" this.info=Util.GetGameObject(this.gameObject,"Contents/Pages/CongratulationPopup_Practice/title/Image"):GetComponent("Text") this.info.text="恭喜突破至" this.levelName=Util.GetGameObject(this.gameObject,"Contents/Pages/CongratulationPopup_Practice/title/Img"):GetComponent("Text") --子模块脚本初始化 for key, value in pairs(contentScripts) do value.view:InitComponent(Util.GetGameObject(this.contents, value.panelName)) end --预设赋值 for key, value in pairs(contentScripts) do contentPrefabs[key]=Util.GetGameObject(this.contents,value.panelName) end end --绑定事件(用于子类重写) function CongratulationPopup:BindEvent() for key, value in pairs(contentScripts) do value.view:BindEvent() end --返回按钮 Util.AddClick(this.mask,function() self:ClosePanel() end) end function CongratulationPopup:AddListener() for key, value in pairs(contentScripts) do value.view:AddListener() end end function CongratulationPopup:RemoveListener() for key, value in pairs(contentScripts) do value.view:RemoveListener() end end function CongratulationPopup:OnSortingOrderChange() Util.AddParticleSortLayer(this.effect,self.sortingOrder - sorting) sorting = self.sortingOrder end function CongratulationPopup:OnOpen(popupKey,...) this.effect:SetActive(true) --local SkeletonGraphic = this.roleEffect:GetComponent("SkeletonGraphic") for key, value in pairs(contentPrefabs) do value.gameObject:SetActive(false) end contentPrefabs[popupKey].gameObject:SetActive(true) --SkeletonGraphic.AnimationState:SetAnimation(0, contentScripts[popupKey].idleName, false) contentScripts[popupKey].view:OnShow(this,...)--1、传入自己 2、传入不定参 end function CongratulationPopup:OnShow() end function CongratulationPopup:OnClose() for key, value in pairs(contentScripts) do value.view:OnClose() end end function CongratulationPopup:OnDestroy() for key, value in pairs(contentScripts) do value.view:OnDestroy() end --SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete - idleFunc end return CongratulationPopup