RankingManager = {} local this = RankingManager this.CurPage=0 this.curRankingData={}--战力排行滚动数据 this.curRankingMyRankData={} --我的数据 this.mainLevelConfig={} 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,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,cur_rankIndex) end --请求排行榜下面数据 function this.RequestNextWarPowerPageData(fun) if cur_isMax then LogGreen(Language[12215]) return end Log("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) --自身数据 this.curRankingData = {} this.curRankingMyRankData=msg.myRankInfo --滚动数据 local length=#this.curRankingData for i, rank in ipairs(msg.ranks) do -- Log("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 end function this.GetGoldExperSortInfo() return this.GoldExperData,this.GoldExperMyRankData end --膜拜信息 local RankProud = {} local firstRankProud = {}--后端临时数据 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 function this.SetAllFirstRankProud(types,_firstRankProud) for i = 1, #_firstRankProud do firstRankProud[types[i]] = _firstRankProud[i] end end function this.GetAllFirstRankProud() return firstRankProud end --数据拆分 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 --膜拜红点 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 return this