2020-05-09 13:31:21 +08:00
|
|
|
----- 通用弹窗 -----
|
|
|
|
require("Base/BasePanel")
|
|
|
|
GeneralPopup = Inherit(BasePanel)
|
|
|
|
local this=GeneralPopup
|
|
|
|
|
|
|
|
--子模块脚本
|
|
|
|
local contentScripts = {
|
|
|
|
--回溯
|
|
|
|
[1] = {view = require("Modules/Popup/View/GeneralPopup_ResolveRecall"), panelName = "GeneralPopup_ResolveRecall",type=GENERAL_POPUP_TYPE.ResolveRecall},
|
|
|
|
--献祭
|
|
|
|
[2] = {view = require("Modules/Popup/View/GeneralPopup_ResolveDismantle"), panelName = "GeneralPopup_ResolveDismantle",type=GENERAL_POPUP_TYPE.ResolveDismantle},
|
|
|
|
--装备合成
|
|
|
|
[3]= {view=require("Modules/Popup/View/GeneralPopup_EquipCompound"),panelName="GeneralPopup_EquipCompound",type=GENERAL_POPUP_TYPE.EquipCompound},
|
|
|
|
--公会技能重置返还
|
|
|
|
[4]= {view=require("Modules/Popup/View/GeneralPopup_GuildSkillReset"),panelName="GeneralPopup_GuildSkillReset",type=GENERAL_POPUP_TYPE.GuildSkill},
|
2020-05-15 16:52:35 +08:00
|
|
|
--宝物合成
|
|
|
|
[5]= {view=require("Modules/Popup/View/GeneralPopup_TreasureCompound"),panelName="GeneralPopup_TreasureCompound",type=GENERAL_POPUP_TYPE.TreasureCompound},
|
|
|
|
--公会援助发送求助碎片
|
|
|
|
[6]= {view=require("Modules/Popup/View/GeneralPopup_GuildAid"),panelName="GeneralPopup_GuildAid",type=GENERAL_POPUP_TYPE.GuildAid},
|
|
|
|
--公会援助查看宝箱奖励
|
|
|
|
[7]= {view=require("Modules/Popup/View/GeneralPopup_GuildAidFindBoxReward"),panelName="GeneralPopup_GuildAidFindBoxReward",type=GENERAL_POPUP_TYPE.GuildAidFindBoxReward},
|
2020-05-25 19:16:23 +08:00
|
|
|
--点将台抽卡 奖励弹窗
|
2020-06-03 19:09:01 +08:00
|
|
|
[8]= {view=require("Modules/Popup/View/GeneralPopup_RecruitBox"),panelName="GeneralPopup_RecruitBox",type=GENERAL_POPUP_TYPE.RecruitBox},
|
|
|
|
--挂机属性提升
|
|
|
|
[9]= {view=require("Modules/Popup/View/GeneralPopup_Onhook"),panelName="GeneralPopup_Onhook",type=GENERAL_POPUP_TYPE.Onhook},
|
|
|
|
--试练设置弹窗
|
|
|
|
[10]={view=require("Modules/Popup/View/GeneralPopup_TrialSetting"),panelName="GeneralPopup_TrialSetting",type=GENERAL_POPUP_TYPE.TrialSetting},
|
|
|
|
--试练回春散
|
|
|
|
[11]={view=require("Modules/Popup/View/GeneralPopup_TrialXingYao"),panelName="GeneralPopup_TrialXingYao",type=GENERAL_POPUP_TYPE.TrialXingYao},
|
2020-05-09 13:31:21 +08:00
|
|
|
}
|
|
|
|
--子模块预设
|
|
|
|
local contentPrefabs={}
|
|
|
|
--打开弹窗类型
|
|
|
|
local popupType
|
|
|
|
--打开弹窗索引
|
|
|
|
local index=0
|
|
|
|
|
|
|
|
|
|
|
|
function GeneralPopup:InitComponent()
|
|
|
|
this.contents=Util.GetGameObject(this.gameObject,"Contents")
|
2020-06-03 19:09:01 +08:00
|
|
|
this.backBtn=Util.GetGameObject(this.contents,"BG/BackBtn")
|
|
|
|
this.BG=Util.GetGameObject(this.contents,"BG")
|
|
|
|
this.Mask=Util.GetGameObject(this.gameObject,"Mask")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
--子模块脚本初始化
|
|
|
|
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
|
|
|
|
|
|
|
|
function GeneralPopup:BindEvent()
|
|
|
|
for i = 1, #contentScripts do
|
|
|
|
contentScripts[i].view:BindEvent()
|
|
|
|
end
|
|
|
|
--返回按钮
|
|
|
|
Util.AddClick(this.backBtn,function()
|
|
|
|
self:ClosePanel()
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
function GeneralPopup:AddListener()
|
|
|
|
for i = 1, #contentScripts do
|
|
|
|
contentScripts[i].view:AddListener()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function GeneralPopup:RemoveListener()
|
|
|
|
for i = 1, #contentScripts do
|
|
|
|
contentScripts[i].view:RemoveListener()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function GeneralPopup:OnSortingOrderChange()
|
|
|
|
this.sortingOrder = self.sortingOrder
|
|
|
|
end
|
|
|
|
|
2020-05-25 19:16:23 +08:00
|
|
|
function GeneralPopup:OnOpen(popupType,...)
|
|
|
|
-- local args={...}
|
|
|
|
-- popupType=args[1]
|
2020-05-09 13:31:21 +08:00
|
|
|
--根据传入类型打开对应面板
|
|
|
|
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
|
2020-06-03 19:09:01 +08:00
|
|
|
this.Mask:SetActive(index ~= GENERAL_POPUP_TYPE.Onhook)
|
|
|
|
this.BG:SetActive(index ~= GENERAL_POPUP_TYPE.Onhook)
|
2020-05-09 13:31:21 +08:00
|
|
|
contentPrefabs[index].gameObject:SetActive(true)
|
2020-05-25 19:16:23 +08:00
|
|
|
contentScripts[index].view:OnShow(this,...)--1、传入自己 2、传入不定参
|
2020-05-09 13:31:21 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function GeneralPopup:OnShow()
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
function GeneralPopup:OnClose()
|
|
|
|
for i = 1, #contentScripts do
|
|
|
|
contentScripts[i].view:OnClose()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function GeneralPopup:OnDestroy()
|
|
|
|
for i = 1, #contentScripts do
|
|
|
|
contentScripts[i].view:OnDestroy()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return GeneralPopup
|