赛事排名微调
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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -94,8 +94,8 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||
{
|
||||
try
|
||||
{
|
||||
if (recorderData.Saved)
|
||||
return;
|
||||
//if (recorderData.Saved)
|
||||
// return;
|
||||
if (recorderData.RiderDatas.Any())
|
||||
{
|
||||
var lastData = recorderData.RiderDatas.Last();
|
||||
|
||||
@@ -143,25 +143,26 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||
WeightKg = item.WeightKg,
|
||||
});
|
||||
}
|
||||
|
||||
index++;
|
||||
double near = Math.Round(item.EndDistance - currentDistance,2); //Math.Round(TurfHelper.GetDistances(point, item.Point), 2);
|
||||
|
||||
sort.Add(new CompetitionRankingSortModel
|
||||
{
|
||||
Index = index,
|
||||
Name = item.Name,
|
||||
Near = near,
|
||||
KGWeight = Math.Round(item.WeightKg, 2).ToString(),
|
||||
Speed = Math.Round(item.Speed, 1),
|
||||
CountryImg = item.Country,//ConfigHelper.Host + $"User/GetCountryImg?userid={ item.Id }",
|
||||
UserId = item.Id,
|
||||
IsSelf = item.IsSelf,
|
||||
Headimage = item.HeadImage,
|
||||
CreateTime = DateTime.MaxValue,
|
||||
EndDistance = item.EndDistance,
|
||||
IsCompleted = item.IsCompleted
|
||||
});
|
||||
index++;
|
||||
double near = Math.Round(item.EndDistance - currentDistance, 2); //Math.Round(TurfHelper.GetDistances(point, item.Point), 2);
|
||||
|
||||
sort.Add(new CompetitionRankingSortModel
|
||||
{
|
||||
Index = index,
|
||||
Name = item.Name,
|
||||
Near = near,
|
||||
KGWeight = Math.Round(item.WeightKg, 2).ToString(),
|
||||
Speed = Math.Round(item.Speed, 1),
|
||||
CountryImg = item.Country,//ConfigHelper.Host + $"User/GetCountryImg?userid={ item.Id }",
|
||||
UserId = item.Id,
|
||||
IsSelf = item.IsSelf,
|
||||
Headimage = item.HeadImage,
|
||||
CreateTime = DateTime.MaxValue,
|
||||
EndDistance = item.EndDistance,
|
||||
IsCompleted = item.IsCompleted
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,6 +180,7 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||
mapWorkoutRecordRankings = rrr.data;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var ranking in mapWorkoutRecordRankings)
|
||||
{
|
||||
//var ranking = mapWorkoutRecordRankings.SingleOrDefault(r => r.UserId == item.Id);
|
||||
|
||||
@@ -456,11 +456,11 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
{
|
||||
if (cyclingController != null)
|
||||
{
|
||||
//tcp数据传输
|
||||
if (competition != null && !cyclingController.recorderData.Saved)
|
||||
{
|
||||
cyclingController.recorderData.Saved = competition.HasRecord;
|
||||
}
|
||||
////tcp数据传输
|
||||
//if (competition != null && !cyclingController.recorderData.Saved)
|
||||
//{
|
||||
// cyclingController.recorderData.Saved = competition.HasRecord;
|
||||
//}
|
||||
cyclingController.Run(null);
|
||||
//在线人物或比赛人物渲染
|
||||
ShowOnlineUsers();
|
||||
|
||||
Reference in new issue
Block a user