【排行榜优化】排行榜信息分页读取

dev_chengFeng
zhangqiang 2021-02-03 14:45:32 +08:00
parent 505a5eaa66
commit b80bed1cff
12 changed files with 296 additions and 120 deletions

View File

@ -397,6 +397,7 @@ VIEWHEROINFORESPONSE_GUILDSKILL_FIELD = protobuf.FieldDescriptor();
RANKREQUEST = protobuf.Descriptor();
RANKREQUEST_TYPE_FIELD = protobuf.FieldDescriptor();
RANKREQUEST_ACTIVITEID_FIELD = protobuf.FieldDescriptor();
RANKREQUEST_INDEX_FIELD = protobuf.FieldDescriptor();
RANKRESPONSE = protobuf.Descriptor();
RANKRESPONSE_RANKS_FIELD = protobuf.FieldDescriptor();
RANKRESPONSE_MYRANKINFO_FIELD = protobuf.FieldDescriptor();
@ -4104,11 +4105,21 @@ RANKREQUEST_ACTIVITEID_FIELD.default_value = 0
RANKREQUEST_ACTIVITEID_FIELD.type = 5
RANKREQUEST_ACTIVITEID_FIELD.cpp_type = 1
RANKREQUEST_INDEX_FIELD.name = "index"
RANKREQUEST_INDEX_FIELD.full_name = ".rpc.protocols.RankRequest.index"
RANKREQUEST_INDEX_FIELD.number = 3
RANKREQUEST_INDEX_FIELD.index = 2
RANKREQUEST_INDEX_FIELD.label = 1
RANKREQUEST_INDEX_FIELD.has_default_value = false
RANKREQUEST_INDEX_FIELD.default_value = 0
RANKREQUEST_INDEX_FIELD.type = 5
RANKREQUEST_INDEX_FIELD.cpp_type = 1
RANKREQUEST.name = "RankRequest"
RANKREQUEST.full_name = ".rpc.protocols.RankRequest"
RANKREQUEST.nested_types = {}
RANKREQUEST.enum_types = {}
RANKREQUEST.fields = {RANKREQUEST_TYPE_FIELD, RANKREQUEST_ACTIVITEID_FIELD}
RANKREQUEST.fields = {RANKREQUEST_TYPE_FIELD, RANKREQUEST_ACTIVITEID_FIELD, RANKREQUEST_INDEX_FIELD}
RANKREQUEST.is_extendable = false
RANKREQUEST.extensions = {}
RANKRESPONSE_RANKS_FIELD.name = "ranks"

View File

