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

205 lines
12 KiB
Lua

----- 通用弹窗 -----
require("Base/BasePanel")
GeneralPopup = Inherit(BasePanel)
local this=GeneralPopup
--子模块脚本
local contentScripts = {
--回溯
[GENERAL_POPUP_TYPE.ResolveRecall] = {view = require("Modules/Popup/View/GeneralPopup_ResolveRecall"), panelName = "GeneralPopup_ResolveRecall"},
--献祭
[GENERAL_POPUP_TYPE.ResolveDismantle] = {view = require("Modules/Popup/View/GeneralPopup_ResolveDismantle"), panelName = "GeneralPopup_ResolveDismantle"},
--装备合成
[GENERAL_POPUP_TYPE.EquipCompound]= {view=require("Modules/Popup/View/GeneralPopup_EquipCompound"),panelName="GeneralPopup_EquipCompound"},
--公会技能重置返还
[GENERAL_POPUP_TYPE.GuildSkill]= {view=require("Modules/Popup/View/GeneralPopup_GuildSkillReset"),panelName="GeneralPopup_GuildSkillReset"},
--宝物合成
[GENERAL_POPUP_TYPE.TreasureCompound]= {view=require("Modules/Popup/View/GeneralPopup_TreasureCompound"),panelName="GeneralPopup_TreasureCompound"},
--公会援助发送求助碎片
[GENERAL_POPUP_TYPE.GuildAid]= {view=require("Modules/Popup/View/GeneralPopup_GuildAid"),panelName="GeneralPopup_GuildAid"},
--公会援助查看宝箱奖励
[GENERAL_POPUP_TYPE.GuildAidFindBoxReward]= {view=require("Modules/Popup/View/GeneralPopup_GuildAidFindBoxReward"),panelName="GeneralPopup_GuildAidFindBoxReward"},
--点将台抽卡 奖励弹窗
[GENERAL_POPUP_TYPE.RecruitBox]= {view=require("Modules/Popup/View/GeneralPopup_RecruitBox"),panelName="GeneralPopup_RecruitBox"},
--挂机属性提升
[GENERAL_POPUP_TYPE.Onhook]= {view=require("Modules/Popup/View/GeneralPopup_Onhook"),panelName="GeneralPopup_Onhook"},
--试练设置弹窗
[GENERAL_POPUP_TYPE.TrialSetting]={view=require("Modules/Popup/View/GeneralPopup_TrialSetting"),panelName="GeneralPopup_TrialSetting"},
--试练回春散
[GENERAL_POPUP_TYPE.TrialXingYao]={view=require("Modules/Popup/View/GeneralPopup_TrialXingYao"),panelName="GeneralPopup_TrialXingYao"},
--试练增益
[GENERAL_POPUP_TYPE.TrialGain]={view=require("Modules/Popup/View/GeneralPopup_TrialGain"),panelName="GeneralPopup_TrialGain"},
--大闹天宫 回复 和 复活节点
[GENERAL_POPUP_TYPE.ExpeditionReply]={view=require("Modules/Popup/View/GeneralPopup_ExpeditionReply"),panelName="GeneralPopup_ExpeditionReply"},
--试炼副本进入下一层
[GENERAL_POPUP_TYPE.TrialToNextFloor]={view=require("Modules/Popup/View/GeneralPopup_TrialToNextFloor"),panelName="GeneralPopup_TrialToNextFloor"},
--宝物分解
[GENERAL_POPUP_TYPE.ResolveEquipTreasure] = {view = require("Modules/Popup/View/GeneralPopup_ResolveEquipTreasure"), panelName = "GeneralPopup_ResolveEquipTreasure"},
--装备批量出售
[GENERAL_POPUP_TYPE.EquipBatchSell] = {view = require("Modules/Popup/View/GeneralPopup_EquipBatchSell"), panelName = "GeneralPopup_EquipBatchSell"},
--装备单种出售 拉条
[GENERAL_POPUP_TYPE.EquipSingleSell] = {view = require("Modules/Popup/View/GeneralPopup_EquipSingleSell"), panelName = "GeneralPopup_EquipSingleSell"},
--森罗次元炸弹
[GENERAL_POPUP_TYPE.TrialBomb] = {view = require("Modules/Popup/View/GeneralPopup_TrialBomb"), panelName = "GeneralPopup_TrialBomb"},
--神将召唤、限时召唤、乾坤宝盒 二次确认界面
[GENERAL_POPUP_TYPE.RecruitConfirm] = {view = require("Modules/Popup/View/GeneralPopup_RecruitConfirm"), panelName = "GeneralPopup_RecruitConfirm"},
--法宝回归
[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"},
--灵兽战力加成
[GENERAL_POPUP_TYPE.PokemonUpZhenAddPro] = {view = require("Modules/Popup/View/GeneralPopup_PokemonUpZhenAddPro"), panelName = "GeneralPopup_PokemonUpZhenAddPro"},
--灵兽涅槃
[GENERAL_POPUP_TYPE.PokemonResolve] = {view = require("Modules/Popup/View/GeneralPopup_PokemonResolve"), panelName = "GeneralPopup_PokemonResolve"},
--灵兽还原
[GENERAL_POPUP_TYPE.PokemonRestore] = {view = require("Modules/Popup/View/GeneralPopup_PokemonRestore"), panelName = "GeneralPopup_PokemonRestore"},
--灵兽碎片合成
[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"},
--社稷大典检查是否加入工会
[GENERAL_POPUP_TYPE.SheJiCheckGuild] = {view = require("Modules/Popup/View/GeneralPopup_SheJiCheckGuild"), panelName = "GeneralPopup_SheJiCheckGuild"},
--YiJingBaoKuConfirm
[GENERAL_POPUP_TYPE.YiJingBaoKuConfirm] = {view = require("Modules/Popup/View/GeneralPopup_YiJingBaoKuConfirm"), panelName = "GeneralPopup_YiJingBaoKuConfirm"},
--灵兽宝阁选择神兽
[GENERAL_POPUP_TYPE.LingShouBaoGe] = {view = require("Modules/Popup/View/GeneralPopup_LingShouBaoGe"), panelName = "GeneralPopup_LingShouBaoGe"},
--云游商人选择装备
[GENERAL_POPUP_TYPE.YunYouMan] = {view = require("Modules/Popup/View/GeneralPopup_YunYouMan"), panelName = "GeneralPopup_YunYouMan"},
--招募奖励详情
[GENERAL_POPUP_TYPE.RecrutReward] = {view = require("Modules/Popup/View/GeneralPopup_RecruitReward"), panelName = "GeneralPopup_RecruitReward"},
--限时抽卡选择up英雄
[GENERAL_POPUP_TYPE.WuJinSetting] = {view = require("Modules/Popup/View/GeneralPopup_EndlessPanel"), panelName = "GeneralPopup_EndlessPanel"},
--up魂印
[GENERAL_POPUP_TYPE.ChooseUpSoul] = {view = require("Modules/Popup/View/GeneralPopup_ChooseUpSoul"), panelName = "GeneralPopup_ChooseUpSoul"},
--新增的心愿神将提示框
[GENERAL_POPUP_TYPE.NewAddWishHero] = {view = require("Modules/Popup/View/GeneralPopup_NewAddWishHero"), panelName = "GeneralPopup_NewAddWishHero"},
--七界试炼单个遗物
[GENERAL_POPUP_TYPE.QiJieSingleTreasure] = {view = require("Modules/Popup/View/GeneralPopup_QiJieSingleTreasure"), panelName = "GeneralPopup_QiJieSingleTreasure"},
--四灵试炼回放
[GENERAL_POPUP_TYPE.FourElementReturnLook] = {view = require("Modules/Popup/View/GeneralPopup_FightReturnLookFourEle"), panelName = "GeneralPopup_FightReturnLookFourEle"},
--御剑行竞猜界面
[GENERAL_POPUP_TYPE.YuJianXingRecord] = {view = require("Modules/Popup/View/GeneralPopup_YuJianXingRecord"), panelName = "GeneralPopup_YuJianXingRecord"},
--御剑行竞猜调整数量界面
[GENERAL_POPUP_TYPE.YuJianXingBetSelectNum] = {view = require("Modules/Popup/View/GeneralPopup_YuJianXingBetSelectNum"), panelName = "GeneralPopup_YuJianXingBetSelectNum"},
--灵脉跳转界面
[GENERAL_POPUP_TYPE.LingMaiJump] = {view = require("Modules/Popup/View/GeneralPopup_LingMaiJump"), panelName = "GeneralPopup_LingMaiJump"},
--灵脉跳转界面
[GENERAL_POPUP_TYPE.SelectExploreTime] = {view = require("Modules/Popup/View/GeneralPopup_SelectExploreTime"), panelName = "GeneralPopup_SelectExploreTime"},
--命石一键合成
[GENERAL_POPUP_TYPE.GemOneKey] = {view = require("Modules/Popup/View/GeneralPopup_GemOneKey"), panelName = "GeneralPopup_GemOneKey"},
--命石批量合成
[GENERAL_POPUP_TYPE.GemMoreCom] = {view = require("Modules/Popup/View/GeneralPopup_GemMoreCom"), panelName = "GeneralPopup_GemMoreCom"},
--英雄回退
[GENERAL_POPUP_TYPE.ResolveReStar] = {view = require("Modules/Popup/View/GeneralPopup_ResolveReStar"), panelName = "GeneralPopup_ResolveReStar"},
--家园装备升级
--[GENERAL_POPUP_TYPE.HomeLandEquip] = {view = require("Modules/Popup/View/GeneralPopup_HomeLandEquip"), panelName = "GeneralPopup_HomeLandEquip"},
--改变英雄阵营
[GENERAL_POPUP_TYPE.ChangeHeroPro] = {view = require("Modules/Popup/View/GeneralPopup_ChangeHeroPro"), panelName = "GeneralPopup_ChangeHeroPro"},
--改变英雄阵营确认界面
--[GENERAL_POPUP_TYPE.ChangeHeroProConfirm] = {view = require("Modules/Popup/View/GeneralPopup_ChangeHeroProConfirm"), panelName = "GeneralPopup_ChangeHeroProConfirm"},
[GENERAL_POPUP_TYPE.BuyShanHeSheJiTuGetRewardTimes] = {view = require("Modules/Popup/View/GeneralPopup_BuyShanHeSheJiTuGetRewardTimes"), panelName = "GeneralPopup_BuyShanHeSheJiTuGetRewardTimes"},
}
--子模块预设
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 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 GeneralPopup: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 GeneralPopup:AddListener()
for key, value in pairs(contentScripts) do
value.view:AddListener()
end
end
function GeneralPopup:RemoveListener()
for key, value in pairs(contentScripts) do
value.view:RemoveListener()
end
end
function GeneralPopup:OnSortingOrderChange()
this.sortingOrder = self.sortingOrder
end
local onOpenArgs--临时接的参数 需要onshow刷新的调用
function GeneralPopup:OnOpen(popupType,...)
onOpenArgs = ...
--根据传入类型打开对应面板
--LogGreen("显示的类型 = "..popupType)
for key, value in pairs(contentScripts) do
if popupType == key then
index = key
break
end
end
for key, value in pairs(contentPrefabs) do
value.gameObject:SetActive(false)
end
this.Mask:SetActive(popupType ~= GENERAL_POPUP_TYPE.Onhook)
this.BG:SetActive(popupType ~= GENERAL_POPUP_TYPE.Onhook and popupType ~= GENERAL_POPUP_TYPE.ChooseUpSoul)
contentPrefabs[popupType].gameObject:SetActive(true)
contentScripts[popupType].view:OnShow(this,...)--1、传入自己 2、传入不定参
end
function GeneralPopup:OnShow()
if index == GENERAL_POPUP_TYPE.RecruitBox then--临时接的参数 需要onshow刷新的调用
if onOpenArgs then
contentScripts[index].view:OnShow(this,unpack(onOpenArgs, 1, table.maxn(onOpenArgs)))
else
contentScripts[index].view:OnShow(this)
end
end
this.backBtn:SetActive(index ~= GENERAL_POPUP_TYPE.SheJiCheckGuild)
end
function GeneralPopup:OnClose()
for key, value in pairs(contentScripts) do
value.view:OnClose()
end
end
function GeneralPopup:OnDestroy()
this.spLoader:Destroy()
for key, value in pairs(contentScripts) do
value.view:OnDestroy()
end
end
return GeneralPopup