2021-06-15 20:08:14 +08:00
|
|
|
|
JumpServerManager = {}
|
|
|
|
|
local this = JumpServerManager
|
|
|
|
|
--天梯
|
|
|
|
|
local mServerArenaSetting = ConfigManager.GetConfig(ConfigName.MServerArenaSetting)
|
|
|
|
|
local mServerArenaReward = ConfigManager.GetConfig(ConfigName.MServerArenaReward)
|
|
|
|
|
local stage = 0 --1 未开始 2 战斗阶段 3 膜拜阶段
|
|
|
|
|
local endTime = 0 --阶段结束时间戳
|
|
|
|
|
local arenaInfo--
|
|
|
|
|
local myRank = -1
|
|
|
|
|
local oldMyRank = -1
|
|
|
|
|
local enterable = -1-- -1不可参加 是否可以参加 竞技场100名以内参加
|
|
|
|
|
local isGroup = 0--是否被分组 是1 否0
|
2021-07-13 11:28:36 +08:00
|
|
|
|
local isStart = 0
|
2021-06-15 20:08:14 +08:00
|
|
|
|
this.shopGoodId = 10035--挑战价格
|
|
|
|
|
|
|
|
|
|
function this.Initialize()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
---------------------------------------------
|
|
|
|
|
--跨服天梯数据
|
|
|
|
|
---------------------------------------------
|
|
|
|
|
------登录初始化
|
|
|
|
|
function this.LoginGetWorldArenaInfoRequest(fun)
|
|
|
|
|
if ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.JumpServer) then
|
|
|
|
|
NetManager.GetWorldArenaInfoRequest(function(_msg)
|
|
|
|
|
this.InithightLadderData(_msg)
|
|
|
|
|
if fun then
|
|
|
|
|
fun()
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
else
|
|
|
|
|
if fun then
|
|
|
|
|
fun()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
---初始化
|
|
|
|
|
function this.GetWorldArenaInfoRequest(fun)
|
|
|
|
|
NetManager.GetWorldArenaInfoRequest(function(_msg)
|
|
|
|
|
this.InithightLadderData(_msg)
|
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.JumpServerHeightLadder.UpdateHeightLadderPanel)
|
|
|
|
|
if fun then
|
|
|
|
|
fun()
|
|
|
|
|
end
|
2021-07-22 19:01:46 +08:00
|
|
|
|
--检测跨服天梯
|
|
|
|
|
JumpServerManager.CheckJumpServerhightLadderMainCityRedPoint()
|
2021-06-15 20:08:14 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
function this.InithightLadderData(_msg)
|
|
|
|
|
LogPink("_msg.arenaInfo.arenaEnemys "..#_msg.arenaInfo.arenaEnemys)
|
2021-06-25 15:23:55 +08:00
|
|
|
|
for i = 1, #_msg.arenaInfo.arenaEnemys do
|
|
|
|
|
LogPink("_msg.arenaInfo.arenaEnemys[i].hadProud "..tostring(_msg.arenaInfo.arenaEnemys[i].hadProud) )
|
|
|
|
|
LogPink("_msg.arenaInfo.arenaEnemys[i].worshipTime ".._msg.arenaInfo.arenaEnemys[i].worshipTime)
|
2021-07-13 17:40:25 +08:00
|
|
|
|
LogYellow("_msg.arenaInfo.arenaEnemys[i].personInfo.practiceLevel ".._msg.arenaInfo.arenaEnemys[i].personInfo.practiceLevel)
|
|
|
|
|
_msg.arenaInfo.arenaEnemys[i].personInfo.name = PracticeManager.SetNameColor(_msg.arenaInfo.arenaEnemys[i].personInfo.name,_msg.arenaInfo.arenaEnemys[i].personInfo.practiceLevel)
|
2021-06-25 15:23:55 +08:00
|
|
|
|
end
|
2021-06-15 20:08:14 +08:00
|
|
|
|
LogPink("_msg.stage ".._msg.stage)
|
|
|
|
|
LogPink("_msg.endTime ".._msg.endTime)
|
|
|
|
|
LogPink("_msg.arenaInfo.score ".._msg.arenaInfo.score)
|
|
|
|
|
LogPink("_msg.enterable ".._msg.enterable)
|
|
|
|
|
LogPink("_msg.isGroup ".._msg.isGroup)
|
2021-07-13 11:28:36 +08:00
|
|
|
|
LogPink("_msg.isStart ".._msg.isStart)
|
2021-06-15 20:08:14 +08:00
|
|
|
|
arenaInfo = _msg.arenaInfo
|
|
|
|
|
stage = _msg.stage
|
|
|
|
|
endTime = _msg.endTime
|
|
|
|
|
myRank = _msg.arenaInfo.score
|
|
|
|
|
enterable = _msg.enterable--是否可以参加 竞技场100名以内参加
|
|
|
|
|
isGroup = _msg.isGroup--是否被分组 是1 否0
|
2021-07-22 19:01:46 +08:00
|
|
|
|
isStart = _msg.isStart--是否在3周内,在为0 不在为1 开服三周后功能开始
|
2021-06-15 20:08:14 +08:00
|
|
|
|
end
|
|
|
|
|
--推送更新
|
|
|
|
|
function this.IndicationHightLadderData(_msg)
|
2021-07-13 17:40:25 +08:00
|
|
|
|
for i = 1, #_msg.arenaInfo.arenaEnemys do
|
|
|
|
|
_msg.arenaInfo.arenaEnemys[i].personInfo.name = PracticeManager.SetNameColor(_msg.arenaInfo.arenaEnemys[i].personInfo.name,_msg.arenaInfo.arenaEnemys[i].personInfo.practiceLevel)
|
|
|
|
|
end
|
2021-06-15 20:08:14 +08:00
|
|
|
|
arenaInfo = _msg.arenaInfo
|
|
|
|
|
stage = _msg.stage
|
|
|
|
|
endTime = _msg.endTime
|
|
|
|
|
myRank = _msg.arenaInfo.score
|
|
|
|
|
LogPink("_msg.arenaInfo.arenaEnemys "..#_msg.arenaInfo.arenaEnemys)
|
|
|
|
|
LogPink("_msg.stage ".._msg.stage)
|
|
|
|
|
LogPink("_msg.endTime ".._msg.endTime)
|
|
|
|
|
LogPink("_msg.arenaInfo.score ".._msg.arenaInfo.score)
|
2021-07-13 17:40:25 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.JumpServerHeightLadder.UpdateHeightLadderPanel)
|
2021-06-15 20:08:14 +08:00
|
|
|
|
end
|
|
|
|
|
--战斗更新
|
|
|
|
|
function this.BattleHightLadderData(_msg)
|
|
|
|
|
if _msg.arenaInfo and _msg.arenaInfo.arenaEnemys and #_msg.arenaInfo.arenaEnemys > 0 then
|
2021-07-13 17:40:25 +08:00
|
|
|
|
for i = 1, #_msg.arenaInfo.arenaEnemys do
|
|
|
|
|
_msg.arenaInfo.arenaEnemys[i].personInfo.name = PracticeManager.SetNameColor(_msg.arenaInfo.arenaEnemys[i].personInfo.name,_msg.arenaInfo.arenaEnemys[i].personInfo.practiceLevel)
|
|
|
|
|
end
|
2021-06-15 20:08:14 +08:00
|
|
|
|
arenaInfo = _msg.arenaInfo
|
|
|
|
|
myRank =_msg.arenaInfo.score
|
|
|
|
|
end
|
|
|
|
|
LogPink("_msg.arenaInfo.arenaEnemys "..#_msg.arenaInfo.arenaEnemys)
|
|
|
|
|
LogPink("_msg.arenaInfo.score ".._msg.arenaInfo.score)
|
|
|
|
|
end
|
|
|
|
|
--获得天梯阶段
|
|
|
|
|
function this.GetHightLadderDataArenaInfo()
|
|
|
|
|
return arenaInfo
|
|
|
|
|
end
|
|
|
|
|
function this.GetHightLadderDatastage()
|
|
|
|
|
return stage
|
|
|
|
|
end
|
|
|
|
|
function this.GetHightLadderDataEndTime()
|
|
|
|
|
return endTime
|
|
|
|
|
end
|
|
|
|
|
function this.GetHightLadderDataMyRank()
|
|
|
|
|
return myRank
|
|
|
|
|
end
|
|
|
|
|
function this.GetHightLadderDataOldMyRank()
|
|
|
|
|
return oldMyRank
|
|
|
|
|
end
|
|
|
|
|
function this.GetHightLadderDataEnterable()
|
|
|
|
|
return enterable ~= -1
|
|
|
|
|
end
|
|
|
|
|
function this.GetHightLadderDataIsGroup()
|
|
|
|
|
return isGroup ~= 0
|
|
|
|
|
end
|
2021-07-13 11:28:36 +08:00
|
|
|
|
function this.GetHightLadderDataIsStart()
|
|
|
|
|
return isStart == 1
|
|
|
|
|
end
|
2021-06-15 20:08:14 +08:00
|
|
|
|
-- 获取剩余挑战次数 特权
|
|
|
|
|
function this.GetCanBattleCount()
|
|
|
|
|
return PrivilegeManager.GetPrivilegeRemainValue(PRIVILEGE_TYPE.JUMPSERVER_GIGHTLADDER_MIANFEINUM)
|
|
|
|
|
end
|
|
|
|
|
-- 获取剩余挑战购买次数 特权
|
|
|
|
|
function this.GetCanBuyBattleCount()
|
|
|
|
|
return PrivilegeManager.GetPrivilegeRemainValue(PRIVILEGE_TYPE.JUMPSERVER_GIGHTLADDER_BUYNUM)
|
|
|
|
|
end
|
|
|
|
|
--天梯开始战斗
|
|
|
|
|
this.curBattleDrop = {}
|
|
|
|
|
function this.StarFightHightLadder(personInfo,skipFight,callBack)
|
2021-07-13 17:40:25 +08:00
|
|
|
|
NetManager.GetWorldArenaChallengeRequest(FormationTypeDef.JUMPSERVER_HIGHTLADDER,personInfo,skipFight,function (msg)
|
2021-06-15 20:08:14 +08:00
|
|
|
|
oldMyRank = myRank
|
|
|
|
|
-- if msg and msg.drop and msg.drop.itemlist and #msg.drop.itemlist > 0 then
|
|
|
|
|
-- LogPink(" #msg.drop.itemlist ".. #msg.drop.itemlist)
|
|
|
|
|
-- else
|
|
|
|
|
-- LogPink(" #msg.drop.itemlist nil ")
|
|
|
|
|
-- end
|
|
|
|
|
this.curBattleDrop = msg.drop
|
|
|
|
|
-- LogGreen("skipFight "..skipFight.." msg.err "..msg.err)
|
|
|
|
|
if skipFight == 0 then--挑战
|
|
|
|
|
if msg.err== -2 then
|
2021-07-14 21:43:03 +08:00
|
|
|
|
-- this.BattleHightLadderData(msg)--后端没给数据 前端自己请求
|
|
|
|
|
JumpServerManager.GetWorldArenaInfoRequest()
|
2021-06-15 20:08:14 +08:00
|
|
|
|
PopupTipPanel.ShowTip("无法挑战,目标玩家排名出现变化,已重新匹配对手!")
|
2021-07-14 19:07:05 +08:00
|
|
|
|
if callBack then
|
|
|
|
|
callBack()
|
|
|
|
|
end
|
2021-06-15 20:08:14 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
if msg.err== -3 then
|
2021-07-14 21:43:03 +08:00
|
|
|
|
-- this.BattleHightLadderData(msg)--后端没给数据 前端自己请求
|
|
|
|
|
JumpServerManager.GetWorldArenaInfoRequest()
|
2021-06-15 20:08:14 +08:00
|
|
|
|
PopupTipPanel.ShowTip("无法挑战,玩家排名出现变化,已重新匹配对手!")
|
2021-07-14 19:07:05 +08:00
|
|
|
|
if callBack then
|
|
|
|
|
callBack()
|
|
|
|
|
end
|
2021-06-15 20:08:14 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
this.BattleHightLadderData(msg)
|
|
|
|
|
local fightData = BattleManager.GetBattleServerData(msg,1)
|
|
|
|
|
UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.JumpServerhightLadder, function()
|
|
|
|
|
-- UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1,function()
|
|
|
|
|
if callBack then
|
|
|
|
|
callBack(msg)
|
|
|
|
|
end
|
|
|
|
|
-- end)
|
|
|
|
|
end
|
|
|
|
|
)
|
|
|
|
|
else
|
|
|
|
|
this.BattleHightLadderData(msg)
|
|
|
|
|
local fightData = BattleManager.GetBattleServerData(msg)
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1,function()
|
|
|
|
|
if callBack then
|
|
|
|
|
callBack(msg)
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
function this.GetWorldArenaProudRequest(personInfo,callBack)
|
|
|
|
|
NetManager.GetWorldArenaProudRequest(personInfo,function(msg)
|
2021-06-25 15:23:55 +08:00
|
|
|
|
LogGreen("msg.err "..msg.err)
|
|
|
|
|
LogGreen("msg.worshipTime "..msg.worshipTime)
|
2021-06-15 20:08:14 +08:00
|
|
|
|
if msg.err== -2 then
|
|
|
|
|
this.BattleHightLadderData(msg)
|
|
|
|
|
PopupTipPanel.ShowTip("无法挑战,目标玩家排名出现变化,已重新匹配对手!")
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
if msg.err== -3 then
|
|
|
|
|
this.BattleHightLadderData(msg)
|
|
|
|
|
PopupTipPanel.ShowTip("无法挑战,玩家排名出现变化,已重新匹配对手!")
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
local itemId = 0
|
|
|
|
|
local itemNum = 0
|
|
|
|
|
if msg.drop.itemlist ~= nil and #msg.drop.itemlist > 0 then
|
|
|
|
|
for i = 1, #msg.drop.itemlist do
|
|
|
|
|
if msg.drop.itemlist[i].itemNum > 0 then
|
|
|
|
|
itemId = msg.drop.itemlist[i].itemId--
|
|
|
|
|
itemNum = msg.drop.itemlist[i].itemNum
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
PopupTipPanel.ShowTip(string.format("膜拜成功,获得%sX%s!",ConfigManager.GetConfigData(ConfigName.ItemConfig,itemId).Name, itemNum))
|
|
|
|
|
-- LogPink("msg.worshipTime "..msg.worshipTime)
|
|
|
|
|
for i = 1, #arenaInfo.arenaEnemys do
|
|
|
|
|
if arenaInfo.arenaEnemys[i] then
|
|
|
|
|
local curData = arenaInfo.arenaEnemys[i]
|
2021-06-25 15:23:55 +08:00
|
|
|
|
LogYellow("personInfo.uid "..personInfo.uid.." curData.personInfo.uid "..curData.personInfo.uid)
|
2021-06-15 20:08:14 +08:00
|
|
|
|
if personInfo.uid == curData.personInfo.uid then
|
2021-06-25 15:23:55 +08:00
|
|
|
|
LogYellow("curData.worshipTime "..curData.worshipTime)
|
|
|
|
|
if curData.personInfo and curData.worshipTime then
|
|
|
|
|
LogPink("msg.worshipTime "..msg.worshipTime)
|
|
|
|
|
curData.worshipTime = msg.worshipTime
|
2021-06-15 20:08:14 +08:00
|
|
|
|
curData.hadProud = true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if callBack then
|
|
|
|
|
callBack(msg)
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.GetWorldArenaRecordInfoRequest(callBack)
|
|
|
|
|
NetManager.GetWorldArenaRecordInfoRequest(function(msg)
|
|
|
|
|
if callBack then
|
|
|
|
|
callBack(msg)
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
function this.CheckJumpServerhightLadderMainCityRedPoint()
|
|
|
|
|
CheckRedPointStatus(RedPointType.JumpServer_HightLadder_Worship)
|
|
|
|
|
CheckRedPointStatus(RedPointType.JumpServer_HightLadder_HaveMianFeiPanel)
|
|
|
|
|
end
|
|
|
|
|
--剩余免费挑战次数红点
|
|
|
|
|
function this.JumpServerHightLadderMianFeiNumRedPoint()
|
|
|
|
|
local isOpen = ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.JumpServer_HightLadder)
|
|
|
|
|
if not isOpen then
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
local conFigWorldLevel = ConfigManager.GetConfigData(ConfigName.MServerArenaSetting,1).WorldLevel
|
|
|
|
|
if PlayerManager.worldLeve < conFigWorldLevel then
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
if not this.GetHightLadderDataEnterable() then
|
|
|
|
|
-- LogPink("跨服天梯剩余免费挑战次数红点false")
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
if not this.GetHightLadderDataIsGroup() then
|
|
|
|
|
-- LogPink("跨服天梯剩余免费挑战次数红点false")
|
|
|
|
|
return false
|
|
|
|
|
end
|
2021-07-13 11:28:36 +08:00
|
|
|
|
if not this.GetHightLadderDataIsStart() then
|
|
|
|
|
-- LogPink("跨服天梯剩余免费挑战次数红点false")
|
|
|
|
|
return false
|
|
|
|
|
end
|
2021-06-15 20:08:14 +08:00
|
|
|
|
if stage == 2 then
|
|
|
|
|
if this.GetCanBattleCount() > 0 then
|
|
|
|
|
-- LogPink("跨服天梯剩余免费挑战次数红点true")
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- LogPink("跨服天梯剩余免费挑战次数红点false")
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
--跨服天梯可以膜拜红点
|
|
|
|
|
function this.JumpServerHightLadderWorshipRedPoint()
|
|
|
|
|
local isOpen = ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.JumpServer_HightLadder)
|
|
|
|
|
if not isOpen then
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
local conFigWorldLevel = ConfigManager.GetConfigData(ConfigName.MServerArenaSetting,1).WorldLevel
|
|
|
|
|
if PlayerManager.worldLeve < conFigWorldLevel then
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
if not this.GetHightLadderDataIsGroup() then
|
|
|
|
|
-- LogPink("跨服天梯剩余免费挑战次数红点false")
|
2021-07-13 11:28:36 +08:00
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
if not this.GetHightLadderDataIsStart() then
|
|
|
|
|
-- LogPink("跨服天梯剩余免费挑战次数红点false")
|
2021-06-15 20:08:14 +08:00
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
if stage == 3 then
|
|
|
|
|
|
|
|
|
|
local datas = this.GetHightLadderDataArenaInfo()
|
|
|
|
|
for i = 1, #datas.arenaEnemys do
|
|
|
|
|
if datas.arenaEnemys[i] and not datas.arenaEnemys[i].hadProud then
|
|
|
|
|
-- LogPink("跨服天梯可以膜拜红点true")
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
-- LogPink("跨服天梯可以膜拜红点false")
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
function this.ZeroRefreshPanel()
|
|
|
|
|
-- LogPink("跨天 跨服天梯膜拜状态刷新")
|
|
|
|
|
Timer.New(function()
|
2021-07-22 19:01:46 +08:00
|
|
|
|
this.GetWorldArenaInfoRequest(function ()
|
|
|
|
|
--一分钟间隔阶段 踢回主城
|
|
|
|
|
-- if UIManager.IsOpen(UIName.JumpServerHightLadderPanel) or UIManager.IsOpen(UIName.JumpServerPanel) then
|
|
|
|
|
-- if false then
|
|
|
|
|
-- UIManager.OpenPanel(UIName.MainPanel);
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
end)
|
2021-06-15 20:08:14 +08:00
|
|
|
|
end, 3):Start()
|
|
|
|
|
end
|
|
|
|
|
local curPersonInfo = {}
|
|
|
|
|
function this.SetCurPersonInfo(_curPersonInfo)
|
|
|
|
|
curPersonInfo = _curPersonInfo
|
|
|
|
|
end
|
|
|
|
|
function this.GetCurPersonInfo(_curPersonInfo)
|
|
|
|
|
return curPersonInfo
|
|
|
|
|
end
|
|
|
|
|
---------------------------------------------
|
|
|
|
|
--跨服天梯结束
|
|
|
|
|
---------------------------------------------
|
|
|
|
|
return this
|