----- 中号通用弹窗 ----- require("Base/BasePanel") GeneralBigPopup = Inherit(BasePanel) local this = GeneralBigPopup local sorting = 0 --子模块脚本 local contentScripts = { --易经宝库 [GENERAL_POPUP_TYPE.YiJingBaoKu] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_YiJingBaoKu"), panelName = "GeneralBigPopup_YiJingBaoKu"}, --易经宝库奖励预览 [GENERAL_POPUP_TYPE.YiJingBaoKuRewardPreview] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_YiJingBaoKuRewardPreview"), panelName = "GeneralBigPopup_YiJingBaoKuRewardPreview"}, --修行境界预览 [GENERAL_POPUP_TYPE.PracticeStatePreview] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_PracticeStatePreview"), panelName = "GeneralBigPopup_PracticeStatePreview"}, [GENERAL_POPUP_TYPE.RecrutReward] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_ExpertRewardSortPanel"), panelName = "GeneralBigPopup_ExpertRewardSortPanel"}, [GENERAL_POPUP_TYPE.RecrutDetail] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_RecrutDetail"), panelName = "GeneralBigPopup_RecrutDetail"}, } --子模块预设 local contentPrefabs={} --打开弹窗类型 local popupType --初始化组件(用于子类重写) function GeneralBigPopup:InitComponent() this.contents=Util.GetGameObject(this.gameObject,"Contents") this.backBtn=Util.GetGameObject(this.contents,"BG/BackBtn") this.BG=Util.GetGameObject(this.contents,"BG") this.Mask=Util.GetGameObject(this.gameObject,"Mask") --子模块脚本初始化 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 GeneralBigPopup:BindEvent() for key, value in pairs(contentScripts) do value.view:BindEvent() end --返回按钮 Util.AddClick(this.backBtn,function() Game.GlobalEvent:DispatchEvent(GameEvent.Bag.OnTempBagChanged) self:ClosePanel() end) Util.AddClick(this.Mask,function() Game.GlobalEvent:DispatchEvent(GameEvent.Bag.OnTempBagChanged) self:ClosePanel() end) end function GeneralBigPopup:AddListener() for key, value in pairs(contentScripts) do value.view:AddListener() end end function GeneralBigPopup:RemoveListener() for key, value in pairs(contentScripts) do value.view:RemoveListener() end end function GeneralBigPopup:OnSortingOrderChange() this.sortingOrder = self.sortingOrder end function GeneralBigPopup:OnOpen(popupKey,...) for key, value in pairs(contentPrefabs) do value.gameObject:SetActive(false) end this.Mask:SetActive(popupKey ~= GENERAL_POPUP_TYPE.Onhook) this.BG:SetActive(popupKey ~= GENERAL_POPUP_TYPE.Onhook) contentPrefabs[popupKey].gameObject:SetActive(true) contentScripts[popupKey].view:OnShow(this,...)--1、传入自己 2、传入不定参 end function GeneralBigPopup:OnShow() end function GeneralBigPopup:OnClose() for key, value in pairs(contentScripts) do value.view:OnClose() end end function GeneralBigPopup:OnDestroy() for key, value in pairs(contentScripts) do value.view:OnDestroy() end end return GeneralBigPopup