local lvw = self.csbNodes.KW_rank_list
lvw:stopAllActions()
lvw:removeAllChildren()
lvw:jumpToTop()
--设置自己的信息
if nInfo.myRank <= 0 then --自己排名未0为未上榜
self.csbNodes.KW_total_rank:setString("当前排名未上榜")
self.csbNodes.KW_reward_tip:setVisible(false)
else
self.csbNodes.KW_total_rank:setString("当前排名:"..nInfo.myRank)
self.csbNodes.KW_reward_tip:setVisible(true)
self.csbNodes.KW_reward_tip:setString("比赛结束后记得去邮件领奖哦")
end
self.csbNodes.KW_reward_Icon:setString(nInfo.myValue)
local shownum = TotalRank
local rewardInfo = Ddzmatch.total
if ntype == 4 then
shownum = DayRank
rewardInfo = Ddzmatch.normal
end
local function getRankInfo(nPlayInfo)
local nstart = 1
local function InitItemList(nvent)
local istrue = false
local nbegin = nstart
if nvent and type(nvent) == "boolean" and nvent == true then
istrue = true
elseif nvent and type(nvent) == "table" and nvent.name == "SCROLL_TO_BOTTOM"then
if nstart <= shownum - 10 then
local LayerSystem = import("..base.LayerSystem", CUR_PATH)
LayerSystem.showLayer(LayerSystem.LayerType.Loading, "正在拉取数据...", 1)
end
istrue = true
end
if istrue == false then
return
end
local listItem = self.csbNodes.KW_list_item
local nend = (nstart + 9) <= shownum and nstart + 9 or shownum
for i = nstart,nend do
nstart = nstart + 1
local item = listItem:clone()
lvw:pushBackCustomItem(item)
item:setTag(i)
local info = self:_getRewardInfo(rewardInfo,i)
local nodebg = item:getChildByName("KW_reward_bg")
--显示奖品图片
local str = ""
for j = 1,2 do
if info.reward[j] then
BUI:newTexture(nodebg:getChildByName("KW_reward_img_"..j),info.reward[j].picName,ccui.TextureResType.plistType)
nodebg:getChildByName("KW_reward_img_"..j):ignoreContentAdaptWithSize(true)
if info.reward[j].num ~= 1 then
str = str..string.format("%d ",info.reward[j].num)
end
else
nodebg:getChildByName("KW_reward_img_"..j):setVisible(false)
end
end
nodebg:getChildByName("KW_reward_label"):setString(str)
--显示排名
item:getChildByName("KW_rank_1"):setVisible(false)
item:getChildByName("KW_rank_num"):setVisible(false)
if i <= 3 then
item:getChildByName("KW_rank_1"):setVisible(true)
item:getChildByName("KW_rank_1"):loadTexture(Path.."ing_rann_"..i..".png")
else
item:getChildByName("KW_rank_num"):setVisible(true)
item:getChildByName("KW_rank_num"):setString(i)
end
--玩家信息
if nInfo.rankList[i*2 -1] and nInfo.rankList[i*2] then
item:getChildByName("KW_medal_num"):setString(nInfo.rankList[i*2])
item:getChildByName("KW_medal_num"):setVisible(true)
item:getChildByName("KW_Jianzhang"):setVisible(true)
local nickName = self:_getItemName(ncur)
for key, var in pairs(nPlayInfo) do
if tonumber(var.numid) == tonumber(nInfo.rankList[i*2 -1]) then
nickName = var.nickname
break
end
end
item:getChildByName("KW_nickname"):setString(nickName)
else
item:getChildByName("KW_medal_num"):setVisible(false)
item:getChildByName("KW_Jianzhang"):setVisible(false)
local nickName = self:_getItemName(ncur)
item:getChildByName("KW_nickname"):setString(nickName)
end
end
lvw:jumpToPercentVertical(((nbegin-1)/nend)*100)
end
InitItemList(true)
lvw:onScroll(InitItemList)
end
Presenter.Hero.reqNickNameByNumid(nInfo.rankList,getRankInfo)
--隐藏loading
local LayerSystem = import("..base.LayerSystem", CUR_PATH)
LayerSystem.hideLayer(LayerSystem.LayerType.Loading)