排名
This commit is contained in:
parent
2865ece26e
commit
24040bdc34
@ -9,6 +9,8 @@ namespace Dto
|
||||
{
|
||||
public class GroupJumpRopeContext
|
||||
{
|
||||
// 静态字段,保存排名列表
|
||||
public static List<RankItem> RankList { get; set; } = new List<RankItem>();
|
||||
public List<(double XNorm, double YNorm)> CirclePositions { get; private set; }
|
||||
public List<SportUserItem> UserList { get; private set; }
|
||||
public List<string> UserNumberList { get; private set; }
|
||||
@ -34,5 +36,33 @@ namespace Dto
|
||||
Sports = new List<SportBase>();
|
||||
|
||||
}
|
||||
|
||||
// 更新排行榜方法
|
||||
public void UpdateRankList()
|
||||
{
|
||||
RankList = UserNumberList
|
||||
.Select((numStr, index) => new
|
||||
{
|
||||
Index = index,
|
||||
Name = UseNameList[index],
|
||||
Number = int.TryParse(numStr, out var n) ? n : 0
|
||||
})
|
||||
.OrderByDescending(x => x.Number)
|
||||
.Select((x, rank) => new RankItem
|
||||
{
|
||||
Rank = rank + 1,
|
||||
Name = x.Name,
|
||||
Number = x.Number
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
// 排名项
|
||||
public class RankItem
|
||||
{
|
||||
public int Rank { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int Number { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,6 +263,8 @@ namespace Wpf_AiSportsMicrospace.Views
|
||||
x.ImageState = "1";
|
||||
});
|
||||
|
||||
_groupJumpRopeContext.UpdateRankList();
|
||||
|
||||
IsGameStarted = false;
|
||||
Utils.StopBackgroundMusic();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user