98 lines
4.0 KiB
Lua
98 lines
4.0 KiB
Lua
----- 信息通用弹窗 -----
|
|
require("Base/BasePanel")
|
|
GeneralInfoPopup = Inherit(BasePanel)
|
|
local this = GeneralInfoPopup
|
|
local sorting = 0
|
|
|
|
--子模块脚本
|
|
local contentScripts = {
|
|
--神印信息
|
|
[GENERALINFO_TYPE.Imprint] = {view = require("Modules/GeneralPanel/View2/GeneralInfoPopup_Imprint"), panelName = "GeneralInfoPopup_Imprint"},
|
|
--修行界面小点的信息
|
|
[GENERALINFO_TYPE.PracticeLevel] = {view = require("Modules/GeneralPanel/View2/GeneralInfoPopup_PracticeLevel"), panelName = "GeneralInfoPopup_PracticeLevel"},
|
|
--七界试炼目标属性
|
|
[GENERALINFO_TYPE.QiJieGoalAttri] = {view = require("Modules/GeneralPanel/View2/GeneralInfoPopup_QiJieGoalAttri"), panelName = "GeneralInfoPopup_QiJieGoalAttri"},
|
|
--七界遗物全部属性
|
|
[GENERALINFO_TYPE.QiJieAllTreasure] = {view = require("Modules/GeneralPanel/View2/GeneralInfoPopup_QiJieAllTreasure"), panelName = "GeneralInfoPopup_QiJieAllTreasure"},
|
|
[GENERALINFO_TYPE.FourQuadrant] = {view = require("Modules/GeneralPanel/View2/GeneralInfoPopup_fourQuadrant"), panelName = "GeneralInfoPopup_fourQuadrant"},
|
|
--主角修为问号
|
|
[GENERALINFO_TYPE.Cultivation] = {view = require("Modules/GeneralPanel/View2/GeneralInfoPopup_Cultivation"), panelName = "GeneralInfoPopup_Cultivation"},
|
|
--主角修为问号
|
|
[GENERALINFO_TYPE.ExploreMapTip] = {view = require("Modules/GeneralPanel/View2/GeneralInfoPopup_ExploreMapTip"), panelName = "GeneralInfoPopup_ExploreMapTip"},
|
|
|
|
[GENERALINFO_TYPE.Gem] = {view = require("Modules/GeneralPanel/View2/GeneralInfoPopup_Gem"), panelName = "GeneralInfoPopup_Gem"},
|
|
--家园建筑详情
|
|
[GENERALINFO_TYPE.HomeLandBuildingDetail] = {view = require("Modules/GeneralPanel/View2/GeneralInfoPopup_HomeLandBuildingDetail"), panelName = "GeneralInfoPopup_HomeLandBuildingDetail"},
|
|
--家园建筑升级
|
|
[GENERALINFO_TYPE.HomeLandUpgrade] = {view = require("Modules/GeneralPanel/View2/GeneralInfoPopup_HomeLandUpgrade"), panelName = "GeneralInfoPopup_HomeLandUpgrade"},
|
|
--家园特权
|
|
[GENERALINFO_TYPE.HomeLandPrivilege] = {view = require("Modules/GeneralPanel/View2/GeneralInfoPopup_HomeLandPrivilege"), panelName = "GeneralInfoPopup_HomeLandPrivilege"},
|
|
}
|
|
--子模块预设
|
|
local contentPrefabs={}
|
|
|
|
--初始化组件(用于子类重写)
|
|
function GeneralInfoPopup:InitComponent()
|
|
this.contents = Util.GetGameObject(this.gameObject,"Content")
|
|
this.backBtn = Util.GetGameObject(this.gameObject,"backBtn")
|
|
|
|
--子模块脚本初始化
|
|
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 GeneralInfoPopup:BindEvent()
|
|
for key, value in pairs(contentScripts) do
|
|
value.view:BindEvent()
|
|
end
|
|
--返回按钮
|
|
Util.AddClick(this.backBtn,function()
|
|
self:ClosePanel()
|
|
end)
|
|
end
|
|
|
|
function GeneralInfoPopup:AddListener()
|
|
for key, value in pairs(contentScripts) do
|
|
value.view:AddListener()
|
|
end
|
|
end
|
|
|
|
function GeneralInfoPopup:RemoveListener()
|
|
for key, value in pairs(contentScripts) do
|
|
value.view:RemoveListener()
|
|
end
|
|
end
|
|
|
|
function GeneralInfoPopup:OnSortingOrderChange()
|
|
this.sortingOrder = self.sortingOrder
|
|
end
|
|
function GeneralInfoPopup:OnOpen(popupKey,...)
|
|
for key, value in pairs(contentPrefabs) do
|
|
value.gameObject:SetActive(false)
|
|
end
|
|
contentPrefabs[popupKey].gameObject:SetActive(true)
|
|
contentScripts[popupKey].view:OnShow(this,...)--1、传入自己 2、传入不定参
|
|
end
|
|
|
|
function GeneralInfoPopup:OnShow()
|
|
end
|
|
|
|
function GeneralInfoPopup:OnClose()
|
|
for key, value in pairs(contentScripts) do
|
|
value.view:OnClose()
|
|
end
|
|
end
|
|
|
|
function GeneralInfoPopup:OnDestroy()
|
|
for key, value in pairs(contentScripts) do
|
|
value.view:OnDestroy()
|
|
end
|
|
end
|
|
|
|
return GeneralInfoPopup |