2022-09-10 06:10:55 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
|
|
|
using osu.Game.Online.Leaderboards;
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Play.HUD
|
|
|
|
{
|
|
|
|
public class SoloGameplayLeaderboard : GameplayLeaderboard
|
|
|
|
{
|
|
|
|
[BackgroundDependencyLoader]
|
2022-09-13 15:04:38 +08:00
|
|
|
private void load(Player player, ScoreProcessor processor, ILeaderboard leaderboard)
|
2022-09-10 06:10:55 +08:00
|
|
|
{
|
2022-09-13 15:04:38 +08:00
|
|
|
ILeaderboardScore local = Add(player.Score.ScoreInfo.User, true);
|
|
|
|
|
2022-09-10 06:10:55 +08:00
|
|
|
local.TotalScore.BindTarget = processor.TotalScore;
|
|
|
|
local.Accuracy.BindTarget = processor.Accuracy;
|
|
|
|
local.Combo.BindTarget = processor.Combo;
|
|
|
|
|
2022-09-13 15:04:38 +08:00
|
|
|
foreach (var s in leaderboard.Scores)
|
2022-09-10 06:10:55 +08:00
|
|
|
{
|
|
|
|
// todo: APIUser is pain for IScoreInfo.
|
|
|
|
var score = Add(new APIUser
|
|
|
|
{
|
2022-09-13 15:04:38 +08:00
|
|
|
Id = s.User.OnlineID,
|
|
|
|
Username = s.User.Username,
|
2022-09-10 06:10:55 +08:00
|
|
|
}, false);
|
|
|
|
|
2022-09-13 15:04:38 +08:00
|
|
|
score.TotalScore.Value = s.TotalScore;
|
|
|
|
score.Accuracy.Value = s.Accuracy;
|
|
|
|
score.Combo.Value = s.MaxCombo;
|
2022-09-10 06:10:55 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|