@ -181,17 +181,23 @@ end
------------------ 兽潮来袭排行 --------------------------------------------
function this.GetMonsterFightRankInfo()
NetManager.RequestRankInfo(RANK_TYPE.MONSTER_RANK, function (msg)
-- NetManager.RequestRankInfo(RANK_TYPE.MONSTER_RANK, function (msg)
-- Log(Language[10315])
-- this.SetPlayerInfo(msg)
-- this.SetOtherPlayerInfo(msg)
-- end)
RankingManager.InitData(RANK_TYPE.MONSTER_RANK,function()
local ranks,myRank = RankingManager.GetRankingInfo()
Log(Language[10315])
this.SetPlayerInfo(msg)
this.SetOtherPlayerInfo(msg)
end)
this.SetPlayerInfo(ranks,myRank)
this.SetOtherPlayerInfo(ranks,myRank)
end,nil,1)
end
-- 玩家自己的排行
function this.SetPlayerInfo(msg)
local myWave = msg.myRankInfo.param1
local myRank = msg.myRankInfo.rank
function this.SetPlayerInfo(ranks,myRankInfo)
local myWave = myRankInfo.param1
local myRank = myRankInfo.rank
if myRank == -1 then
this.monsterRank.text = Language[10041]
@ -202,14 +208,21 @@ function this.SetPlayerInfo(msg)
end
end
-- 其他玩家的排行
function this.SetOtherPlayerInfo(msg)
if #msg.ranks == 0 or not msg.ranks then Log(Language[10317]) this.noneImage:SetActive(true) return end
function this.SetOtherPlayerInfo(ranks,myRankInfo)
if #ranks == 0 or not ranks then Log(Language[10317]) this.noneImage:SetActive(true) return end
local rankFunc = function (index, item)
this.RefreshMonsterRankInfo(item, msg.ranks[index], msg.myRankInfo.rank)
this.RefreshMonsterRankInfo(item, ranks[index], myRankInfo.rank)
if index==#ranks then
RankingManager.RequestNextWarPowerPageData(function()
local ranks,myRank = RankingManager.GetRankingInfo()
this.SetPlayerInfo(ranks,myRank)
this.SetOtherPlayerInfo(ranks,myRank)
end)
end
end
this.ScrollView:SetData(msg.ranks, rankFunc)
this.ScrollView:SetData(ranks, rankFunc)
end
@ -265,17 +278,22 @@ end
------------------- 试炼排行----------------------------------------------
-- 初始化数据显示
function this.GetTrialRankInfo()
NetManager.RequestRankInfo(RANK_TYPE.TRIAL_RANK, function (msg)
this.SetPlayerRankInfo(msg)
this.SetRoleRank(msg)
end)
-- NetManager.RequestRankInfo(RANK_TYPE.TRIAL_RANK, function (msg)
-- this.SetPlayerRankInfo(msg)
-- this.SetRoleRank(msg)
-- end)
RankingManager.InitData(RANK_TYPE.TRIAL_RANK,function()
local ranks,myRank = RankingManager.GetRankingInfo()
this.SetPlayerRankInfo(ranks,myRank)
this.SetRoleRank(ranks,myRank)
end,nil,1)
end
-- 设置玩家数据
function this.SetPlayerRankInfo(msg)
local rank = msg.myRankInfo.rank
local maxLevel = msg.myRankInfo.param1
local minTime = msg.myRankInfo.param2
function this.SetPlayerRankInfo(ranks,myRankInfo)
local rank = myRankInfo.rank
local maxLevel = myRankInfo.param1
local minTime = myRankInfo.param2
rank = rank <= 0 and Language[10041] or rank
maxLevel = maxLevel <= 0 and 0 or maxLevel
@ -291,17 +309,24 @@ function this.SetPlayerRankInfo(msg)
end
-- 设置玩家排行
function this.SetRoleRank(msg)
if #msg.ranks == 0 or not msg.ranks then Log(Language[10317]) return end
function this.SetRoleRank(ranks,myRankInfo)
if #ranks == 0 or not ranks then Log(Language[10317]) return end
local rankFunc = function (index, item)
this.RefreshRankData(item, msg.ranks[index], msg.myRankInfo.rank)
this.RefreshRankData(item, ranks[index], myRankInfo.rank)
if index==#ranks then
RankingManager.RequestNextWarPowerPageData(function()
local ranks,myRank = RankingManager.GetRankingInfo()
this.SetPlayerRankInfo(ranks,myRank)
this.SetRoleRank(ranks,myRank)
end)
end
end
--if MapTrialManager.curPage <= 1 then
-- -- 重置排行列表
this.ScrollView:SetData(msg.ranks, rankFunc)
this.ScrollView:SetData(ranks, rankFunc)
--else
-- -- 刷新排行列表
-- this.ScrollView:RefreshData(msg.towerRanks, rankFunc)

View File

