2020-05-09 13:31:21 +08:00
|
|
|
|
RankingManager = {}
|
|
|
|
|
local this = RankingManager
|
|
|
|
|
|
|
|
|
|
--需要显示的排行
|
|
|
|
|
local NeedRanking={
|
|
|
|
|
--[1]={Id=53,OpenLv=0,Name="外敌",PanelType=0},
|
2020-06-23 18:36:24 +08:00
|
|
|
|
[1]={Id=8,OpenLv=0,Name=Language[11725],PanelType=0,Des=Language[11725]},
|
|
|
|
|
[2]={Id=30,OpenLv=0,Name=Language[11726],PanelType=0,Des=Language[11259]},
|
|
|
|
|
[3]={Id=55,OpenLv=0,Name=Language[11727],PanelType=0,Des=""},
|
|
|
|
|
[4]={Id=44,OpenLv=0,Name=Language[11728],PanelType=0,Des=Language[11728]},
|
|
|
|
|
[5]={Id=26,OpenLv=0,Name=Language[11729],PanelType=0,Des=""},
|
2020-05-09 13:31:21 +08:00
|
|
|
|
}
|
|
|
|
|
--Tab按钮显示文字
|
|
|
|
|
local TabTextData={
|
|
|
|
|
-- [1]={txt=""},
|
|
|
|
|
[1]={txt=""},
|
|
|
|
|
[2]={txt=""},
|
|
|
|
|
[3]={txt=""},
|
|
|
|
|
[4]={txt=""},
|
|
|
|
|
[5]={txt=""},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.CurPage=0
|
|
|
|
|
this.WarPowerData={}--战力排行滚动数据
|
|
|
|
|
this.WarPowerMyRankData={} --我的数据
|
2020-05-25 19:16:23 +08:00
|
|
|
|
this.ArenaData={}--逐胜场
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.ArenaMyRankData={}
|
|
|
|
|
this.TrialData={}--试炼
|
|
|
|
|
this.TrialMyRankData={}
|
|
|
|
|
this.MonsterData={}--兽潮
|
|
|
|
|
this.MonsterMyRankData={}
|
|
|
|
|
this.AdventureData={}--外敌
|
|
|
|
|
this.AdventureMyRankData={}
|
|
|
|
|
this.CustomsPassData={}--关卡
|
|
|
|
|
this.CustomsPassMyRankData={}
|
2020-06-08 13:57:30 +08:00
|
|
|
|
this.GuildData={}--公会
|
|
|
|
|
this.GuildMyRankData={}
|
2020-06-13 11:47:13 +08:00
|
|
|
|
this.GoldExperData={}--点金
|
|
|
|
|
this.GoldExperMyRankData={}
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
--是否加载完成
|
|
|
|
|
this.LoadCompleted={
|
|
|
|
|
WarPower=0,
|
|
|
|
|
Arena=0,
|
|
|
|
|
Trial=0,
|
|
|
|
|
Monster=0,
|
|
|
|
|
FightAlien=0,
|
|
|
|
|
CustomsPass=0,
|
2020-06-08 13:57:30 +08:00
|
|
|
|
GuildForce=0,
|
2020-06-13 11:47:13 +08:00
|
|
|
|
GoldExperSort=0,
|
2020-05-09 13:31:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.mainLevelConfig={}
|
|
|
|
|
this.isRequest=0--防止连续请求
|
|
|
|
|
|
|
|
|
|
function this.Initialize()
|
|
|
|
|
this.InitNeedRanking()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--初始化需要显示的排行
|
|
|
|
|
function this.InitNeedRanking()
|
|
|
|
|
this.mainLevelConfig=ConfigManager.GetConfig(ConfigName.MainLevelConfig)
|
|
|
|
|
--开启等级赋值
|
|
|
|
|
for i = 1, #NeedRanking do
|
|
|
|
|
NeedRanking[i].OpenLv=ConfigManager.GetConfigData(ConfigName.GlobalSystemConfig,NeedRanking[i].Id).OpenRules[2]
|
|
|
|
|
end
|
|
|
|
|
--排序
|
|
|
|
|
table.sort(NeedRanking,function(a,b)
|
|
|
|
|
return a.OpenLv<b.OpenLv
|
|
|
|
|
end)
|
|
|
|
|
--面板类型赋值
|
|
|
|
|
for i = 1, #NeedRanking do
|
|
|
|
|
NeedRanking[i].PanelType=i
|
|
|
|
|
end
|
|
|
|
|
--for i = 1, #NeedRanking do
|
|
|
|
|
-- Log(NeedRanking[i].Name)
|
|
|
|
|
--end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--根据活动开启等级,获取排序后活动名
|
|
|
|
|
function this.GetSortName()
|
|
|
|
|
local nameTable={}
|
|
|
|
|
for i = 1, #NeedRanking do
|
|
|
|
|
nameTable[i]=NeedRanking[i].Name
|
|
|
|
|
end
|
|
|
|
|
return nameTable
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--获取Tab文字内容
|
|
|
|
|
function this.GetTabTextData()
|
|
|
|
|
local _tabTextName=RankingManager.GetSortName()
|
|
|
|
|
for i = 1, #_tabTextName do
|
|
|
|
|
TabTextData[i].txt=_tabTextName[i]
|
|
|
|
|
end
|
|
|
|
|
return TabTextData
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--根据点击面板类型 获取当前排行信息
|
|
|
|
|
--type 需要的信息类型
|
|
|
|
|
--index 当前点击值
|
|
|
|
|
function this.GetCurRankingInfo(type,index)
|
|
|
|
|
if type=="Id" then
|
|
|
|
|
for i = 1, #NeedRanking do
|
|
|
|
|
if NeedRanking[i].PanelType==index then
|
|
|
|
|
return NeedRanking[i].Id
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
elseif type=="OpenLv" then
|
|
|
|
|
for i = 1, #NeedRanking do
|
|
|
|
|
if NeedRanking[i].PanelType==index then
|
|
|
|
|
return NeedRanking[i].OpenLv
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
elseif type=="Des" then
|
|
|
|
|
for i = 1, #NeedRanking do
|
|
|
|
|
if NeedRanking[i].PanelType==index then
|
|
|
|
|
return NeedRanking[i].Des
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--初始化排行数据(待优化)
|
|
|
|
|
function this.InitData(type,fun)
|
2020-06-23 18:36:24 +08:00
|
|
|
|
--if type==FUNCTION_OPEN_TYPE.ALLRANKING then--如果加载为指定的功能类型
|
|
|
|
|
-- if this.LoadCompleted.WarPower==0 then--当未加载该数据时
|
|
|
|
|
-- --if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.ALLRANKING) then--判断该功能是否解锁
|
|
|
|
|
-- Log(Language[11730])
|
2020-06-28 17:48:49 +08:00
|
|
|
|
-- NetManager.RequestRankInfo(RANK_TYPE.FORCE_RANK, function (msg)--请求数据
|
2020-06-23 18:36:24 +08:00
|
|
|
|
-- this.ReceiveWarPowerData(msg)
|
|
|
|
|
-- if fun then fun() end
|
2020-06-28 17:48:49 +08:00
|
|
|
|
-- end, ActivityTypeDef.WarPowerSort)
|
2020-06-23 18:36:24 +08:00
|
|
|
|
-- --else
|
|
|
|
|
-- -- Log("战力未解锁")
|
|
|
|
|
-- -- this.warPowerData={}
|
|
|
|
|
-- -- this.warPowerMsg={}
|
|
|
|
|
-- -- if fun then fun() end
|
|
|
|
|
-- --end
|
|
|
|
|
-- else--当存在该功能数据时 执行回调
|
|
|
|
|
-- if fun then fun() end
|
|
|
|
|
-- end
|
|
|
|
|
--end
|
2020-06-28 17:48:49 +08:00
|
|
|
|
--实时关卡排行
|
|
|
|
|
if type==FUNCTION_OPEN_TYPE.ALLRANKING then--如果加载为指定的功能类型
|
|
|
|
|
if this.LoadCompleted.WarPower==0 then--当未加载该数据时
|
|
|
|
|
--if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.ALLRANKING) then--判断该功能是否解锁
|
|
|
|
|
Log(Language[11730])
|
|
|
|
|
NetManager.RequestRankInfo(RANK_TYPE.FORCE_CURR_RANK, function (msg)--请求数据
|
|
|
|
|
this.ReceiveWarPowerData(msg)
|
|
|
|
|
if fun then fun() end
|
|
|
|
|
end,0)
|
|
|
|
|
--else
|
|
|
|
|
-- Log("战力未解锁")
|
|
|
|
|
-- this.warPowerData={}
|
|
|
|
|
-- this.warPowerMsg={}
|
|
|
|
|
-- if fun then fun() end
|
|
|
|
|
--end
|
|
|
|
|
else--当存在该功能数据时 执行回调
|
|
|
|
|
if fun then fun() end
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if type==FUNCTION_OPEN_TYPE.ARENA then
|
|
|
|
|
if this.LoadCompleted.Arena==0 then
|
2020-06-08 13:57:30 +08:00
|
|
|
|
--if ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.ARENA) then --根据是否有资格开启 逐胜场排行在赛季结束时 tab不锁定 需要显示数据
|
2020-06-23 18:36:24 +08:00
|
|
|
|
Log(Language[11731])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
NetManager.RequestArenaRankData(1,function(page,msg)
|
|
|
|
|
this.ReceiveArenaData(page,msg)
|
|
|
|
|
if fun then fun() end
|
|
|
|
|
end)
|
2020-06-08 13:57:30 +08:00
|
|
|
|
--else
|
|
|
|
|
-- Log("逐胜排名未解锁")
|
|
|
|
|
-- this.ArenaData={}
|
|
|
|
|
-- this.ArenaMyRankData={}
|
|
|
|
|
-- if fun then fun() end
|
|
|
|
|
--end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
|
|
|
|
if fun then fun() end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if type==FUNCTION_OPEN_TYPE.TRIAL then
|
|
|
|
|
if this.LoadCompleted.Trial==0 then
|
2020-06-08 13:57:30 +08:00
|
|
|
|
--if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.TRIAL) then
|
2020-06-23 18:36:24 +08:00
|
|
|
|
Log(Language[11732])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
NetManager.RequestRankInfo(RANK_TYPE.TRIAL_RANK, function(msg)
|
|
|
|
|
this.ReceiveTrialData(msg)
|
|
|
|
|
if fun then fun() end
|
|
|
|
|
end)
|
2020-06-08 13:57:30 +08:00
|
|
|
|
--else
|
|
|
|
|
-- Log("试炼排名未解锁")
|
|
|
|
|
-- this.TrialData={}
|
|
|
|
|
-- this.TrialMyRankData={}
|
|
|
|
|
-- if fun then fun() end
|
|
|
|
|
--end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
|
|
|
|
if fun then fun() end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if type==FUNCTION_OPEN_TYPE.MONSTER_COMING then
|
|
|
|
|
if this.LoadCompleted.Monster==0 then
|
2020-06-08 13:57:30 +08:00
|
|
|
|
--if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.MONSTER_COMING) then
|
2020-06-23 18:36:24 +08:00
|
|
|
|
Log(Language[11733])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
NetManager.RequestRankInfo(RANK_TYPE.MONSTER_RANK, function(msg)
|
|
|
|
|
this.ReceiveMonsterData(msg)
|
|
|
|
|
if fun then fun() end
|
|
|
|
|
end)
|
2020-06-08 13:57:30 +08:00
|
|
|
|
--else
|
|
|
|
|
-- Log("兽潮排名未解锁")
|
|
|
|
|
-- this.MonsterData={}
|
|
|
|
|
-- this.MonsterMyRankData={}
|
|
|
|
|
-- if fun then fun() end
|
|
|
|
|
--end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
|
|
|
|
if fun then fun() end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if type==FUNCTION_OPEN_TYPE.FIGHT_ALIEN then
|
|
|
|
|
if this.LoadCompleted.FightAlien==0 then
|
2020-06-08 13:57:30 +08:00
|
|
|
|
--if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.FIGHT_ALIEN) then
|
2020-06-23 18:36:24 +08:00
|
|
|
|
Log(Language[11734])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
NetManager.GetAdventureRankRequest(1,function(page,msg)
|
|
|
|
|
this.ReceiveAdventureData(page,msg)
|
|
|
|
|
if fun then fun() end
|
|
|
|
|
end)
|
2020-06-08 13:57:30 +08:00
|
|
|
|
--else
|
|
|
|
|
-- Log("外敌排名未解锁")
|
|
|
|
|
-- this.AdventureData={}
|
|
|
|
|
-- this.AdventureMyRankData={}
|
|
|
|
|
-- if fun then fun() end
|
|
|
|
|
--end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
|
|
|
|
if fun then fun() end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if type==FUNCTION_OPEN_TYPE.CUSTOMSPASS then
|
|
|
|
|
if this.LoadCompleted.CustomsPass==0 then
|
2020-06-08 13:57:30 +08:00
|
|
|
|
--if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.CUSTOMSPASS) then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if this.isRequest==1 then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
this.isRequest=1
|
2020-06-23 18:36:24 +08:00
|
|
|
|
Log(Language[11735])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
NetManager.RequestRankInfo(RANK_TYPE.FIGHT_LEVEL_RANK, function(msg)
|
|
|
|
|
this.ReceiveCustomsPassData(msg)
|
|
|
|
|
if fun then fun() end
|
|
|
|
|
end)
|
2020-06-08 13:57:30 +08:00
|
|
|
|
--else
|
|
|
|
|
-- Log("关卡排名未解锁")
|
|
|
|
|
-- this.CustomsPassData={}
|
|
|
|
|
-- this.CustomsPassMyRankData={}
|
|
|
|
|
-- if fun then fun() end
|
|
|
|
|
--end
|
|
|
|
|
else
|
|
|
|
|
if fun then fun() end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if type==FUNCTION_OPEN_TYPE.GUILD then
|
|
|
|
|
--this.GuildData={}--公会
|
|
|
|
|
--this.GuildMyRankData={}
|
|
|
|
|
if this.LoadCompleted.GuildForce==0 then
|
|
|
|
|
--if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.GUILD) then
|
|
|
|
|
if this.isRequest==1 then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
this.isRequest=1
|
2020-06-23 18:36:24 +08:00
|
|
|
|
Log(Language[11736])
|
2020-06-08 13:57:30 +08:00
|
|
|
|
NetManager.RequestRankInfo(RANK_TYPE.GUILD_FORCE_RANK, function(msg)
|
|
|
|
|
this.ReceiveGuildForeData(msg)
|
|
|
|
|
if fun then fun() end
|
|
|
|
|
end)
|
|
|
|
|
--else
|
|
|
|
|
-- Log("公会未解锁")
|
|
|
|
|
-- this.GuildData={}
|
|
|
|
|
-- this.GuildMyRankData={}
|
|
|
|
|
-- if fun then fun() end
|
|
|
|
|
--end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
|
|
|
|
if fun then fun() end
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-06-13 11:47:13 +08:00
|
|
|
|
if type==FUNCTION_OPEN_TYPE.EXPERT then
|
2020-06-28 17:48:49 +08:00
|
|
|
|
LogGreen("this.LoadCompleted.GoldExperSort "..this.LoadCompleted.GoldExperSort.." "..this.isRequest)
|
2020-06-13 11:47:13 +08:00
|
|
|
|
if this.LoadCompleted.GoldExperSort==0 then
|
|
|
|
|
if this.isRequest==1 then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
this.isRequest=1
|
|
|
|
|
NetManager.RequestRankInfo(RANK_TYPE.GOLD_EXPER, function(msg)
|
|
|
|
|
this.ReceiveGoldExperSortData(msg)
|
|
|
|
|
if fun then fun() end
|
2020-06-18 20:39:29 +08:00
|
|
|
|
end,ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.GoldExper))
|
2020-06-13 11:47:13 +08:00
|
|
|
|
else
|
|
|
|
|
if fun then fun() end
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
--清空数据
|
|
|
|
|
function this.ClearData()
|
|
|
|
|
this.CurPage=0
|
|
|
|
|
this.WarPowerData={}--战力排行滚动数据
|
|
|
|
|
this.WarPowerMyRankData={} --我的数据
|
2020-05-25 19:16:23 +08:00
|
|
|
|
this.ArenaData={}--逐胜场
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.ArenaMyRankData={}
|
|
|
|
|
this.TrialData={}--试炼
|
|
|
|
|
this.TrialMyRankData={}
|
|
|
|
|
this.MonsterData={}--兽潮
|
|
|
|
|
this.MonsterMyRankData={}
|
|
|
|
|
this.AdventureData={}--外敌
|
|
|
|
|
this.AdventureMyRankData={}
|
|
|
|
|
this.CustomsPassData={}--关卡
|
|
|
|
|
this.CustomsPassMyRankData={}
|
2020-06-08 13:57:30 +08:00
|
|
|
|
this.GuildData={}--公会
|
|
|
|
|
this.GuildMyRankData={}
|
2020-06-18 20:39:29 +08:00
|
|
|
|
this.GoldExperData={}--点金
|
|
|
|
|
this.GoldExperMyRankData={}
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.LoadCompleted.WarPower=0
|
|
|
|
|
this.LoadCompleted.Arena=0
|
|
|
|
|
this.LoadCompleted.Trial=0
|
|
|
|
|
this.LoadCompleted.Monster=0
|
|
|
|
|
this.LoadCompleted.FightAlien=0
|
|
|
|
|
this.LoadCompleted.CustomsPass=0
|
2020-06-08 13:57:30 +08:00
|
|
|
|
this.LoadCompleted.GuildForce=0
|
2020-06-13 11:47:13 +08:00
|
|
|
|
this.LoadCompleted.GoldExperSort=0
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---战力战力
|
|
|
|
|
--接收服务器战力数据
|
|
|
|
|
function this.ReceiveWarPowerData(msg)
|
|
|
|
|
--if this.CurPage >= page then return end
|
|
|
|
|
--this.CurPage=page
|
|
|
|
|
--if page==1 then
|
|
|
|
|
-- this.WarPowerData={}
|
|
|
|
|
--end
|
|
|
|
|
|
|
|
|
|
--自身数据
|
|
|
|
|
this.WarPowerMyRankData.myRank=msg.myRankInfo.rank
|
|
|
|
|
this.WarPowerMyRankData.myForce=msg.myRankInfo.param1
|
|
|
|
|
--滚动数据
|
|
|
|
|
local length=#this.WarPowerData
|
|
|
|
|
for i, rank in ipairs(msg.ranks) do
|
|
|
|
|
this.WarPowerData[length+i]=rank
|
|
|
|
|
end
|
2020-06-28 17:48:49 +08:00
|
|
|
|
this.LoadCompleted.WarPower=1
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.RankingList.OnWarPowerChange)
|
|
|
|
|
end
|
|
|
|
|
--请求下一页数据
|
|
|
|
|
function this.RequestNextWarPowerPageData()
|
2020-06-23 18:36:24 +08:00
|
|
|
|
Log(Language[11738])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--if not ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.ALLRANKING) then
|
|
|
|
|
-- PopupTipPanel.ShowTip("本赛季已结束")
|
|
|
|
|
-- return
|
|
|
|
|
--end
|
|
|
|
|
----判断是否符合刷新条件
|
|
|
|
|
--local rankNum = #this.WarPowerData
|
|
|
|
|
---- 最多显示100
|
|
|
|
|
--local config = ConfigManager.GetConfigData(ConfigName.SpecialConfig, 7)
|
|
|
|
|
--local MaxNum = config and tonumber(config.Value) or 100
|
|
|
|
|
--if rankNum >= MaxNum then return end
|
|
|
|
|
---- 上一页数据少于20条,则没有下一页数,不再刷新
|
|
|
|
|
--if rankNum % 20 > 0 then
|
|
|
|
|
-- return
|
|
|
|
|
--end
|
|
|
|
|
--
|
|
|
|
|
-- 请求下一页
|
|
|
|
|
--NetManager.RequestWarPowerSortData(this.CurPage + 1,ActivityTypeDef.WarPowerSort,function(page,msg)
|
|
|
|
|
-- this.ReceiveWarPowerData(page,msg)
|
|
|
|
|
--end)
|
|
|
|
|
end
|
|
|
|
|
--获取排行榜信息
|
|
|
|
|
function this.GetWarPowerInfo()
|
|
|
|
|
return this.WarPowerData, this.WarPowerMyRankData
|
|
|
|
|
end
|
|
|
|
|
|
2020-05-25 19:16:23 +08:00
|
|
|
|
---逐胜场
|
2020-05-09 13:31:21 +08:00
|
|
|
|
function this.ReceiveArenaData(page,msg)
|
|
|
|
|
if this.CurPage >= page then return end
|
|
|
|
|
this.CurPage=page
|
|
|
|
|
if page==1 then
|
|
|
|
|
this.ArenaData={}
|
|
|
|
|
end
|
|
|
|
|
--自身数据
|
|
|
|
|
this.ArenaMyRankData.myRank=msg.myRank
|
|
|
|
|
this.ArenaMyRankData.myScore=msg.myscore
|
|
|
|
|
--滚动数据
|
|
|
|
|
local length=#this.ArenaData
|
|
|
|
|
for i, rank in ipairs(msg.rankInfos) do
|
|
|
|
|
this.ArenaData[length+i]=rank
|
|
|
|
|
end
|
2020-06-23 18:36:24 +08:00
|
|
|
|
this.LoadCompleted.Arena=1 Log(Language[11739])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.RankingList.OnArenaChange)
|
|
|
|
|
end
|
|
|
|
|
function this.RequestNextArenaPageData()
|
|
|
|
|
if not ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.ARENA) then
|
|
|
|
|
--PopupTipPanel.ShowTip("本赛季已结束")
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
--判断是否符合刷新条件
|
|
|
|
|
local rankNum = #this.ArenaData
|
|
|
|
|
-- 最多显示100
|
|
|
|
|
local config = ConfigManager.GetConfigData(ConfigName.SpecialConfig, 3)
|
|
|
|
|
local MaxNum = config and tonumber(config.Value) or 100
|
|
|
|
|
if rankNum >= MaxNum then return end
|
|
|
|
|
-- 上一页数据少于20条,则没有下一页数,不再刷新
|
|
|
|
|
if rankNum % 20 > 0 then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
-- 请求下一页
|
|
|
|
|
NetManager.RequestArenaRankData(this.CurPage + 1,function(page,msg)
|
|
|
|
|
this.ReceiveArenaData(page,msg)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
function this.GetArenaInfo()
|
|
|
|
|
return this.ArenaData, this.ArenaMyRankData
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---试炼
|
|
|
|
|
function this.ReceiveTrialData(msg)
|
|
|
|
|
--自身数据
|
|
|
|
|
this.TrialMyRankData.rank=msg.myRankInfo.rank
|
|
|
|
|
this.TrialMyRankData.highestTower=msg.myRankInfo.param1
|
|
|
|
|
--滚动数据
|
|
|
|
|
local length=#this.TrialData
|
|
|
|
|
for i, rank in ipairs(msg.ranks) do
|
|
|
|
|
this.TrialData[length+i]=rank
|
|
|
|
|
end
|
2020-06-23 18:36:24 +08:00
|
|
|
|
this.LoadCompleted.Trial=1 Log(Language[11740])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.RankingList.OnTrialChange)
|
|
|
|
|
end
|
|
|
|
|
function this.GetTrialInfo()
|
|
|
|
|
return this.TrialData, this.TrialMyRankData
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---兽潮
|
|
|
|
|
function this.ReceiveMonsterData(msg)
|
|
|
|
|
--自身数据
|
|
|
|
|
this.MonsterMyRankData.myRank=msg.myRankInfo.rank
|
|
|
|
|
this.MonsterMyRankData.myScore=msg.myRankInfo.param1
|
|
|
|
|
--滚动数据
|
|
|
|
|
local length=#this.MonsterData
|
|
|
|
|
for i, rank in ipairs(msg.ranks) do
|
|
|
|
|
this.MonsterData[length+i]=rank
|
|
|
|
|
end
|
|
|
|
|
this.LoadCompleted.Monster=1
|
2020-06-23 18:36:24 +08:00
|
|
|
|
Log(Language[11741])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.RankingList.OnMonsterChange)
|
|
|
|
|
end
|
|
|
|
|
function this.GetMonsterInfo()
|
|
|
|
|
return this.MonsterData, this.MonsterMyRankData
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---外敌
|
|
|
|
|
function this.ReceiveAdventureData(page,msg)
|
|
|
|
|
if this.CurPage >= page then return end
|
|
|
|
|
this.CurPage=page
|
|
|
|
|
if page==1 then
|
|
|
|
|
this.AdventureData={}
|
|
|
|
|
end
|
|
|
|
|
--自身数据
|
|
|
|
|
this.AdventureMyRankData.rank=msg.myInfo.rank
|
|
|
|
|
this.AdventureMyRankData.hurt=msg.myInfo.hurt
|
|
|
|
|
--滚动数据
|
|
|
|
|
local length=#this.AdventureData
|
|
|
|
|
for i, rank in ipairs(msg.adventureRankItemInfo) do
|
|
|
|
|
this.AdventureData[length+i]=rank
|
|
|
|
|
end
|
|
|
|
|
this.LoadCompleted.FightAlien=1
|
2020-06-23 18:36:24 +08:00
|
|
|
|
Log(Language[11742])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.RankingList.OnAdventureChange)
|
|
|
|
|
end
|
|
|
|
|
function this.RequestNextAdventurePageData()
|
|
|
|
|
if not ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.FIGHT_ALIEN) then
|
2020-06-23 18:36:24 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[10082])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
--判断是否符合刷新条件
|
|
|
|
|
local rankNum = #this.AdventureData
|
|
|
|
|
-- 最多显示100
|
|
|
|
|
local config = ConfigManager.GetConfigData(ConfigName.SpecialConfig, 6)
|
|
|
|
|
local MaxNum = config and tonumber(config.Value) or 100
|
|
|
|
|
if rankNum >= MaxNum then return end
|
|
|
|
|
-- 上一页数据少于20条,则没有下一页数,不再刷新
|
|
|
|
|
if rankNum % 20 > 0 then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
-- 请求下一页
|
|
|
|
|
NetManager.GetAdventureRankRequest(this.CurPage + 1,function(page,msg)
|
|
|
|
|
this.ReceiveAdventureData(page,msg)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
function this.GetAdventureInfo()
|
|
|
|
|
return this.AdventureData,this.AdventureMyRankData
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---关卡
|
|
|
|
|
function this.ReceiveCustomsPassData(msg)
|
|
|
|
|
if this.LoadCompleted.CustomsPass==1 then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
--自身数据
|
|
|
|
|
|
|
|
|
|
this.CustomsPassMyRankData.myRank=msg.myRankInfo.rank
|
|
|
|
|
this.CustomsPassMyRankData.fightId=msg.myRankInfo.param1
|
|
|
|
|
--滚动数据
|
|
|
|
|
local length=#this.CustomsPassData
|
|
|
|
|
for i, rank in ipairs(msg.ranks) do
|
|
|
|
|
this.CustomsPassData[length+i]=rank
|
|
|
|
|
end
|
|
|
|
|
this.LoadCompleted.CustomsPass=1
|
2020-06-23 18:36:24 +08:00
|
|
|
|
Log(Language[11743])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.RankingList.OnCustomsPassChange)
|
|
|
|
|
end
|
|
|
|
|
function this.GetCustomsPassInfo()
|
|
|
|
|
return this.CustomsPassData,this.CustomsPassMyRankData
|
|
|
|
|
end
|
2020-06-08 13:57:30 +08:00
|
|
|
|
---公会
|
|
|
|
|
function this.ReceiveGuildForeData(msg)
|
|
|
|
|
--this.GuildData={}--公会
|
|
|
|
|
--this.GuildMyRankData={}
|
|
|
|
|
if this.LoadCompleted.GuildForce==1 then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
--自身数据
|
|
|
|
|
|
|
|
|
|
this.GuildMyRankData.myRank=msg.myRankInfo.rank
|
|
|
|
|
this.GuildMyRankData.myForce=msg.myRankInfo.param1
|
|
|
|
|
--滚动数据
|
|
|
|
|
local length=#this.GuildData
|
|
|
|
|
for i, rank in ipairs(msg.ranks) do
|
|
|
|
|
this.GuildData[length+i]=rank
|
|
|
|
|
end
|
|
|
|
|
this.LoadCompleted.GuildForce=1
|
2020-06-23 18:36:24 +08:00
|
|
|
|
Log(Language[11743])
|
2020-06-08 13:57:30 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.RankingList.OnGuildForceChange)
|
|
|
|
|
end
|
|
|
|
|
function this.GetGuildForeInfo()
|
|
|
|
|
return this.GuildData,this.GuildMyRankData
|
|
|
|
|
end
|
2020-06-18 20:39:29 +08:00
|
|
|
|
---点金
|
2020-06-13 11:47:13 +08:00
|
|
|
|
function this.ReceiveGoldExperSortData(msg)
|
|
|
|
|
if this.LoadCompleted.GoldExperSort==1 then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
--自身数据
|
|
|
|
|
|
|
|
|
|
this.GoldExperMyRankData.myRank=msg.myRankInfo.rank
|
|
|
|
|
this.GoldExperMyRankData.myNum=msg.myRankInfo.param1
|
|
|
|
|
--滚动数据
|
|
|
|
|
local length=#this.GoldExperData
|
|
|
|
|
for i, rank in ipairs(msg.ranks) do
|
|
|
|
|
this.GoldExperData[length+i]=rank
|
|
|
|
|
end
|
|
|
|
|
this.LoadCompleted.GoldExperSort=1
|
2020-06-23 18:36:24 +08:00
|
|
|
|
Log(Language[11744])
|
2020-06-13 11:47:13 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.RankingList.OnGoldExperSortChange)
|
|
|
|
|
end
|
|
|
|
|
function this.GetGoldExperSortInfo()
|
|
|
|
|
return this.GoldExperData,this.GoldExperMyRankData
|
|
|
|
|
end
|
2020-06-08 13:57:30 +08:00
|
|
|
|
--膜拜信息
|
|
|
|
|
local RankProud = {}
|
2020-06-30 18:59:44 +08:00
|
|
|
|
local firstRankProud = {}--后端临时数据
|
2020-06-08 13:57:30 +08:00
|
|
|
|
function this.SetAllRankProud(types,prouds)
|
|
|
|
|
for i = 1, #types do
|
|
|
|
|
RankProud[types[i]] = prouds[i]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
function this.SetSingleRankProud(type,proud)
|
|
|
|
|
RankProud[type] = proud
|
|
|
|
|
end
|
|
|
|
|
function this.GetRankProud()
|
|
|
|
|
return RankProud
|
|
|
|
|
end
|
2020-06-30 18:59:44 +08:00
|
|
|
|
function this.SetAllFirstRankProud(types,_firstRankProud)
|
|
|
|
|
for i = 1, #_firstRankProud do
|
|
|
|
|
firstRankProud[types[i]] = _firstRankProud[i]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
function this.GetAllFirstRankProud()
|
|
|
|
|
return firstRankProud
|
|
|
|
|
end
|
2020-06-13 11:47:13 +08:00
|
|
|
|
|
|
|
|
|
--数据拆分 d数据
|
|
|
|
|
function this.CutDate(d)
|
|
|
|
|
local dt,db={},{}
|
|
|
|
|
for i, v in ipairs(d) do
|
|
|
|
|
if i==1 then
|
|
|
|
|
table.insert(dt,v)
|
|
|
|
|
else
|
|
|
|
|
table.insert(db,v)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return dt,db
|
|
|
|
|
end
|
|
|
|
|
|
2020-06-30 18:59:44 +08:00
|
|
|
|
--膜拜红点
|
|
|
|
|
function this.RefreshRedPoint()
|
|
|
|
|
if (ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.ALLRANKING)) then
|
|
|
|
|
local proud = RankingManager.GetRankProud()
|
|
|
|
|
local allFirstRankProud = RankingManager.GetAllFirstRankProud()
|
|
|
|
|
if proud then
|
|
|
|
|
for i, v in pairs(proud) do
|
|
|
|
|
--LogGreen("proud[i] "..v)
|
|
|
|
|
--LogGreen("allFirstRankProud[i].uid "..allFirstRankProud[i].uid)
|
|
|
|
|
if v == 0 and allFirstRankProud[i].uid ~= 0 then--没有膜拜过
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return false
|
|
|
|
|
else
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
2020-06-23 18:36:24 +08:00
|
|
|
|
return this
|