Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix daily challenge results screen fetching scores beginning from the user's highest #30852

Merged
merged 8 commits into from
Nov 28, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ private void updateMods()
private void startPlay()
{
sampleStart?.Play();
this.Push(new PlayerLoader(() => new PlaylistsPlayer(room, playlistItem)
this.Push(new PlayerLoader(() => new DailyChallengePlayer(room, playlistItem)
{
Exited = () => Scheduler.AddOnce(() => leaderboard.RefetchScores())
}));
Expand Down
41 changes: 41 additions & 0 deletions osu.Game/Screens/OnlinePlay/DailyChallenge/DailyChallengePlayer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// 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 System.Diagnostics;
using osu.Game.Online.Rooms;
using osu.Game.Scoring;
using osu.Game.Screens.OnlinePlay.Playlists;
using osu.Game.Screens.Play;
using osu.Game.Screens.Ranking;

namespace osu.Game.Screens.OnlinePlay.DailyChallenge
{
public partial class DailyChallengePlayer : PlaylistsPlayer
{
public DailyChallengePlayer(Room room, PlaylistItem playlistItem, PlayerConfiguration? configuration = null)
: base(room, playlistItem, configuration)
{
}

protected override ResultsScreen CreateResults(ScoreInfo score)
{
Debug.Assert(Room.RoomID != null);

if (score.OnlineID >= 0)
{
return new PlaylistItemScoreResultsScreen(Room.RoomID.Value, PlaylistItem, score.OnlineID)
{
AllowRetry = true,
ShowUserStatistics = true,
};
}

// If the score has failed submission, fall back to displaying scores from user's highest.
return new PlaylistItemUserResultsScreen(score, Room.RoomID.Value, PlaylistItem)
{
AllowRetry = true,
ShowUserStatistics = true,
};
}
}
}
Loading