86 lines
2.8 KiB
Lua
86 lines
2.8 KiB
Lua
----- 信息通用弹窗 -----
|
|
require("Base/BasePanel")
|
|
GeneralSizeFitterPopup = Inherit(BasePanel)
|
|
local this = GeneralSizeFitterPopup
|
|
local sorting = 0
|
|
--子模块脚本
|
|
local contentScripts = {
|
|
[GENERALSIZEFITTER_TYPE.ExploreSelectFormation] = {view = require("Modules/GeneralPanel/GeneralSizeFitterPopup_ExploreSelectFormation"), panelName = "GeneralSizeFitterPopup_ExploreSelectFormation"},
|
|
[GENERALSIZEFITTER_TYPE.OneKeyExplore] = {view = require("Modules/GeneralPanel/GeneralSizeFitterPopup_OneKeyExplore"), panelName = "GeneralSizeFitterPopup_OneKeyExplore"},
|
|
}
|
|
--子模块预设
|
|
local contentPrefabs={}
|
|
|
|
--初始化组件(用于子类重写)
|
|
function GeneralSizeFitterPopup:InitComponent()
|
|
this.contents = Util.GetGameObject(this.gameObject,"Content")
|
|
this.backBtn = Util.GetGameObject(this.gameObject,"backBtn")
|
|
this.quitBtn = Util.GetGameObject(this.gameObject,"Content/backBtn")
|
|
this.title = Util.GetGameObject(this.gameObject,"Content/title"):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 GeneralSizeFitterPopup:BindEvent()
|
|
for key, value in pairs(contentScripts) do
|
|
value.view:BindEvent()
|
|
end
|
|
--返回按钮
|
|
Util.AddClick(this.backBtn,function()
|
|
self:ClosePanel()
|
|
end)
|
|
--返回按钮
|
|
Util.AddClick(this.quitBtn,function()
|
|
self:ClosePanel()
|
|
end)
|
|
end
|
|
|
|
-- function GeneralSizeFitterPopup:AddListener()
|
|
-- for key, value in pairs(contentScripts) do
|
|
-- value.view:AddListener()
|
|
-- end
|
|
-- end
|
|
|
|
-- function GeneralSizeFitterPopup:RemoveListener()
|
|
-- for key, value in pairs(contentScripts) do
|
|
-- value.view:RemoveListener()
|
|
-- end
|
|
-- end
|
|
|
|
function GeneralSizeFitterPopup:OnSortingOrderChange()
|
|
this.sortingOrder = self.sortingOrder
|
|
end
|
|
function GeneralSizeFitterPopup:OnOpen(popupKey,...)
|
|
for key, value in pairs(contentPrefabs) do
|
|
value.gameObject:SetActive(false)
|
|
end
|
|
this.popupKey = popupKey
|
|
contentPrefabs[popupKey].gameObject:SetActive(true)
|
|
contentScripts[popupKey].view:OnOpen(this,...)--1、传入自己 2、传入不定参
|
|
end
|
|
|
|
function GeneralSizeFitterPopup:OnShow()
|
|
contentScripts[this.popupKey].view:OnShow()
|
|
contentScripts[this.popupKey].view:AddListener()
|
|
end
|
|
|
|
function GeneralSizeFitterPopup:OnClose()
|
|
for key, value in pairs(contentScripts) do
|
|
value.view:OnClose()
|
|
end
|
|
end
|
|
|
|
function GeneralSizeFitterPopup:OnDestroy()
|
|
for key, value in pairs(contentScripts) do
|
|
value.view:OnDestroy()
|
|
end
|
|
end
|
|
|
|
return GeneralSizeFitterPopup |