1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-25 00:20:49 +08:00

Show true beatmap background when viewing historical multiplayer results

This commit is contained in:
Dan Balasescu
2025-04-23 16:28:44 +09:00
Unverified
parent 0b694fdef2
commit 65cf1a4b7c
@@ -2,9 +2,12 @@
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Allocation;
using osu.Game.Beatmaps;
using osu.Game.Online.API;
using osu.Game.Online.Rooms;
using osu.Game.Scoring;
using osu.Game.Screens.Backgrounds;
namespace osu.Game.Screens.OnlinePlay.Playlists
{
@@ -14,6 +17,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
public partial class PlaylistItemUserBestResultsScreen : PlaylistItemResultsScreen
{
private readonly int userId;
private WorkingBeatmap itemBeatmap = null!;
public PlaylistItemUserBestResultsScreen(long roomId, PlaylistItem playlistItem, int userId)
: base(null, roomId, playlistItem)
@@ -21,6 +25,13 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
this.userId = userId;
}
[BackgroundDependencyLoader]
private void load(BeatmapManager beatmaps)
{
var localBeatmap = beatmaps.QueryBeatmap($@"{nameof(BeatmapInfo.OnlineID)} == $0 AND {nameof(BeatmapInfo.MD5Hash)} == {nameof(BeatmapInfo.OnlineMD5Hash)}", PlaylistItem.Beatmap.OnlineID);
itemBeatmap = beatmaps.GetWorkingBeatmap(localBeatmap);
}
protected override APIRequest<MultiplayerScore> CreateScoreRequest() => new ShowPlaylistUserScoreRequest(RoomId, PlaylistItem.ID, userId);
protected override void OnScoresAdded(ScoreInfo[] scores)
@@ -30,5 +41,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
// Prefer selecting the local user's score, or otherwise default to the first visible score.
SelectedScore.Value ??= scores.FirstOrDefault(s => s.UserID == userId) ?? scores.FirstOrDefault();
}
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(itemBeatmap);
}
}