miduo_client/Assets/ManagedResources/~Lua/Modules/GeneralPanel/GeneralSizeFitterPopup.lua

86 lines
2.8 KiB
Lua
Raw Normal View History

2021-12-23 13:09:34 +08:00
----- 信息通用弹窗 -----
require("Base/BasePanel")
GeneralSizeFitterPopup = Inherit(BasePanel)
local this = GeneralSizeFitterPopup
local sorting = 0
--子模块脚本
local contentScripts = {
2021-12-23 17:23:02 +08:00
[GENERALSIZEFITTER_TYPE.ExploreSelectFormation] = {view = require("Modules/GeneralPanel/GeneralSizeFitterPopup_ExploreSelectFormation"), panelName = "GeneralSizeFitterPopup_ExploreSelectFormation"},
[GENERALSIZEFITTER_TYPE.OneKeyExplore] = {view = require("Modules/GeneralPanel/GeneralSizeFitterPopup_OneKeyExplore"), panelName = "GeneralSizeFitterPopup_OneKeyExplore"},
2021-12-23 13:09:34 +08:00
}
--子模块预设
local contentPrefabs={}
--初始化组件(用于子类重写)
function GeneralSizeFitterPopup:InitComponent()
this.contents = Util.GetGameObject(this.gameObject,"Content")
this.backBtn = Util.GetGameObject(this.gameObject,"backBtn")
2021-12-24 00:14:32 +08:00
this.quitBtn = Util.GetGameObject(this.gameObject,"Content/backBtn")
2021-12-30 13:27:57 +08:00
this.title = Util.GetGameObject(this.gameObject,"Content/title"):GetComponent("Text")
2021-12-23 13:09:34 +08:00
--子模块脚本初始化
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)
2021-12-24 00:14:32 +08:00
--返回按钮
Util.AddClick(this.quitBtn,function()
self:ClosePanel()
end)
2021-12-23 13:09:34 +08:00
end
2021-12-29 10:33:12 +08:00
-- function GeneralSizeFitterPopup:AddListener()
-- for key, value in pairs(contentScripts) do
-- value.view:AddListener()
-- end
-- end
2021-12-23 13:09:34 +08:00
2021-12-29 10:33:12 +08:00
-- function GeneralSizeFitterPopup:RemoveListener()
-- for key, value in pairs(contentScripts) do
-- value.view:RemoveListener()
-- end
-- end
2021-12-23 13:09:34 +08:00
function GeneralSizeFitterPopup:OnSortingOrderChange()
this.sortingOrder = self.sortingOrder
end
function GeneralSizeFitterPopup:OnOpen(popupKey,...)
for key, value in pairs(contentPrefabs) do
value.gameObject:SetActive(false)
end
2021-12-24 00:14:32 +08:00
this.popupKey = popupKey
2021-12-23 13:09:34 +08:00
contentPrefabs[popupKey].gameObject:SetActive(true)
2021-12-24 00:14:32 +08:00
contentScripts[popupKey].view:OnOpen(this,...)--1、传入自己 2、传入不定参
2021-12-23 13:09:34 +08:00
end
function GeneralSizeFitterPopup:OnShow()
2021-12-24 00:14:32 +08:00
contentScripts[this.popupKey].view:OnShow()
2021-12-29 10:33:12 +08:00
contentScripts[this.popupKey].view:AddListener()
2021-12-23 13:09:34 +08:00
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