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

148 lines
7.2 KiB
Lua
Raw Normal View History

2020-08-25 15:46:38 +08:00
----- 通用弹窗 -----
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-06-08 20:18:49 +08:00
--试练增益
[12]={view=require("Modules/Popup/View/GeneralPopup_TrialGain"),panelName="GeneralPopup_TrialGain",type=GENERAL_POPUP_TYPE.TrialGain},
2020-06-18 20:39:29 +08:00
--大闹天宫 回复 和 复活节点
2020-06-19 20:19:35 +08:00
[13]={view=require("Modules/Popup/View/GeneralPopup_ExpeditionReply"),panelName="GeneralPopup_ExpeditionReply",type=GENERAL_POPUP_TYPE.ExpeditionReply},
2020-06-30 18:59:44 +08:00
--试炼副本进入下一层
[14]={view=require("Modules/Popup/View/GeneralPopup_TrialToNextFloor"),panelName="GeneralPopup_TrialToNextFloor",type=GENERAL_POPUP_TYPE.TrialToNextFloor},
2020-07-06 16:27:27 +08:00
--宝物分解
2020-07-06 19:11:15 +08:00
[15] = {view = require("Modules/Popup/View/GeneralPopup_ResolveEquipTreasure"), panelName = "GeneralPopup_ResolveEquipTreasure",type=GENERAL_POPUP_TYPE.ResolveEquipTreasure},
2020-07-10 18:29:38 +08:00
--装备批量出售
[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},
2020-07-14 21:03:44 +08:00
--森罗次元炸弹
[18] = {view = require("Modules/Popup/View/GeneralPopup_TrialBomb"), panelName = "GeneralPopup_TrialBomb",type=GENERAL_POPUP_TYPE.TrialBomb},
2020-07-28 15:24:11 +08:00
--神将召唤、限时召唤、乾坤宝盒 二次确认界面
[19] = {view = require("Modules/Popup/View/GeneralPopup_RecruitConfirm"), panelName = "GeneralPopup_RecruitConfirm",type=GENERAL_POPUP_TYPE.RecruitConfirm},
2020-08-07 12:22:10 +08:00
--法宝回归
[20] = {view = require("Modules/Popup/View/GeneralPopup_TalismanResolve"), panelName = "GeneralPopup_TalismanResolve",type=GENERAL_POPUP_TYPE.TalismanResolve},
2020-08-12 19:17:05 +08:00
[21] = {view = require("Modules/Popup/View/GeneralPopup_BuyXuanYuanMirrorTims"), panelName = "GeneralPopup_BuyXuanYuanMirrorTims",type=GENERAL_POPUP_TYPE.XuanYuanBuyTimes},
2020-08-19 10:05:01 +08:00
[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},
2020-10-24 18:49:32 +08:00
[24] = {view = require("Modules/Popup/View/GeneralPopup_XiaoYaoYouItemExchange"), panelName = "GeneralPopup_XiaoYaoYouItemExchange",type=GENERAL_POPUP_TYPE.XiaoYaoYouItemExchange},
--社稷大典公会检查
[25] = {view = require("Modules/Popup/View/GeneralPopup_SheJiCheckGuild"), panelName = "GeneralPopup_SheJiCheckGuild",type=GENERAL_POPUP_TYPE.SheJiCheckGuild},
2020-10-19 23:18:54 +08:00
}
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()
Game.GlobalEvent:DispatchEvent(GameEvent.Bag.OnTempBagChanged)
2020-05-09 13:31:21 +08:00
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-06-19 20:19:35 +08:00
local onOpenArgs--临时接的参数 需要onshow刷新的调用
2020-05-25 19:16:23 +08:00
function GeneralPopup:OnOpen(popupType,...)
-- local args={...}
-- popupType=args[1]
2020-06-19 20:19:35 +08:00
onOpenArgs = ...
2020-05-09 13:31:21 +08:00
--根据传入类型打开对应面板
2020-06-23 18:36:24 +08:00
LogGreen(Language[11561]..popupType)
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-06-19 20:19:35 +08:00
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()
2020-06-19 20:19:35 +08:00
if index == 8 then--临时接的参数 需要onshow刷新的调用
contentScripts[index].view:OnShow(this,onOpenArgs)
end
2020-10-24 18:49:32 +08:00
this.backBtn:SetActive(index ~= 25)
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()
for i = 1, #contentScripts do
contentScripts[i].view:OnDestroy()
end
end
2020-06-23 18:36:24 +08:00
return GeneralPopup