165 lines
8.8 KiB
Lua
165 lines
8.8 KiB
Lua
----- 通用弹窗 -----
|
|
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},
|
|
--宝物合成
|
|
[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},
|
|
--点将台抽卡 奖励弹窗
|
|
[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},
|
|
--试练增益
|
|
[12]={view=require("Modules/Popup/View/GeneralPopup_TrialGain"),panelName="GeneralPopup_TrialGain",type=GENERAL_POPUP_TYPE.TrialGain},
|
|
--大闹天宫 回复 和 复活节点
|
|
[13]={view=require("Modules/Popup/View/GeneralPopup_ExpeditionReply"),panelName="GeneralPopup_ExpeditionReply",type=GENERAL_POPUP_TYPE.ExpeditionReply},
|
|
--试炼副本进入下一层
|
|
[14]={view=require("Modules/Popup/View/GeneralPopup_TrialToNextFloor"),panelName="GeneralPopup_TrialToNextFloor",type=GENERAL_POPUP_TYPE.TrialToNextFloor},
|
|
--宝物分解
|
|
[15] = {view = require("Modules/Popup/View/GeneralPopup_ResolveEquipTreasure"), panelName = "GeneralPopup_ResolveEquipTreasure",type=GENERAL_POPUP_TYPE.ResolveEquipTreasure},
|
|
--装备批量出售
|
|
[16] = {view = require("Modules/Popup/View/GeneralPopup_EquipBatchSell"), panelName = "GeneralPopup_EquipBatchSell",type=GENERAL_POPUP_TYPE.EquipBatchSell},
|
|
--装备单种出售 拉条
|
|
[17] = {view = require("Modules/Popup/View/GeneralPopup_EquipSingleSell"), panelName = "GeneralPopup_EquipSingleSell",type=GENERAL_POPUP_TYPE.EquipSingleSell},
|
|
--森罗次元炸弹
|
|
[18] = {view = require("Modules/Popup/View/GeneralPopup_TrialBomb"), panelName = "GeneralPopup_TrialBomb",type=GENERAL_POPUP_TYPE.TrialBomb},
|
|
--神将召唤、限时召唤、乾坤宝盒 二次确认界面
|
|
[19] = {view = require("Modules/Popup/View/GeneralPopup_RecruitConfirm"), panelName = "GeneralPopup_RecruitConfirm",type=GENERAL_POPUP_TYPE.RecruitConfirm},
|
|
--法宝回归
|
|
[20] = {view = require("Modules/Popup/View/GeneralPopup_TalismanResolve"), panelName = "GeneralPopup_TalismanResolve",type=GENERAL_POPUP_TYPE.TalismanResolve},
|
|
[21] = {view = require("Modules/Popup/View/GeneralPopup_BuyXuanYuanMirrorTims"), panelName = "GeneralPopup_BuyXuanYuanMirrorTims",type=GENERAL_POPUP_TYPE.XuanYuanBuyTimes},
|
|
[22] = {view = require("Modules/Popup/View/GeneralPopup_QinglongSerectTreasureBuyLevel"), panelName = "GeneralPopup_QinglongSerectTreasureBuyLevel",type=GENERAL_POPUP_TYPE.QinglongSerectTreasureBuyLevel},
|
|
[23] = {view = require("Modules/Popup/View/GeneralPopup_HeavenUnlockExtraRewardPanel"), panelName = "GeneralPopup_HeavenUnlockExtraRewardPanel",type=GENERAL_POPUP_TYPE.HeavenUnlockExtraRewardPanel},
|
|
--灵兽战力加成
|
|
[25] = {view = require("Modules/Popup/View/GeneralPopup_PokemonUpZhenAddPro"), panelName = "GeneralPopup_PokemonUpZhenAddPro",type=GENERAL_POPUP_TYPE.PokemonUpZhenAddPro},
|
|
--灵兽涅槃
|
|
[26] = {view = require("Modules/Popup/View/GeneralPopup_PokemonResolve"), panelName = "GeneralPopup_PokemonResolve",type=GENERAL_POPUP_TYPE.PokemonResolve},
|
|
--灵兽还原
|
|
[27] = {view = require("Modules/Popup/View/GeneralPopup_PokemonRestore"), panelName = "GeneralPopup_PokemonRestore",type=GENERAL_POPUP_TYPE.PokemonRestore},
|
|
--灵兽碎片合成
|
|
[28]={view = require("Modules/Popup/View/GeneralPopup_PokemonChipCompound"), panelName = "GeneralPopup_PokemonChipCompound",type=GENERAL_POPUP_TYPE.PokemonCompound},
|
|
[24] = {view = require("Modules/Popup/View/GeneralPopup_XiaoYaoYouItemExchange"), panelName = "GeneralPopup_XiaoYaoYouItemExchange",type=GENERAL_POPUP_TYPE.XiaoYaoYouItemExchange},
|
|
--社稷大典检查是否加入工会
|
|
[29] = {view = require("Modules/Popup/View/GeneralPopup_SheJiCheckGuild"), panelName = "GeneralPopup_SheJiCheckGuild",type=GENERAL_POPUP_TYPE.SheJiCheckGuild},
|
|
--YiJingBaoKuConfirm
|
|
[30] = {view = require("Modules/Popup/View/GeneralPopup_YiJingBaoKuConfirm"), panelName = "GeneralPopup_YiJingBaoKuConfirm",type=GENERAL_POPUP_TYPE.YiJingBaoKuConfirm},
|
|
--灵兽宝阁选择神兽
|
|
[31] = {view = require("Modules/Popup/View/GeneralPopup_LingShouBaoGe"), panelName = "GeneralPopup_LingShouBaoGe",type=GENERAL_POPUP_TYPE.LingShouBaoGe},
|
|
--云游商人选择装备
|
|
[32] = {view = require("Modules/Popup/View/GeneralPopup_YunYouMan"), panelName = "GeneralPopup_YunYouMan",type=GENERAL_POPUP_TYPE.YunYouMan},
|
|
--招募奖励详情
|
|
[33] = {view = require("Modules/Popup/View/GeneralPopup_RecruitReward"), panelName = "GeneralPopup_RecruitReward",type=GENERAL_POPUP_TYPE.RecrutReward},
|
|
}
|
|
--子模块预设
|
|
local contentPrefabs={}
|
|
--打开弹窗类型
|
|
local popupType
|
|
--打开弹窗索引
|
|
local index=0
|
|
|
|
|
|
function GeneralPopup: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")
|
|
|
|
--子模块脚本初始化
|
|
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()
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.Bag.OnTempBagChanged)
|
|
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
|
|
local onOpenArgs--临时接的参数 需要onshow刷新的调用
|
|
function GeneralPopup:OnOpen(popupType,...)
|
|
-- local args={...}
|
|
-- popupType=args[1]
|
|
onOpenArgs = ...
|
|
--根据传入类型打开对应面板
|
|
--LogGreen("显示的类型 = "..popupType)
|
|
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
|
|
this.Mask:SetActive(index ~= GENERAL_POPUP_TYPE.Onhook)
|
|
this.BG:SetActive(index ~= GENERAL_POPUP_TYPE.Onhook)
|
|
|
|
contentPrefabs[index].gameObject:SetActive(true)
|
|
contentScripts[index].view:OnShow(this,...)--1、传入自己 2、传入不定参
|
|
end
|
|
|
|
function GeneralPopup:OnShow()
|
|
if index == 8 then--临时接的参数 需要onshow刷新的调用
|
|
contentScripts[index].view:OnShow(this,onOpenArgs)
|
|
end
|
|
this.backBtn:SetActive(index ~= 29)
|
|
end
|
|
|
|
function GeneralPopup:OnClose()
|
|
for i = 1, #contentScripts do
|
|
contentScripts[i].view:OnClose()
|
|
end
|
|
end
|
|
|
|
function GeneralPopup:OnDestroy()
|
|
this.spLoader:Destroy()
|
|
for i = 1, #contentScripts do
|
|
contentScripts[i].view:OnDestroy()
|
|
end
|
|
end
|
|
|
|
return GeneralPopup |