2020-11-04 19:51:58 +08:00
|
|
|
----- 中号通用弹窗 -----
|
|
|
|
require("Base/BasePanel")
|
2020-11-05 19:10:20 +08:00
|
|
|
GeneralBigPopup = Inherit(BasePanel)
|
|
|
|
local this = GeneralBigPopup
|
2020-11-04 19:51:58 +08:00
|
|
|
local sorting = 0
|
|
|
|
|
|
|
|
--子模块脚本
|
|
|
|
local contentScripts = {
|
|
|
|
--易经宝库
|
2020-11-05 19:10:20 +08:00
|
|
|
[1] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_YiJingBaoKu"), panelName = "GeneralBigPopup_YiJingBaoKu",type=GENERAL_POPUP_TYPE.YiJingBaoKu},
|
2020-11-06 13:36:48 +08:00
|
|
|
--易经宝库奖励预览
|
|
|
|
[2] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_YiJingBaoKuRewardPreview"), panelName = "GeneralBigPopup_YiJingBaoKuRewardPreview",type=GENERAL_POPUP_TYPE.YiJingBaoKuRewardPreview},
|
2020-11-04 19:51:58 +08:00
|
|
|
}
|
|
|
|
--子模块预设
|
|
|
|
local contentPrefabs={}
|
|
|
|
--打开弹窗类型
|
|
|
|
local popupType
|
|
|
|
--打开弹窗索引
|
|
|
|
local index=0
|
|
|
|
|
|
|
|
--初始化组件(用于子类重写)
|
2020-11-05 19:10:20 +08:00
|
|
|
function GeneralBigPopup:InitComponent()
|
2020-11-04 19:51:58 +08:00
|
|
|
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 i = 1, #contentScripts do
|
|
|
|
contentScripts[i].view:InitComponent(Util.GetGameObject(this.contents, contentScripts[i].panelName))
|
|
|
|
end
|
|
|
|
--预设赋值
|
|
|
|
for i=1,#contentScripts do
|
|
|
|
contentPrefabs[i]=Util.GetGameObject(this.contents,contentScripts[i].panelName)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
2020-11-05 19:10:20 +08:00
|
|
|
function GeneralBigPopup:BindEvent()
|
2020-11-04 19:51:58 +08:00
|
|
|
for i = 1, #contentScripts do
|
|
|
|
contentScripts[i].view:BindEvent()
|
|
|
|
end
|
|
|
|
--返回按钮
|
|
|
|
Util.AddClick(this.backBtn,function()
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.Bag.OnTempBagChanged)
|
|
|
|
self:ClosePanel()
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
2020-11-05 19:10:20 +08:00
|
|
|
function GeneralBigPopup:AddListener()
|
2020-11-04 19:51:58 +08:00
|
|
|
for i = 1, #contentScripts do
|
|
|
|
contentScripts[i].view:AddListener()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-11-05 19:10:20 +08:00
|
|
|
function GeneralBigPopup:RemoveListener()
|
2020-11-04 19:51:58 +08:00
|
|
|
for i = 1, #contentScripts do
|
|
|
|
contentScripts[i].view:RemoveListener()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-11-05 19:10:20 +08:00
|
|
|
function GeneralBigPopup:OnSortingOrderChange()
|
2020-11-04 19:51:58 +08:00
|
|
|
this.sortingOrder = self.sortingOrder
|
|
|
|
end
|
|
|
|
local onOpenArgs--临时接的参数 需要onshow刷新的调用
|
2020-11-05 19:10:20 +08:00
|
|
|
function GeneralBigPopup:OnOpen(popupType,...)
|
2020-11-04 19:51:58 +08:00
|
|
|
onOpenArgs = ...
|
|
|
|
--根据传入类型打开对应面板
|
|
|
|
LogGreen(Language[11561]..popupType)
|
|
|
|
for i,v in pairs(contentScripts) do
|
|
|
|
if popupType==v.type then
|
|
|
|
index=i
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for i=1,#contentPrefabs do
|
|
|
|
contentPrefabs[i].gameObject:SetActive(false)
|
|
|
|
end
|
|
|
|
this.Mask:SetActive(index ~= GENERAL_POPUP_TYPE.Onhook)
|
|
|
|
this.BG:SetActive(index ~= GENERAL_POPUP_TYPE.Onhook)
|
|
|
|
|
|
|
|
contentPrefabs[index].gameObject:SetActive(true)
|
|
|
|
contentScripts[index].view:OnShow(this,...)--1、传入自己 2、传入不定参
|
|
|
|
end
|
|
|
|
|
2020-11-05 19:10:20 +08:00
|
|
|
function GeneralBigPopup:OnShow()
|
2020-11-04 19:51:58 +08:00
|
|
|
end
|
|
|
|
|
2020-11-05 19:10:20 +08:00
|
|
|
function GeneralBigPopup:OnClose()
|
2020-11-04 19:51:58 +08:00
|
|
|
for i = 1, #contentScripts do
|
|
|
|
contentScripts[i].view:OnClose()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-11-05 19:10:20 +08:00
|
|
|
function GeneralBigPopup:OnDestroy()
|
2020-11-04 19:51:58 +08:00
|
|
|
for i = 1, #contentScripts do
|
|
|
|
contentScripts[i].view:OnDestroy()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-11-05 19:10:20 +08:00
|
|
|
return GeneralBigPopup
|