mirror of
https://github.com/ppy/osu.git
synced 2026-05-20 21:01:17 +08:00
59b826c321
This PR converts the leaderboard into a full-fledged skinnable component that can be manipulated by users at will. Notably, this finally allows https://github.com/ppy/osu/issues/20422 to be fixed - although it's a very mixed bag, for several reasons: - Because of taiko players' refusal to see reason^W^W^W^Winsistence on keeping stable behaviours related to aspect ratio treatment, I have to assume the worst case scenario, which means than on typical resolutions like 16:9 (or even worse, 4:3), the leaderboard will likely not occupy as much vertical space as it probably could. - Additionally, there's the problem of where to put the spectator list. I settled on putting it to the right of the leaderboard, but that's kind of janky, because the leaderboard sometimes collapses and sometimes fully hides, leading to a very awkward space left behind. If we had the capability to anchor elements to other elements, maybe this could be resolved, but for now, I'm not sure what to do. I think if some users are bothered by it they can move it where they want it. Or delete it.
63 lines
1.9 KiB
C#
63 lines
1.9 KiB
C#
// 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.
|
|
|
|
#nullable disable
|
|
|
|
using System;
|
|
using System.Diagnostics;
|
|
using JetBrains.Annotations;
|
|
using osu.Framework.Allocation;
|
|
using osu.Game.Beatmaps;
|
|
using osu.Game.Extensions;
|
|
using osu.Game.Online.API;
|
|
using osu.Game.Online.Rooms;
|
|
using osu.Game.Online.Solo;
|
|
using osu.Game.Scoring;
|
|
using osu.Game.Screens.Select.Leaderboards;
|
|
|
|
namespace osu.Game.Screens.Play
|
|
{
|
|
public partial class SoloPlayer : SubmittingPlayer
|
|
{
|
|
[Cached(typeof(IGameplayLeaderboardProvider))]
|
|
private readonly SoloGameplayLeaderboardProvider leaderboardProvider = new SoloGameplayLeaderboardProvider();
|
|
|
|
public SoloPlayer([CanBeNull] PlayerConfiguration configuration = null)
|
|
: base(configuration)
|
|
{
|
|
Configuration.ShowLeaderboard = true;
|
|
}
|
|
|
|
[BackgroundDependencyLoader]
|
|
private void load()
|
|
{
|
|
AddInternal(leaderboardProvider);
|
|
}
|
|
|
|
protected override APIRequest<APIScoreToken> CreateTokenRequest()
|
|
{
|
|
int beatmapId = Beatmap.Value.BeatmapInfo.OnlineID;
|
|
int rulesetId = Ruleset.Value.OnlineID;
|
|
|
|
if (beatmapId <= 0)
|
|
return null;
|
|
|
|
if (!Ruleset.Value.IsLegacyRuleset())
|
|
return null;
|
|
|
|
return new CreateSoloScoreRequest(Beatmap.Value.BeatmapInfo, rulesetId, Game.VersionHash);
|
|
}
|
|
|
|
protected override bool ShouldExitOnTokenRetrievalFailure(Exception exception) => false;
|
|
|
|
protected override APIRequest<MultiplayerScore> CreateSubmissionRequest(Score score, long token)
|
|
{
|
|
IBeatmapInfo beatmap = score.ScoreInfo.BeatmapInfo!;
|
|
|
|
Debug.Assert(beatmap.OnlineID > 0);
|
|
|
|
return new SubmitSoloScoreRequest(score.ScoreInfo, token, beatmap.OnlineID);
|
|
}
|
|
}
|
|
}
|