@ -50,23 +50,44 @@ end
--刷新排行榜 index当前排行类型索引
function this.RefreshRank()
NetManager.RequestRankInfo(RANK_TYPE.XUANYUANMIRROR_RANK,function(msg)
this.empty:SetActive(#msg.ranks <= 0)
for i=1,#msg.ranks do
LogGreen("msg.ranks[i].userName:"..msg.ranks[i].userName.."msg.ranks[i].rankInfo.rank:"..msg.ranks[i].rankInfo.rank.."msg.ranks[i].rankInfo.param1:"..msg.ranks[i].rankInfo.param1)
end
LogGreen("msg.myRankInfo:"..PlayerManager.nickName.."msg.myRankInfo.rank:"..msg.myRankInfo.rank.."msg.myRankInfo.param1:"..msg.myRankInfo.param1)
this.scrollView:SetData(msg.ranks,function(index,root)
this.SetScrollPre(root,msg.ranks[index])
end)
-- NetManager.RequestRankInfo(RANK_TYPE.XUANYUANMIRROR_RANK,function(msg)
-- this.empty:SetActive(#msg.ranks <= 0)
-- for i=1,#msg.ranks do
-- LogGreen("msg.ranks[i].userName:"..msg.ranks[i].userName.."msg.ranks[i].rankInfo.rank:"..msg.ranks[i].rankInfo.rank.."msg.ranks[i].rankInfo.param1:"..msg.ranks[i].rankInfo.param1)
-- end
-- LogGreen("msg.myRankInfo:"..PlayerManager.nickName.."msg.myRankInfo.rank:"..msg.myRankInfo.rank.."msg.myRankInfo.param1:"..msg.myRankInfo.param1)
-- this.scrollView:SetData(msg.ranks,function(index,root)
-- this.SetScrollPre(root,msg.ranks[index])
-- end)
-- this.scrollView:SetIndex(1)
-- this.mRRank.gameObject:SetActive((not msg.myRankInfo) or msg.myRankInfo.rank~=-1)
-- if msg.myRankInfo and msg.myRankInfo.rank ~= -1 then
-- this.SetMyRank(msg.myRankInfo)
-- end
-- end)
RankingManager.InitData(RANK_TYPE.XUANYUANMIRROR_RANK,function()
local ranks,myRankInfo = RankingManager.GetRankingInfo()
this.empty:SetActive(#ranks <= 0)
this.SetScrollView(ranks)
this.scrollView:SetIndex(1)
this.mRRank.gameObject:SetActive((not msg.myRankInfo) or msg.myRankInfo.rank~=-1)
if msg.myRankInfo and msg.myRankInfo.rank ~= -1 then
this.SetMyRank(msg.myRankInfo)
this.mRRank.gameObject:SetActive((not myRankInfo) or myRankInfo.rank~=-1)
if myRankInfo and myRankInfo.rank ~= -1 then
this.SetMyRank(myRankInfo)
end
end)
end,nil,1)
end
function this.SetScrollView(ranks)
this.scrollView:SetData(ranks,function(index,root)
this.SetScrollPre(root,ranks[index])
if index==#ranks then
RankingManager.RequestNextWarPowerPageData(function()
local ranks,myRankInfo = RankingManager.GetRankingInfo()
this.SetScrollView(ranks)
end)
end
end)
end
--设置每条数据
function this.SetScrollPre(root,data)
local name=Util.GetGameObject(root,"Grid/Name"):GetComponent("Text")

View File

@ -129,21 +129,14 @@ function this.SetView(type)
this.findFairyScrollView.moveTween.MomentumAmount = 1
this.findFairyScrollView.moveTween.Strength = 2
end
NetManager.RequestRankInfo(
RANK_TYPE.FINDFAIRY_RECORD,
function(msg)
NetManager.RequestRankInfo(RANK_TYPE.FINDFAIRY_RECORD,function(msg)
--msg.myRankInfo.param2 --猎妖师ID
this.noneImage:SetActive(#msg.ranks == 0)
this.findFairyScrollView:SetData(
msg.ranks,
function(index, root)
this.findFairyScrollView:SetData(msg.ranks,function(index, root)
this.FindFairyRecordShow(root, msg.ranks[index])
end
)
end)
this.findFairyScrollView:SetIndex(1)
end,
ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FindFairy)
)
end, ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FindFairy))
elseif CurType == FIND_FAIRY_POPUP_TYPE.ScoreReward then
this.title.text = Language[10625]
this.noneImage:SetActive(false)
@ -194,20 +187,13 @@ function this.SetView(type)
this.curScoreRankScrollView.moveTween.MomentumAmount = 1
this.curScoreRankScrollView.moveTween.Strength = 2
end
NetManager.RequestRankInfo(
10,
function(msg)
NetManager.RequestRankInfo(10,function(msg)
this.noneImage:SetActive(#msg.ranks == 0)
this.CurMyScoreRankShow(msg.myRankInfo)
this.curScoreRankScrollView:SetData(
msg.ranks,
function(index, root)
this.curScoreRankScrollView:SetData(msg.ranks,function(index, root)
this.CurScoreRankShow(root, msg.ranks[index], msg.myRankInfo.rank)
end
)
end,
ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FindFairy)
)
end)
end,ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FindFairy))
end
end

View File

@ -246,39 +246,53 @@ function this.SwitchView(index)
curIndex = index or curIndex
isPlayAnim = true
if curIndex == 2 then
NetManager.RequestRankInfo(RANK_TYPE.GUILD_CAR_DELEAY_SINGLE, function(msg)
this.SetRankDataShow(msg)
--repeated UserRank ranks = 1;
--optional RankInfo myRankInfo = 2;
-- NetManager.RequestRankInfo(RANK_TYPE.GUILD_CAR_DELEAY_SINGLE, function(msg)
-- this.SetRankDataShow(msg)
-- this.myGuildName.text = PlayerManager.nickName
-- end)
RankingManager.InitData(RANK_TYPE.GUILD_CAR_DELEAY_SINGLE,function()
local ranks,myRank = RankingManager.GetRankingInfo()
this.SetRankDataShow(ranks,myRank)
this.myGuildName.text = PlayerManager.nickName
end)
end,nil,1)
elseif curIndex == 1 then
NetManager.RequestRankInfo(RANK_TYPE.GUILD_CAR_DELEAY_GUILD, function(msg)
this.SetRankDataShow(msg)
this.myGuildName.text = MyGuildManager.MyGuildInfo.name
end)
-- NetManager.RequestRankInfo(RANK_TYPE.GUILD_CAR_DELEAY_GUILD, function(msg)
-- this.SetRankDataShow(msg)
-- this.myGuildName.text = MyGuildManager.MyGuildInfo.name
-- end)
RankingManager.InitData(RANK_TYPE.GUILD_CAR_DELEAY_GUILD,function()
local ranks,myRankInfo = RankingManager.GetRankingInfo()
this.SetRankDataShow(ranks,myRankInfo)
this.myGuildName.text = MyGuildManager.MyGuildInfo.name
end,nil,1)
end
end
function this.SetRankDataShow(msg)
if msg.myRankInfo.rank > 0 then
function this.SetRankDataShow(ranks,myRankInfo)
if myRankInfo.rank > 0 then
this.mySortNum:SetActive(true)
local sortNumTabs = {}
for i = 1, 4 do
sortNumTabs[i] = Util.GetGameObject(this.mySortNum, "SortNum ("..i..")")
sortNumTabs[i]:SetActive(false)
end
if msg.myRankInfo.rank < 4 then
sortNumTabs[msg.myRankInfo.rank]:SetActive(true)
if myRankInfo.rank < 4 then
sortNumTabs[myRankInfo.rank]:SetActive(true)
else
sortNumTabs[4]:SetActive(true)
Util.GetGameObject(sortNumTabs[4], "TitleText"):GetComponent("Text").text = msg.myRankInfo.rank
Util.GetGameObject(sortNumTabs[4], "TitleText"):GetComponent("Text").text = myRankInfo.rank
end
else
this.mySortNum:SetActive(false)
end
this.mySore.text = msg.myRankInfo.param1 > 0 and PrintWanNum3(msg.myRankInfo.param1) or Language[10148]
this.ScrollView:SetData(msg.ranks, function (index, go)
this.SingleRankDataShow(go, msg.ranks[index])
this.mySore.text = myRankInfo.param1 > 0 and PrintWanNum3(msg.myRankInfo.param1) or Language[10148]
this.ScrollView:SetData(ranks, function (index, go)
this.SingleRankDataShow(go, ranks[index])
if index==#ranks then
RankingManager.RequestNextWarPowerPageData(function()
local ranks,myRankInfo = RankingManager.GetRankingInfo()
this.SetRankDataShow(ranks,myRankInfo)
end)
end
end)
if isPlayAnim then
SecTorPlayAnimByScroll(this.ScrollView)

View File

@ -240,22 +240,47 @@ function this.RefreshRank(index)
elseif index==2 then
curRankType=RANK_TYPE.GUILD_DEATHPOS_PERSON --个人排行
end
NetManager.RequestRankInfo(curRankType,function(msg)
this.empty:SetActive(#msg.ranks<=0)
this.scrollView:SetData(msg.ranks,function(index,root)
this.SetScrollPre(root,msg.ranks[index],curRankType)
end)
this.scrollView:SetIndex(1)
-- NetManager.RequestRankInfo(curRankType,function(msg)
-- this.empty:SetActive(#msg.ranks<=0)
-- this.scrollView:SetData(msg.ranks,function(index,root)
-- this.SetScrollPre(root,msg.ranks[index],curRankType)
-- end)
-- this.scrollView:SetIndex(1)
-- --当我的排名没数据时
-- this.mRSortNum:SetActive(msg.myRankInfo.rank~=-1)
-- if msg.myRankInfo.rank==-1 then
-- this.mRName.text=Language[10041]
-- this.mRHurt.text=""
-- return
-- end
-- this.SetMyRank(msg.myRankInfo,curRankType)
-- end,curIndex)
RankingManager.InitData(curRankType,function()
local ranks,myRankInfo = RankingManager.GetRankingInfo()
this.empty:SetActive(#ranks<=0)
this.SetRankDataShow(ranks,myRankInfo,curRankType)
this.scrollView:SetIndex(1)
--当我的排名没数据时
this.mRSortNum:SetActive(msg.myRankInfo.rank~=-1)
if msg.myRankInfo.rank==-1 then
this.mRSortNum:SetActive(myRankInfo.rank~=-1)
if myRankInfo.rank==-1 then
this.mRName.text=Language[10041]
this.mRHurt.text=""
return
end
this.SetMyRank(msg.myRankInfo,curRankType)
end,curIndex)
this.SetMyRank(myRankInfo,curRankType)
end,curIndex,1)
end
function this.SetRankDataShow(ranks,myRankInfo,curRankType)
this.scrollView:SetData(ranks,function(index,root)
this.SetScrollPre(root,ranks[index],curRankType)
if index==#ranks then
RankingManager.RequestNextWarPowerPageData(function()
local ranks,myRankInfo = RankingManager.GetRankingInfo()
this.SetRankDataShow(ranks,myRankInfo,curRankType)
end)
end
end)
end
--设置每条数据
function this.SetScrollPre(root,data,curRankType)

View File

@ -109,25 +109,51 @@ function this.RefreshRank(index)
elseif index==2 then
curRankType=RANK_TYPE.GUILD_DEATHPOS_ALLPERSON --个人排行
end
NetManager.RequestRankInfo(curRankType,function(msg)
this.empty:SetActive(#msg.ranks<=0)
this.scrollView:SetData(msg.ranks,function(index,root)
this.SetScrollPre(root,msg.ranks[index],curRankType)
end)
this.scrollView:SetIndex(1)
-- NetManager.RequestRankInfo(curRankType,function(msg)
-- this.empty:SetActive(#msg.ranks<=0)
-- this.scrollView:SetData(msg.ranks,function(index,root)
-- this.SetScrollPre(root,msg.ranks[index],curRankType)
-- end)
-- this.scrollView:SetIndex(1)
-- --当我的排名没数据时
-- this.mRSortNum:SetActive(msg.myRankInfo.rank~=-1)
-- this.mRNum.gameObject:SetActive(msg.myRankInfo.rank~=-1)
-- if msg.myRankInfo.rank==-1 then
-- this.mRName.text=Language[10041]
-- this.mRHurt.text=""
-- return
-- end
-- this.SetMyRank(msg.myRankInfo,curRankType)
-- end)
RankingManager.InitData(RANK_TYPE.XUANYUANMIRROR_RANK,function()
local ranks,myRankInfo = RankingManager.GetRankingInfo()
this.empty:SetActive(#ranks<=0)
this.SetScrollView(ranks,curRankType)
this.scrollView:SetIndex(1)
--当我的排名没数据时
this.mRSortNum:SetActive(msg.myRankInfo.rank~=-1)
this.mRNum.gameObject:SetActive(msg.myRankInfo.rank~=-1)
if msg.myRankInfo.rank==-1 then
this.mRSortNum:SetActive(myRankInfo.rank~=-1)
this.mRNum.gameObject:SetActive(myRankInfo.rank~=-1)
if myRankInfo.rank==-1 then
this.mRName.text=Language[10041]
this.mRHurt.text=""
return
end
this.SetMyRank(msg.myRankInfo,curRankType)
end)
this.SetMyRank(myRankInfo,curRankType)
end,nil,1)
end
function this.SetScrollView(ranks,curRankType)
this.scrollView:SetData(ranks,function(index,root)
this.SetScrollPre(root,ranks[index],curRankType)
if index==#ranks then
RankingManager.RequestNextWarPowerPageData(function()
local ranks,myRankInfo = RankingManager.GetRankingInfo()
this.SetScrollView(ranks)
end)
end
end)
end
--设置每条数据
function this.SetScrollPre(root,data,curRankType)
local name=Util.GetGameObject(root,"Grid/Name"):GetComponent("Text")

View File

@ -63,21 +63,43 @@ function this:InitRankView()
end)
--请求排行信息
NetManager.RequestRankInfo(RANK_TYPE.GUILD_REDPACKET, function (msg)
this.firstPlayerHead:SetActive(#msg.ranks>0)
this.detailBtn:SetActive(#msg.ranks>0)
this.noRank:SetActive(#msg.ranks==0)
if #msg.ranks==0 then this.firstPlayerName.text=Language[11073] end
-- NetManager.RequestRankInfo(RANK_TYPE.GUILD_REDPACKET, function (msg)
-- this.firstPlayerHead:SetActive(#msg.ranks>0)
-- this.detailBtn:SetActive(#msg.ranks>0)
-- this.noRank:SetActive(#msg.ranks==0)
-- if #msg.ranks==0 then this.firstPlayerName.text=Language[11073] end
this.scrollView:SetData(msg.ranks,function(index, root)
if index==1 then
this:SetFirstShow(msg.ranks[index])
end
this:SetShow(root, msg.ranks[index],msg.myRankInfo.rank)
end)
end)
-- this.scrollView:SetData(msg.ranks,function(index, root)
-- if index==1 then
-- this:SetFirstShow(msg.ranks[index])
-- end
-- this:SetShow(root, msg.ranks[index],msg.myRankInfo.rank)
-- end)
-- end)
RankingManager.InitData(RANK_TYPE.GUILD_REDPACKET,function()
local ranks,myRankInfo = RankingManager.GetRankingInfo()
this.firstPlayerHead:SetActive(#ranks>0)
this.detailBtn:SetActive(#ranks>0)
this.noRank:SetActive(#ranks==0)
if #ranks==0 then this.firstPlayerName.text=Language[11073] end
this.SetRankDataShow(ranks,myRankInfo)
end,nil,1)
end
function this.SetRankDataShow(ranks,myRankInfo)
this.scrollView:SetData(ranks,function(index, root)
if index==1 then
this:SetFirstShow(ranks[index])
end
this:SetShow(root, ranks[index],myRankInfo.rank)
if index==#ranks then
RankingManager.RequestNextWarPowerPageData(function()
local ranks,myRankInfo = RankingManager.GetRankingInfo()
this.SetRankDataShow(ranks,myRankInfo)
end)
end
end)
end
--设置第一数据
function this:SetFirstShow(data)
if not this.firstHead[this.firstPre] then this.firstHead[this.firstPre]= CommonPool.CreateNode(POOL_ITEM_TYPE.PLAYER_HEAD, this.firstPlayerHead) end

View File

@ -2071,10 +2071,11 @@ function this.RequestTrialRank(func)
end
-- 所有排行榜都走这个协议
function this.RequestRankInfo(rankType, func, id)
function this.RequestRankInfo(rankType, func, id,_index)
local data = PlayerInfoProto_pb.RankRequest()
data.type = rankType
data.activiteId = id or 0
data.index = _index or 1
local msg = data:SerializeToString()
Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_ONE_RANK_REQUEST, MessageTypeProto_pb.GET_ONE_RANK_RESPONSE, msg, function(buffer)
local data = buffer:DataByte()

View File

@ -9,15 +9,30 @@ this.isRequest=0--防止连续请求
function this.Initialize()
end
local cur_rankType = 0
local cur_activiteId = 0
local cur_rankIndex = 0
local cur_isMax = false
--初始化排行数据(待优化)
function this.InitData(rankType,fun,id)
function this.InitData(rankType,fun,id,rankIndex)
cur_rankType = rankType
local activiteId = (id ~= nil and id > 0) and id or nil--点金时需要 当为公会副本是为章节id
cur_activiteId = activiteId
cur_rankIndex = 1
cur_isMax = false
NetManager.RequestRankInfo(rankType, function (msg)--请求数据
this.ReceiveRankingData(msg,fun)
end,activiteId)
end,activiteId,cur_rankIndex)
end
--请求排行榜下面数据
function this.RequestNextWarPowerPageData(fun)
if cur_isMax then LogGreen("排行榜数据到头") return end
LogGreen("cur_rankIndex "..cur_rankIndex)
NetManager.RequestRankInfo(cur_rankType, function (msg)--请求数据
this.ReceiveNextRankingData(msg,fun)
end,cur_activiteId,cur_rankIndex)
end
---战力战力
--接收服务器战力数据
function this.ReceiveRankingData(msg,fun)
@ -27,11 +42,30 @@ function this.ReceiveRankingData(msg,fun)
--滚动数据
local length=#this.curRankingData
for i, rank in ipairs(msg.ranks) do
LogGreen("UserRank "..rank.rankInfo.rank)
this.curRankingData[length+i]=rank
end
if #msg.ranks < 20 or #this.curRankingData >= 100 then
cur_isMax = true
end
cur_rankIndex = cur_rankIndex + #msg.ranks
if fun then fun() end
-- Game.GlobalEvent:DispatchEvent(GameEvent.RankingList.AllRankingList)
end
--接收服务器战力数据
function this.ReceiveNextRankingData(msg,fun)
--滚动数据
local length=#this.curRankingData
for i, rank in ipairs(msg.ranks) do
LogGreen("UserRank "..rank.rankInfo.rank)
this.curRankingData[length+i]=rank
end
if #msg.ranks < 20 or #this.curRankingData >= 100 then
cur_isMax = true
end
cur_rankIndex = cur_rankIndex + #msg.ranks
if fun then fun() end
end
--获取排行榜信息
function this.GetRankingInfo()
return this.curRankingData, this.curRankingMyRankData

View File

@ -64,7 +64,7 @@ function RankingSingleListPanel:OnOpen(_sData)
SoundManager.PlayMusic(SoundConfig.BGM_Rank)
sData = _sData
this.name.text = sData.name
this.GetRankInfo(sData.rankType)
this.GetRankInfo(sData.rankType,1)
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
@ -103,13 +103,13 @@ end
--点击获取对应排行信息
function this.GetRankInfo(rankType)
function this.GetRankInfo(rankType,rankIndex)
RankingManager.CurPage=0
this.istop=true
local curActivity = sData.activiteId > 0 and ActivityGiftManager.GetActivityIdByType(sData.activiteId) or nil
RankingManager.InitData(rankType,function()
this.SetRankingInfo()
end,curActivity)
end,curActivity,rankIndex)
end
---设置排名信息
@ -157,10 +157,13 @@ function this.SetRankingInfo()
this.SetHeadsInfo(dt[1],this.firstHeadinfoGo,1,dt[1].userName,dt[1].level)
--设置滚动区信息
this.scrollView:SetData(db,function(index,root)
this.ShowWarPowerInfo(root,db[index],myRankData)
-- if index==#db then
-- RankingManager.RequestNextWarPowerPageData()
-- end
this.ShowWarPowerInfo(root,db[index],myRankData,index)
LogGreen("#db "..#db.." index "..index)
if index==#db then
RankingManager.RequestNextWarPowerPageData(function()
this.SetRankingInfo()
end)
end
end)
end
--显示每条数据

View File

@ -25,31 +25,39 @@ end
function this.GetSevenDayCarnivalRedPoint()
local redPoint = false
local isActivityOpen = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.SevenDayCarnival)
LogGreen("开服狂欢红点判断 isActivityOpen "..tostring(isActivityOpen))
if isActivityOpen then
local activityInfo = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.SevenDayCarnival)
local timeDown = activityInfo.endTime - GetTimeStamp()
LogGreen("开服狂欢红点判断 timeDown "..timeDown)
if timeDown > 0 then-- - 86400
local taskList = TaskManager.GetTypeTaskList(TaskTypeDef.SevenDayCarnival)
table.walk(taskList, function(taskInfo)
local treasureTaskConfig = ConfigManager.GetConfigData(ConfigName.TreasureTaskConfig, taskInfo.missionId)
LogGreen("开服狂欢红点判断 this.GetCurrentDayNumber() "..this.GetCurrentDayNumber())
if this.GetCurrentDayNumber() >= treasureTaskConfig.DayNum then
redPoint = redPoint or (taskInfo.state == VipTaskStatusDef.CanReceive)
end
end)
LogGreen("开服狂欢红点判断 this.GetSevenDayHalfPriceRedPoint(this.GetCurrentDayNumber() "..tostring(this.GetSevenDayHalfPriceRedPoint(this.GetCurrentDayNumber())))
redPoint = redPoint or this.GetSevenDayHalfPriceRedPoint(this.GetCurrentDayNumber())
end
LogGreen("开服狂欢红点判断 this.GetBoxRedPointStatus() "..tostring(this.GetBoxRedPointStatus()))
redPoint = redPoint or this.GetBoxRedPointStatus()
end
if not redPoint then
local curDayIndex = SevenDayCarnivalManager.GetCurrentDayNumber()
if curDayIndex and curDayIndex > 0 then
LogGreen("开服狂欢红点判断 curDayIndex "..curDayIndex)
for i = 1, curDayIndex do
LogGreen("开服狂欢红点判断 i this.GetSevenDayCarnivalRedPoint2(i) "..i.." "..this.GetSevenDayCarnivalRedPoint2(i))
if this.GetSevenDayCarnivalRedPoint2(i) then
redPoint = true
end
end
end
end
LogGreen("开服狂欢红点判断 end "..tostring(redPoint))
return redPoint
end
--添加另一组半价数据红点状态