Example #1
0
 /// <summary>
 /// 刷新排行榜数据
 /// </summary>
 void RefreshRank()
 {
     if (rankDic.Count == 0)
     {
         curPage--;
     }
     using (var data = rankDic.GetEnumerator())
     {
         while (data.MoveNext())
         {
             if (!infoList.Contains(data.Current.Value))
             {
                 infoList.Add(data.Current.Value);
             }
         }
     }
     for (int i = 0; i < rankItemList.Count; i++)
     {
         if (i >= infoList.Count)
         {
             rankItemList[i].SetActive(false);
         }
         else
         {
             rankItemList[i].SetActive(true);
             RankingItem rankingItem = rankItemList[i].GetComponent <RankingItem>();
             if (rankingItem != null)
             {
                 rankingItem.rankNumLabel.text = (i + 1).ToString();
                 rankingItem.Refresh(infoList[i], rankType);
             }
         }
     }
     if (infoList.Count == 0)//没有玩家的排行榜不显示模型
     {
         GameCenter.previewManager.ClearModel();
     }
     if (infoList.Count != 0 && isChangeTog)
     {
         GameCenter.newRankingMng.CurChooseRankPlayerId = infoList[0].PlayerId;
         GameCenter.previewManager.C2S_ReqGetInfo(infoList[0].PlayerId, rankType == 6 ? 1 : 0);
         isChangeTog = false;
     }
 }