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

205 lines
12 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.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"},
Merge branch 'china/dev' into 0功能/silingshilian # Conflicts: # Assets/ManagedResources/Prefabs/UI/Common/CardRendererRoot.prefab # Assets/ManagedResources/Prefabs/UI/Expedition/ExpeditionMonsterInfoPopup.prefab # Assets/ManagedResources/Prefabs/UI/GeneralPanel/GeneralBigPopup.prefab # Assets/ManagedResources/Prefabs/UI/Popup/GeneralPopup.prefab # Assets/ManagedResources/Prefabs/UI/Popup/RewardItemPopup.prefab # Assets/ManagedResources/Prefabs/UI/Popup/RewardTalismanSingleShowPopup.prefab # Assets/ManagedResources/Prefabs/UI/Popup/RoleInfoPopup.prefab # Assets/ManagedResources/Prefabs/UI/Recruit/RecruitPanel.prefab # Assets/ManagedResources/Prefabs/UI/RoleInfo/RoleEquipPanel.prefab # Assets/ManagedResources/Prefabs/UI/RoleInfo/RoleEquipTreasureChangePopup.prefab # Assets/ManagedResources/RTexture/CardTexture10.renderTexture.meta # Assets/ManagedResources/RTexture/CardTexture11.renderTexture.meta # Assets/ManagedResources/RTexture/CardTexture12.renderTexture.meta # Assets/ManagedResources/RTexture/CardTexture7.renderTexture.meta # Assets/ManagedResources/RTexture/CardTexture8.renderTexture.meta # Assets/ManagedResources/RTexture/CardTexture9.renderTexture.meta # Assets/ManagedResources/~Lua/Common/GlobalDefine.lua # Assets/ManagedResources/~Lua/Data/UIData.lua # Assets/ManagedResources/~Lua/Framework/Manager/CardRendererManager.lua # Assets/ManagedResources/~Lua/Message/CommonProto_pb.lua # Assets/ManagedResources/~Lua/Message/MessageTypeProto_pb.lua # Assets/ManagedResources/~Lua/Message/PlayerInfoProto_pb.lua # Assets/ManagedResources/~Lua/Modules/Carbon/CarbonManager.lua # Assets/ManagedResources/~Lua/Modules/Expedition/ExpeditionMonsterInfoPopup.lua # Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua # Assets/ManagedResources/~Lua/Modules/GeneralPanel/GeneralBigPopup.lua # Assets/ManagedResources/~Lua/Modules/Guide/GuideManager.lua # Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua # Assets/ManagedResources/~Lua/Modules/MonsterCamp/MonsterCampPanel.lua # Assets/ManagedResources/~Lua/Modules/Player/RedpotManager.lua # Assets/ManagedResources/~Lua/Modules/Popup/BattleFailPopup.lua # Assets/ManagedResources/~Lua/Modules/Popup/BattleWinPopup.lua # Assets/ManagedResources/~Lua/Modules/Popup/GeneralPopup.lua # Assets/ManagedResources/~Lua/Modules/RoleInfo/EquipTreasureStrongPopup.lua
2021-08-06 11:15:13 +08:00
--四灵试炼回放
[GENERAL_POPUP_TYPE.FourElementReturnLook] = {view = require("Modules/Popup/View/GeneralPopup_FightReturnLookFourEle"), panelName = "GeneralPopup_FightReturnLookFourEle"},
2021-09-28 10:34:05 +08:00
--御剑行竞猜界面
[GENERAL_POPUP_TYPE.YuJianXingRecord] = {view = require("Modules/Popup/View/GeneralPopup_YuJianXingRecord"), panelName = "GeneralPopup_YuJianXingRecord"},
2021-10-14 09:53:51 +08:00
--御剑行竞猜调整数量界面
[GENERAL_POPUP_TYPE.YuJianXingBetSelectNum] = {view = require("Modules/Popup/View/GeneralPopup_YuJianXingBetSelectNum"), panelName = "GeneralPopup_YuJianXingBetSelectNum"},
2021-11-19 11:45:53 +08:00
--灵脉跳转界面
[GENERAL_POPUP_TYPE.LingMaiJump] = {view = require("Modules/Popup/View/GeneralPopup_LingMaiJump"), panelName = "GeneralPopup_LingMaiJump"},
2021-12-23 13:09:34 +08:00
--灵脉跳转界面
[GENERAL_POPUP_TYPE.SelectExploreTime] = {view = require("Modules/Popup/View/GeneralPopup_SelectExploreTime"), panelName = "GeneralPopup_SelectExploreTime"},
2021-12-09 13:29:16 +08:00
--命石一键合成
[GENERAL_POPUP_TYPE.GemOneKey] = {view = require("Modules/Popup/View/GeneralPopup_GemOneKey"), panelName = "GeneralPopup_GemOneKey"},
2021-12-10 11:01:44 +08:00
--命石批量合成
[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"},
2021-12-29 20:17:45 +08:00
--家园装备升级
2022-09-01 17:30:15 +08:00
--[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"},
}
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)
Util.AddClick(this.Mask,function()
Game.GlobalEvent:DispatchEvent(GameEvent.Bag.OnTempBagChanged)
self:ClosePanel()
end)
2020-05-09 13:31:21 +08:00
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刷新的调用
2022-01-14 18:47:41 +08:00
if onOpenArgs then
contentScripts[index].view:OnShow(this,unpack(onOpenArgs, 1, table.maxn(onOpenArgs)))
else
contentScripts[index].view:OnShow(this)
end
2020-06-19 20:19:35 +08:00
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()
2021-09-28 11:23:50 +08:00
for key, value in pairs(contentScripts) do
value.view:OnClose()
2020-05-09 13:31:21 +08:00
end
end
function GeneralPopup:OnDestroy()
2021-04-22 14:37:16 +08:00
this.spLoader:Destroy()
2021-09-28 11:23:50 +08:00
for key, value in pairs(contentScripts) do
value.view:OnDestroy()
2020-05-09 13:31:21 +08:00
end
end
2020-06-23 18:36:24 +08:00
return GeneralPopup