miduo_client/Assets/ManagedResources/~Lua/Modules/Player/JumpManager.lua

466 lines
19 KiB
Lua

JumpManager = {};
local this = JumpManager
local JumpConfig=ConfigManager.GetConfig(ConfigName.JumpConfig)
function this.Initialize()
end
local jumpDic = {
[JumpType.Lottery] = function(data)--招募
local openPanle = UIManager.OpenPanel(UIName.RecruitPanel)
if openPanle and data then
openPanle.ShowGuideGo(data[1])
end
end,
[JumpType.Team] = function()--编队
UIManager.OpenPanel(UIName.FormationPanel, FORMATION_TYPE.MAIN)
end,
[JumpType.DifferDemons] = function()--异妖
UIManager.OpenPanel(UIName.DiffMonsterPanel)
end,
[JumpType.Guild] = function()--公会
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.GUILD) then
if PlayerManager.familyId == 0 then
UIManager.OpenPanel(UIName.GuildFindPopup)
else
-- 进入公会界面之前初始化一遍数据
MyGuildManager.InitAllData(function()
UIManager.OpenPanel(UIName.GuildMainCityPanel)
end)
end
else
PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.GUILD))
end
end,
[JumpType.WorkShop] = function()--锻造
UIManager.OpenPanel(UIName.WorkShowTechnologPanel)
end,
[JumpType.Foods] = function()--百味居
UIManager.OpenPanel(UIName.FoodShopMainPanel)
end,
[JumpType.Adventure] = function(data)--秘境
local openPanle = UIManager.OpenPanel(UIName.AdventureMainPanel)
if openPanle and data and data[1] < 0 then
--引导光圈 -1 时再极速探索显示按钮
openPanle.ShowGuideGo()
end
end,
[JumpType.Arena] = function(data)--竞技场
local arenaDefend = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_ARENA_DEFEND)
local arenaAttack = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_ARENA_ATTACK)
--首次进入竞技场 将主线编队复制到竞技场防守、进攻编队
if #arenaAttack.teamHeroInfos==0 then
-- LogColor("red","竞技进攻编队为空")
local formation = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_NORMAL)
local newFormation = {}
for index = 1, #formation.teamHeroInfos do
local teamInfo = formation.teamHeroInfos[index]
local singleData = {}
singleData.heroId = teamInfo.heroId
singleData.position = index
table.insert(newFormation, singleData)
end
FormationManager.RefreshFormation(FormationTypeDef.FORMATION_ARENA_ATTACK,newFormation,formation.teamPokemonInfos)
end
if #arenaDefend.teamHeroInfos == 0 then
-- LogColor("red","竞技防守编队为空")
local formation = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_NORMAL)
local newFormation = {}
for index = 1, #formation.teamHeroInfos do
local teamInfo = formation.teamHeroInfos[index]
local singleData = {}
singleData.heroId = teamInfo.heroId
singleData.position = index
table.insert(newFormation, singleData)
end
FormationManager.RefreshFormation(FormationTypeDef.FORMATION_ARENA_DEFEND,newFormation,formation.teamPokemonInfos)
-- UIManager.OpenPanel(UIName.FormationPanel, FORMATION_TYPE.ARENA_DEFEND)
-- PopupTipPanel.ShowTip("请先设置防守阵容")
-- return
end
local openPanle = UIManager.OpenPanel(UIName.ArenaMainPanel)
if openPanle and data and data[1] then
--引导光圈 -1 时 第一个挑战
if data[1] < 0 then
openPanle.ShowGuideGo()
end
end
end,
[JumpType.HanYuan] = function()--汉元之境
PopupTipPanel.ShowTip("功能未开启")
end,
[JumpType.WangHun] = function()--亡魂之海
PopupTipPanel.ShowTip("功能未开启")
end,
--暂不开放
--[JumpType.MultipleChallenge] = function(data)--综合副本
-- CarbonManager.difficulty=data[1]
-- UIManager.OpenPanel(UIName.CarbonPanel,data[1])
--end,
[JumpType.DailyTasks] = function()--每日任务
local openPanle = UIManager.OpenPanel(UIName.MissionDailyPanel)
if openPanle then
--引导光圈 第一个领取显示
openPanle.ShowGuideGo()
end
end,
[JumpType.WorldBoss] = function()--世界boss
PopupTipPanel.ShowTip("功能未开启")
end,
[JumpType.Talking] = function()--聊天
UIName.UIManager.OpenPanel(UIName.ChatPanel)
end,
[JumpType.LoginReward] = function(data)--七日登陆
--local openPanle =UIManager.OpenPanel(UIName.CourtesyDressPanel,data[1])
--if openPanle then
-- openPanle.ShowGuideGo(data[1])
--end
UIManager.OpenPanel(UIName.ExpertPanel,1)
end,
[JumpType.OnlineReward] = function(data)--在线奖励
--local openPanle
--openPanle = UIManager.OpenPanel(UIName.FightPointPassMainPanel)
--if openPanle then
-- openPanle.ShowGuideGo(data[1])
--end
if data then
UIManager.OpenPanel(UIName.CourtesyDressPanel,ActivityTypeDef.OnlineGift)
end
end,
[JumpType.CommonChallenge] = function(data)--剧情副本
local jumpCarbonId = CarbonManager.NeedLockId(data[2],1)
local openPanle
if jumpCarbonId then
if jumpCarbonId == data[2] or data[2] == -1 then
CarbonManager.difficulty=data[1]
openPanle = UIManager.OpenPanel(UIName.PlotCarbonPanel,jumpCarbonId)
if openPanle then
openPanle.ShowGuideGo(jumpCarbonId)
end
else
MsgPanel.ShowTwo("该副本暂未开放,是否跳转到最新开放的副本。", nil, function ()
CarbonManager.difficulty=data[1]
openPanle = UIManager.OpenPanel(UIName.PlotCarbonPanel,jumpCarbonId)
if openPanle then
openPanle.ShowGuideGo(jumpCarbonId)
end
end)
end
else
PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(JumpType.CommonChallenge))
end
end,
[JumpType.HeroChallenge] = function(data)--精英副本
local jumpCarbonId = CarbonManager.NeedLockId(data[2],3,math.floor(data[2]/10))
local openPanle
if jumpCarbonId then
if jumpCarbonId == data[2] or data[2] == -1 then
CarbonManager.difficulty=data[1]
Log("jumpManager jumpCarbonId "..jumpCarbonId)
openPanle = UIManager.OpenPanel(UIName.EliteCarbonPanel,jumpCarbonId)
if openPanle then
openPanle.JumpChooseRefresh(jumpCarbonId)
openPanle.ShowGuideGo(jumpCarbonId)
end
else
MsgPanel.ShowTwo("该副本暂未开放,是否跳转到最新开放的副本。", nil, function ()
CarbonManager.difficulty=data[1]
openPanle = UIManager.OpenPanel(UIName.EliteCarbonPanel,jumpCarbonId)
if openPanle then
openPanle.JumpChooseRefresh(jumpCarbonId)
openPanle.ShowGuideGo(jumpCarbonId)
end
end)
end
else
PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(JumpType.HeroChallenge))
end
end,
[JumpType.ChapterReward] = function(data)--章节奖励
--local openPanle
--openPanle = UIManager.OpenPanel(UIName.FightPointPassMainPanel)
--if openPanle then
-- openPanle.ShowGuideGo(data[1])
--end
if data then
UIManager.OpenPanel(UIName.CourtesyDressPanel,ActivityTypeDef.ChapterAward)
end
end,
[JumpType.Store] = function(data)--商店
local isActive, tips = ShopManager.IsActive(data[1])
if not isActive then
PopupTipPanel.ShowTip(tips or "商店未开启")
return
end
UIManager.OpenPanel(UIName.MainShopPanel,data[1])
end,
[JumpType.DifferDemonsBox] = function(data)--秘盒
local openPanle = UIManager.OpenPanel(UIName.SecretBoxPanel)
if openPanle and data and data[1] then
--引导光圈 单抽
openPanle.ShowGuideGo()
end
end,
[JumpType.MemberCamp] = function()--成员
HeroManager.heroListPanelSortID = 1
HeroManager.heroListPanelProID = 0
UIManager.OpenPanel(UIName.RoleListPanel)
end,
[JumpType.StoreHouse] = function(data)--仓库
if data then
local openPanle = UIManager.OpenPanel(UIName.BagPanel,data[1])
if openPanle then
--引导光圈 可合成碎片第一个
openPanle.ShowGuideGo()
end
else
UIManager.OpenPanel(UIName.BagPanel)
end
end,
[JumpType.Resolve] = function(data)--二维数组 1回溯献祭 2 英雄 装备 法宝分解
if data then
if data[1] == 1 then
UIManager.OpenPanel(UIName.ResolvePanel,data[2])
elseif data[1] == 2 then
UIManager.OpenPanel(UIName.HeroAndEquipResolvePanel,data[2])
end
end
end,
[JumpType.Friend] = function(data)--好友
UIManager.OpenPanel(UIName.GoodFriendMainPanel,nil,data[1])
end,
[JumpType.Level] = function(data)--关卡
local openPanle
openPanle = UIManager.OpenPanel(UIName.FightPointPassMainPanel)
if openPanle then
openPanle.ShowGuideGo(data[1])
end
end,
[JumpType.RechargeStore] = function(data)--充值商店
--PopupTipPanel.ShowTip("商店未开启")
-- UIManager.OpenPanel(UIName.MainShopPanel,data[1])
UIManager.OpenPanel(UIName.MainRechargePanel, 1)
end,
[JumpType.DatTask] = function(data)--日常任务
local openPanle = UIManager.OpenPanel(UIName.MissionDailyPanel)
if openPanle then
--引导光圈 第一个领取显示
openPanle.ShowGuideGo()
end
end,
--[JumpType.Talent] = function(data)--天赋
-- local openPanle = UIManager.OpenPanel(UIName.TalentPanel,{})
-- if openPanle then
-- --引导光圈 注入按钮
-- openPanle.ShowGuideGo()
-- end
--end,
[JumpType.Trial] = function(data)--试炼
CarbonManager.difficulty = 2
UIManager.OpenPanel(UIName.TrialCarbonPanel)
end,
[JumpType.BuyVigor] = function(data)--体力购买
UIManager.OpenPanel(UIName.QuickPurchasePanel, { type = UpViewRechargeType.Energy })
end,
[JumpType.BuyGold] = function(data)--金币购买
UIManager.OpenPanel(UIName.QuickPurchasePanel, { type = UpViewRechargeType.Gold })
end,
[JumpType.ElementDrawCard] = function(data)--元素招募
UIManager.OpenPanel(UIName.ElementDrawCardPanel)
end,
[JumpType.Pray] = function(data)--云梦
if ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.Pray) then
UIManager.OpenPanel(UIName.PrayMainPanel)
else
PopupTipPanel.ShowTip("活动未开启")
end
end,
[JumpType.recharge] = function(data)--充值
UIManager.OpenPanel(UIName.MainRechargePanel, data[1])
end,
[JumpType.Welfare] = function(data)--福利
UIManager.OpenPanel(UIName.OperatingPanel,{tabIndex = data[1],extraParam = data[2] })
end,
[JumpType.Expert] = function(data)--限时活动
if data and data[1] then
if data[1] == ExperType.ExChange then--限时兑换
local LimitExchange = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.LimitExchange)
if LimitExchange then
if LimitExchange.endTime - GetTimeStamp() > 0 then
UIManager.OpenPanel(UIName.ExpertPanel,data[1])
else
PopupTipPanel.ShowTip("活动未开启")
end
else
PopupTipPanel.ShowTip("活动未开启")
end
else
UIManager.OpenPanel(UIName.ExpertPanel,data[1])
end
end
end,
[JumpType.Privilege] = function(data)--特权
local openPanle = UIManager.OpenPanel(UIName.VipPanel)
if openPanle and data and data[1] < 0 then
--引导光圈 -1 下边条目领取按钮
openPanle.ShowGuideGo()
end
end,
[JumpType.HeroUpLv] = function(data)--特定妖灵师升级(新手专用)
if data and data[1] > 0 then
local heroData = HeroManager.GetHeroDataByHeroSIdAndMinSortId(data[1])
if heroData and heroData.id then
local openPanle = UIManager.OpenPanel(UIName.RoleInfoPanel, heroData, HeroManager.GetAllHeroDatas(),true)
if openPanle then
openPanle.ShowGuideGo(1)
end
end
else
local formationList = FormationManager.GetFormationByID(1)
if formationList.teamHeroInfos[1] then
local heroData = HeroManager.GetSingleHeroData(formationList.teamHeroInfos[1].heroId)
local openPanle = UIManager.OpenPanel(UIName.RoleInfoPanel, heroData, HeroManager.GetAllHeroDatas(),true)
if openPanle then
openPanle.ShowGuideGo(1)
end
end
end
end,
[JumpType.HeroUpStar] = function(data)--特定妖灵师升星(新手专用)
Log("data[1] "..data[1])
local heroData = HeroManager.GetHeroDataByHeroSIdAndMinSortId(data[1])
if heroData and heroData.id then
local openPanle = UIManager.OpenPanel(UIName.RoleInfoPanel, heroData, HeroManager.GetAllHeroDatas(),true)
if openPanle then
openPanle.JumpOnClickBtnUpStar()
openPanle.ShowGuideGo(2)
end
end
end,
[JumpType.BeastIncomingTide]=function()
UIManager.OpenPanel(UIName.MonsterCampPanel)
end,
[JumpType.AllForMation]=function(data)
if ActTimeCtrlManager.SingleFuncState(FormationManager.AllFormationFunIds[data[1]]) then
UIManager.OpenPanel(UIName.FormationSetPanel,data[1])
else
PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(FormationManager.AllFormationFunIds[data[1]]))
end
end,
[JumpType.QuickPurchase] = function(data)--快捷购买
UIManager.OpenPanel(UIName.QuickPurchasePanel, { type = data[1] })
end,
[JumpType.GiveMePower] = function()--我要变强
UIManager.OpenPanel(UIName.GiveMePowerPanel)
end,
[JumpType.EndlessFight] = function()--无尽副本
UIManager.OpenPanel(UIName.EndLessCarbonPanel)
end,
[JumpType.SoulPrintAstrology] = function()--无尽副本
UIManager.OpenPanel(UIName.SoulPrintAstrologyPanel)
end,
[JumpType.Alien] = function()--外敌入侵
UIManager.OpenPanel(UIName.AlienMainPanel)
end,
[JumpType.FiveStarActivity] = function()--外敌入侵
--UIManager.OpenPanel(UIName.GrowGiftPopup)
end,
[JumpType.Setting] = function(data)--外敌入侵
UIManager.OpenPanel(UIName.SettingPanel,data[1])
end,
[JumpType.LuckyTurn] = function(data)--幸运探宝
UIManager.OpenPanel(UIName.LuckyTurnTablePanel,data[1])
end,
[JumpType.TopMatch] = function(data)--巅峰赛
UIManager.OpenPanel(UIName.ArenaTopMatchPanel,data[1])
end,
[JumpType.FindFairy] = function(data)--东海寻仙
UIManager.OpenPanel(UIName.FindFairyPanel,data[1])
end,
[JumpType.FindTreasure] = function()--迷宫寻宝
UIManager.OpenPanel(UIName.FindTreasureMainPanel)
end,
[JumpType.Expedition]=function(data)--远征
if ActTimeCtrlManager.SingleFuncState(JumpType.Expedition) then
UIManager.OpenPanel(UIName.ExpeditionMainPanel,false,true)
else
PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.EXPEDITION))
end
end,
[JumpType.GuildAid] = function(data)--公会援助
if UIManager.IsOpen(UIName.GuildMainCityPanel) then
UIManager.OpenPanel(UIName.GuildAidMainPopup,data[1])
else
UIManager.OpenPanel(UIName.GuildMainCityPanel)
UIManager.OpenPanel(UIName.GuildAidMainPopup,data[1])
end
end,
}
function this.CheckJump(_jumpId)
local jumpSData = JumpConfig[_jumpId]
if jumpSData.Type < 10000 then
local b = jumpSData and ActTimeCtrlManager.SingleFuncState(jumpSData.Type)
if not b then
PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(jumpSData.Type))
end
return b
else
return true
end
end
function this.GoJumpWithoutTip(_jumpId)
local jumpSData = JumpConfig[_jumpId]
if jumpSData then
jumpDic[jumpSData.Type](jumpSData.Skipfactor)
end
end
function this.GoJump(_jumpId)
local jumpSData = JumpConfig[_jumpId]
if jumpSData then
if jumpSData.Type < 10000 then
local serData = ActTimeCtrlManager.GetSerDataByTypeId(jumpSData.Type)
if serData then
if ActTimeCtrlManager.SingleFuncState(jumpSData.Type) then
jumpDic[jumpSData.Type](jumpSData.Skipfactor)
else
PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(jumpSData.Type))
end
else
jumpDic[jumpSData.Type](jumpSData.Skipfactor)
end
else
jumpDic[jumpSData.Type](jumpSData.Skipfactor)
end
end
end
function this.ShowGuide(panelId, targetGO)
local go = poolManager:LoadAsset("GuideEffect", PoolManager.AssetType.GameObject)
go.transform:SetParent(targetGO.transform)
go.transform.localPosition = Vector3.zero
go.transform.localScale = Vector3.one
go.transform:SetAsLastSibling()
local layer = tonumber(go.name) or 0
Util.AddParticleSortLayer(go, UIManager.GetOpenPanel(panelId).sortingOrder - layer)
go.name = tostring(UIManager.GetOpenPanel(panelId).sortingOrder)
Util.GetGameObject(go, "GameObject"):SetActive(true)
local update
update = function()
if Input.GetMouseButtonDown(0) then
poolManager:UnLoadAsset("GuideEffect", go, PoolManager.AssetType.GameObject)
UpdateBeat:Remove(update, this)
end
end
UpdateBeat:Add(update, this)
end
return this