赛事排名微调
This commit is contained in:
1 parent
211967dda2
commit
125e9a48c6
7 files changed
+175
-26
No files matched your search
@@ -67,8 +67,11 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
isnext = true;
|
||||
CreateList();
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
protected override void CreateList()
|
||||
{
|
||||
index = 0;
|
||||
CompetitionModel s = cyclingController.cyclingController as CompetitionModel;
|
||||
var ss = s?.competitionRankingModel;
|
||||
rankingList = ss?.Sorts;
|
||||
@@ -76,6 +79,12 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
if (rankingList == null) return;
|
||||
|
||||
rankingList = rankingList.OrderByDescending(u => u.IsCompleted).ThenBy(d => d.CreateTime).ThenByDescending(d => d.EndDistance).ToList();
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
rankingList = rankingList.Where(c=>!c.IsCompleted).OrderByDescending(d => d.EndDistance).ToList();
|
||||
#else
|
||||
rankingList = rankingList.OrderByDescending(u => u.IsCompleted).ThenBy(d => d.CreateTime).ThenByDescending(d => d.EndDistance).ToList();
|
||||
#endif
|
||||
|
||||
//当前参赛总人数
|
||||
var totalCount = rankingList.Count();
|
||||
OnlineUserNum.text = " "+totalCount.ToString();
|
||||
@@ -106,9 +115,11 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
o.transform.SetAsFirstSibling();
|
||||
}
|
||||
|
||||
//创建或者新增
|
||||
for (int i = 0; i < pagedList.Count(); i++)
|
||||
{
|
||||
index++;
|
||||
CreateOrUpdate(pagedList[i]);
|
||||
}
|
||||
|
||||
@@ -144,7 +155,11 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
|
||||
competitionRankingItem.setUserId(item.UserId);
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
competitionRankingItem.SetRank(index);
|
||||
#else
|
||||
competitionRankingItem.SetRank(item.Index);
|
||||
#endif
|
||||
competitionRankingItem.setName(item.Name);
|
||||
competitionRankingItem.setRatio(item.KGWeight + "W/KG");
|
||||
competitionRankingItem.setSpeed(item.Speed.ToString() + "KM/H");
|
||||
@@ -153,7 +168,11 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
competitionRankingItem.setCountry(countryTexture);
|
||||
var near = Math.Round((item.EndDistance - cyclingController.currentPlayer.TotalDistance)*1000);
|
||||
competitionRankingItem.setDistance(cyclingController.currentPlayer.UserId == item.UserId?"0M": near.ToString() + "M");
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
competitionRankingItem.transform.SetSiblingIndex(index);
|
||||
#else
|
||||
competitionRankingItem.transform.SetSiblingIndex(item.Index);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user