129 lines
6.3 KiB
Lua
129 lines
6.3 KiB
Lua
----- 中号通用弹窗 -----
|
|
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"},
|
|
--修行选择附身英雄
|
|
[GENERAL_POPUP_TYPE.XiuXingSelectHero] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_XiuXingSelectHero"), panelName = "GeneralBigPopup_XiuXingSelectHero"},
|
|
--神应属性
|
|
[GENERAL_POPUP_TYPE.ShenYingShuXing] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_ShenYingShuXing"), panelName = "GeneralBigPopup_ShenYingShuXing"},
|
|
--四灵试炼助战
|
|
[GENERAL_POPUP_TYPE.FourElementHelpFight] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_FourElementHelpFight"), panelName = "GeneralBigPopup_FourElementHelpFight"},
|
|
[GENERAL_POPUP_TYPE.WuJinShuXing] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_WuJinShuXing"), panelName = "GeneralBigPopup_WuJinShuXing"},
|
|
[GENERAL_POPUP_TYPE.JinJieYuLan] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_JinJieYuLan"), panelName = "GeneralBigPopup_JinJieYuLan"},
|
|
--心愿抽卡
|
|
[GENERAL_POPUP_TYPE.WishDraw] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_WishDraw"), panelName = "GeneralBigPopup_WishDraw"},
|
|
--七界试炼遗物
|
|
[GENERAL_POPUP_TYPE.QiJieTreasure] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_QiJieTreasure"), panelName = "GeneralBigPopup_QiJieTreasure"},
|
|
--寻宝迷踪奖励
|
|
[GENERAL_POPUP_TYPE.XunBaoMiZong] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_XunBaoMiZong"), panelName = "GeneralBigPopup_XunBaoMiZong"},
|
|
--神魂
|
|
[GENERAL_POPUP_TYPE.ShenHun] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_RoleGodSoulUp"), panelName = "GeneralBigPopup_RoleGodSoulUp"},
|
|
--御剑行竞猜
|
|
[GENERAL_POPUP_TYPE.YuJianLastResult] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_YuJianLastResult"), panelName = "GeneralBigPopup_YuJianLastResult"},
|
|
--御剑行上轮奖励
|
|
[GENERAL_POPUP_TYPE.YuJianBet] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_YuJianBet"), panelName = "GeneralBigPopup_YuJianBet"},
|
|
[GENERAL_POPUP_TYPE.ShenHunShuXing] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_ShenhunDes"), panelName = "GeneralBigPopup_ShenhunDes"},
|
|
--灵脉秘境纪录
|
|
[GENERAL_POPUP_TYPE.LingMaiRecord] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_LingMaiRecord"), panelName = "GeneralBigPopup_LingMaiRecord"},
|
|
[GENERAL_POPUP_TYPE.IncarnationDes] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_IncarnationDes"), panelName = "GeneralBigPopup_IncarnationDes"},
|
|
--寻仙招募选择up英雄
|
|
[GENERAL_POPUP_TYPE.ChooseUpHero] = {view = require("Modules/Popup/View/GeneralPopup_ChooseUpHero"), panelName = "GeneralBigPopup_ChooseUpHero"},
|
|
}
|
|
--子模块预设
|
|
local contentPrefabs={}
|
|
--打开弹窗类型
|
|
local popupType
|
|
|
|
--初始化组件(用于子类重写)
|
|
function GeneralBigPopup:InitComponent()
|
|
this.spLoader = SpriteLoader.New()
|
|
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")
|
|
this.BG:SetActive(true)
|
|
this.Mask:SetActive(true)
|
|
--子模块脚本初始化
|
|
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
|
|
local onOpenArgs--临时接的参数 需要onshow刷新的调用
|
|
function GeneralBigPopup:OnOpen(popupKey,...)
|
|
onOpenArgs = {...}
|
|
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)
|
|
this.popupKey = popupKey
|
|
contentScripts[this.popupKey].view:OnShow(this,onOpenArgs)--1、传入自己 2、传入不定参
|
|
end
|
|
|
|
function GeneralBigPopup:OnShow()
|
|
contentPrefabs[this.popupKey].gameObject:SetActive(true)
|
|
contentScripts[this.popupKey].view:OnShow(this,onOpenArgs)--1、传入自己 2、传入不定参
|
|
end
|
|
|
|
function GeneralBigPopup:OnClose()
|
|
for key, value in pairs(contentScripts) do
|
|
value.view:OnClose()
|
|
end
|
|
end
|
|
|
|
function GeneralBigPopup:OnDestroy()
|
|
this.spLoader:Destroy()
|
|
for key, value in pairs(contentScripts) do
|
|
value.view:OnDestroy()
|
|
end
|
|
end
|
|
|
|
return GeneralBigPopup |