miduo_client/Assets/ManagedResources/~Lua/Modules/Popup/GeneralPopup.lua

173 lines
9.5 KiB
Lua
Raw Normal View History

2021-04-21 13:12:04 +08:00
----- 通用弹窗 -----
2020-05-09 13:31:21 +08:00
require("Base/BasePanel")
GeneralPopup = Inherit(BasePanel)
local this=GeneralPopup
--子模块脚本
local contentScripts = {
--回溯
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.ResolveRecall] = {view = require("Modules/Popup/View/GeneralPopup_ResolveRecall"), panelName = "GeneralPopup_ResolveRecall"},
2020-05-09 13:31:21 +08:00
--献祭
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.ResolveDismantle] = {view = require("Modules/Popup/View/GeneralPopup_ResolveDismantle"), panelName = "GeneralPopup_ResolveDismantle"},
2020-05-09 13:31:21 +08:00
--装备合成
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.EquipCompound]= {view=require("Modules/Popup/View/GeneralPopup_EquipCompound"),panelName="GeneralPopup_EquipCompound"},
2020-05-09 13:31:21 +08:00
--公会技能重置返还
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.GuildSkill]= {view=require("Modules/Popup/View/GeneralPopup_GuildSkillReset"),panelName="GeneralPopup_GuildSkillReset"},
2020-05-15 16:52:35 +08:00
--宝物合成
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.TreasureCompound]= {view=require("Modules/Popup/View/GeneralPopup_TreasureCompound"),panelName="GeneralPopup_TreasureCompound"},
2020-05-15 16:52:35 +08:00
--公会援助发送求助碎片
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.GuildAid]= {view=require("Modules/Popup/View/GeneralPopup_GuildAid"),panelName="GeneralPopup_GuildAid"},
2020-05-15 16:52:35 +08:00
--公会援助查看宝箱奖励
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.GuildAidFindBoxReward]= {view=require("Modules/Popup/View/GeneralPopup_GuildAidFindBoxReward"),panelName="GeneralPopup_GuildAidFindBoxReward"},
2020-05-25 19:16:23 +08:00
--点将台抽卡 奖励弹窗
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.RecruitBox]= {view=require("Modules/Popup/View/GeneralPopup_RecruitBox"),panelName="GeneralPopup_RecruitBox"},
2020-06-03 19:09:01 +08:00
--挂机属性提升
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.Onhook]= {view=require("Modules/Popup/View/GeneralPopup_Onhook"),panelName="GeneralPopup_Onhook"},
2020-06-03 19:09:01 +08:00
--试练设置弹窗
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.TrialSetting]={view=require("Modules/Popup/View/GeneralPopup_TrialSetting"),panelName="GeneralPopup_TrialSetting"},
2020-06-03 19:09:01 +08:00
--试练回春散
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.TrialXingYao]={view=require("Modules/Popup/View/GeneralPopup_TrialXingYao"),panelName="GeneralPopup_TrialXingYao"},
2020-06-08 20:18:49 +08:00
--试练增益
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.TrialGain]={view=require("Modules/Popup/View/GeneralPopup_TrialGain"),panelName="GeneralPopup_TrialGain"},
2020-06-18 20:39:29 +08:00
--大闹天宫 回复 和 复活节点
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.ExpeditionReply]={view=require("Modules/Popup/View/GeneralPopup_ExpeditionReply"),panelName="GeneralPopup_ExpeditionReply"},
2020-06-30 18:59:44 +08:00
--试炼副本进入下一层
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.TrialToNextFloor]={view=require("Modules/Popup/View/GeneralPopup_TrialToNextFloor"),panelName="GeneralPopup_TrialToNextFloor"},
2020-07-06 16:27:27 +08:00
--宝物分解
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.ResolveEquipTreasure] = {view = require("Modules/Popup/View/GeneralPopup_ResolveEquipTreasure"), panelName = "GeneralPopup_ResolveEquipTreasure"},
2020-07-10 18:29:38 +08:00
--装备批量出售
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.EquipBatchSell] = {view = require("Modules/Popup/View/GeneralPopup_EquipBatchSell"), panelName = "GeneralPopup_EquipBatchSell"},
2020-07-10 18:29:38 +08:00
--装备单种出售 拉条
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.EquipSingleSell] = {view = require("Modules/Popup/View/GeneralPopup_EquipSingleSell"), panelName = "GeneralPopup_EquipSingleSell"},
2020-07-14 21:03:44 +08:00
--森罗次元炸弹
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.TrialBomb] = {view = require("Modules/Popup/View/GeneralPopup_TrialBomb"), panelName = "GeneralPopup_TrialBomb"},
2020-07-28 15:24:11 +08:00
--神将召唤、限时召唤、乾坤宝盒 二次确认界面
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.RecruitConfirm] = {view = require("Modules/Popup/View/GeneralPopup_RecruitConfirm"), panelName = "GeneralPopup_RecruitConfirm"},
2020-08-07 12:22:10 +08:00
--法宝回归
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.TalismanResolve] = {view = require("Modules/Popup/View/GeneralPopup_TalismanResolve"), panelName = "GeneralPopup_TalismanResolve"},
[GENERAL_POPUP_TYPE.XuanYuanBuyTimes] = {view = require("Modules/Popup/View/GeneralPopup_BuyXuanYuanMirrorTims"), panelName = "GeneralPopup_BuyXuanYuanMirrorTims"},
[GENERAL_POPUP_TYPE.QinglongSerectTreasureBuyLevel] = {view = require("Modules/Popup/View/GeneralPopup_QinglongSerectTreasureBuyLevel"), panelName = "GeneralPopup_QinglongSerectTreasureBuyLevel"},
[GENERAL_POPUP_TYPE.HeavenUnlockExtraRewardPanel] = {view = require("Modules/Popup/View/GeneralPopup_HeavenUnlockExtraRewardPanel"), panelName = "GeneralPopup_HeavenUnlockExtraRewardPanel"},
--灵兽战力加成
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.PokemonUpZhenAddPro] = {view = require("Modules/Popup/View/GeneralPopup_PokemonUpZhenAddPro"), panelName = "GeneralPopup_PokemonUpZhenAddPro"},
--灵兽涅槃
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.PokemonResolve] = {view = require("Modules/Popup/View/GeneralPopup_PokemonResolve"), panelName = "GeneralPopup_PokemonResolve"},
--灵兽还原
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.PokemonRestore] = {view = require("Modules/Popup/View/GeneralPopup_PokemonRestore"), panelName = "GeneralPopup_PokemonRestore"},
--灵兽碎片合成
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.PokemonCompound]={view = require("Modules/Popup/View/GeneralPopup_PokemonChipCompound"), panelName = "GeneralPopup_PokemonChipCompound"},
[GENERAL_POPUP_TYPE.XiaoYaoYouItemExchange] = {view = require("Modules/Popup/View/GeneralPopup_XiaoYaoYouItemExchange"), panelName = "GeneralPopup_XiaoYaoYouItemExchange"},
--社稷大典检查是否加入工会
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.SheJiCheckGuild] = {view = require("Modules/Popup/View/GeneralPopup_SheJiCheckGuild"), panelName = "GeneralPopup_SheJiCheckGuild"},
2020-11-05 19:10:20 +08:00
--YiJingBaoKuConfirm
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.YiJingBaoKuConfirm] = {view = require("Modules/Popup/View/GeneralPopup_YiJingBaoKuConfirm"), panelName = "GeneralPopup_YiJingBaoKuConfirm"},
--灵兽宝阁选择神兽
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.LingShouBaoGe] = {view = require("Modules/Popup/View/GeneralPopup_LingShouBaoGe"), panelName = "GeneralPopup_LingShouBaoGe"},
2021-04-19 11:38:35 +08:00
--云游商人选择装备
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.YunYouMan] = {view = require("Modules/Popup/View/GeneralPopup_YunYouMan"), panelName = "GeneralPopup_YunYouMan"},
--招募奖励详情
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.RecrutReward] = {view = require("Modules/Popup/View/GeneralPopup_RecruitReward"), panelName = "GeneralPopup_RecruitReward"},
2021-05-28 10:36:55 +08:00
--限时抽卡选择up英雄
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.ChooseUpHero] = {view = require("Modules/Popup/View/GeneralPopup_ChooseUpHero"), panelName = "GeneralPopup_ChooseUpHero"},
[GENERAL_POPUP_TYPE.WuJinSetting] = {view = require("Modules/Popup/View/GeneralPopup_EndlessPanel"), panelName = "GeneralPopup_EndlessPanel"},
--up魂印
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.ChooseUpSoul] = {view = require("Modules/Popup/View/GeneralPopup_ChooseUpSoul"), panelName = "GeneralPopup_ChooseUpSoul"},
--新增的心愿神将提示框
2021-09-08 10:06:24 +08:00
[GENERAL_POPUP_TYPE.NewAddWishHero] = {view = require("Modules/Popup/View/GeneralPopup_NewAddWishHero"), panelName = "GeneralPopup_NewAddWishHero"},
2021-09-09 11:10:43 +08:00
--七界试炼单个遗物
[GENERAL_POPUP_TYPE.QiJieSingleTreasure] = {view = require("Modules/Popup/View/GeneralPopup_QiJieSingleTreasure"), panelName = "GeneralPopup_QiJieSingleTreasure"},
}
2020-05-09 13:31:21 +08:00
--子模块预设
local contentPrefabs={}
--打开弹窗类型
local popupType
--打开弹窗索引
local index=0
function GeneralPopup:InitComponent()
2021-04-22 14:37:16 +08:00
this.spLoader = SpriteLoader.New()
2020-05-09 13:31:21 +08:00
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
--子模块脚本初始化
2021-09-08 10:06:24 +08:00
for key, value in pairs(contentScripts) do
value.view:InitComponent(Util.GetGameObject(this.contents, value.panelName))
2020-05-09 13:31:21 +08:00
end
--预设赋值
2021-09-08 10:06:24 +08:00
for key, value in pairs(contentScripts) do
contentPrefabs[key]=Util.GetGameObject(this.contents,value.panelName)
2020-05-09 13:31:21 +08:00
end
end
function GeneralPopup:BindEvent()
2021-09-08 10:06:24 +08:00
for key, value in pairs(contentScripts) do
value.view:BindEvent()
2020-05-09 13:31:21 +08:00
end
--返回按钮
Util.AddClick(this.backBtn,function()
Game.GlobalEvent:DispatchEvent(GameEvent.Bag.OnTempBagChanged)
2020-05-09 13:31:21 +08:00
self:ClosePanel()
end)
end
function GeneralPopup:AddListener()
2021-09-08 10:06:24 +08:00
for key, value in pairs(contentScripts) do
value.view:AddListener()
2020-05-09 13:31:21 +08:00
end
end
function GeneralPopup:RemoveListener()
2021-09-08 10:06:24 +08:00
for key, value in pairs(contentScripts) do
value.view:RemoveListener()
2020-05-09 13:31:21 +08:00
end
end
function GeneralPopup:OnSortingOrderChange()
this.sortingOrder = self.sortingOrder
end
2020-06-19 20:19:35 +08:00
local onOpenArgs--临时接的参数 需要onshow刷新的调用
2020-05-25 19:16:23 +08:00
function GeneralPopup:OnOpen(popupType,...)
2020-06-19 20:19:35 +08:00
onOpenArgs = ...
2020-05-09 13:31:21 +08:00
--根据传入类型打开对应面板
--LogGreen("显示的类型 = "..popupType)
2021-09-08 10:06:24 +08:00
for key, value in pairs(contentScripts) do
if popupType == key then
index = key
2020-05-09 13:31:21 +08:00
break
end
end
2021-09-08 10:06:24 +08:00
for key, value in pairs(contentPrefabs) do
value.gameObject:SetActive(false)
2020-05-09 13:31:21 +08:00
end
2021-09-08 10:06:24 +08:00
this.Mask:SetActive(popupType ~= GENERAL_POPUP_TYPE.Onhook)
this.BG:SetActive(popupType ~= GENERAL_POPUP_TYPE.Onhook and popupType ~= GENERAL_POPUP_TYPE.ChooseUpSoul)
2020-06-19 20:19:35 +08:00
2021-09-08 10:06:24 +08:00
contentPrefabs[popupType].gameObject:SetActive(true)
contentScripts[popupType].view:OnShow(this,...)--1、传入自己 2、传入不定参
2020-05-09 13:31:21 +08:00
end
function GeneralPopup:OnShow()
2021-09-08 10:06:24 +08:00
if index == GENERAL_POPUP_TYPE.RecruitBox then--临时接的参数 需要onshow刷新的调用
2020-06-19 20:19:35 +08:00
contentScripts[index].view:OnShow(this,onOpenArgs)
end
2021-09-08 10:06:24 +08:00
this.backBtn:SetActive(index ~= GENERAL_POPUP_TYPE.SheJiCheckGuild)
2020-05-09 13:31:21 +08:00
end
function GeneralPopup:OnClose()
for i = 1, #contentScripts do
contentScripts[i].view:OnClose()
end
end
function GeneralPopup:OnDestroy()
2021-04-22 14:37:16 +08:00
this.spLoader:Destroy()
2020-05-09 13:31:21 +08:00
for i = 1, #contentScripts do
contentScripts[i].view:OnDestroy()
end
end
2020-06-23 18:36:24 +08:00
return GeneralPopup