From bdd9e5f68d99257a5a021edad33aadbe92fd4282 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 23 Apr 2025 18:27:59 +0900 Subject: [PATCH] Move implementation to base class --- .../Playlists/PlaylistItemResultsScreen.cs | 8 ++++++++ .../Playlists/PlaylistItemUserBestResultsScreen.cs | 13 ------------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistItemResultsScreen.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistItemResultsScreen.cs index 0e539936d8..e994299606 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistItemResultsScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistItemResultsScreen.cs @@ -19,6 +19,7 @@ using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Rooms; using osu.Game.Rulesets; using osu.Game.Scoring; +using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Ranking; namespace osu.Game.Screens.OnlinePlay.Playlists @@ -34,6 +35,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists private MultiplayerScores? higherScores; private MultiplayerScores? lowerScores; + private WorkingBeatmap itemBeatmap = null!; [Resolved] protected IAPIProvider API { get; private set; } = null!; @@ -60,6 +62,10 @@ namespace osu.Game.Screens.OnlinePlay.Playlists [BackgroundDependencyLoader] private void load() { + var localBeatmap = beatmapManager.QueryBeatmap($@"{nameof(BeatmapInfo.OnlineID)} == $0 AND {nameof(BeatmapInfo.MD5Hash)} == {nameof(BeatmapInfo.OnlineMD5Hash)}", + PlaylistItem.Beatmap.OnlineID); + itemBeatmap = beatmapManager.GetWorkingBeatmap(localBeatmap); + AddInternal(new Container { RelativeSizeAxes = Axes.Both, @@ -307,6 +313,8 @@ namespace osu.Game.Screens.OnlinePlay.Playlists } } + protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(itemBeatmap); + private partial class PanelListLoadingSpinner : LoadingSpinner { private readonly ScorePanelList list; diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistItemUserBestResultsScreen.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistItemUserBestResultsScreen.cs index c5cea5fef1..866b094178 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistItemUserBestResultsScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistItemUserBestResultsScreen.cs @@ -2,12 +2,9 @@ // 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 { @@ -17,7 +14,6 @@ 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) @@ -25,13 +21,6 @@ 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 CreateScoreRequest() => new ShowPlaylistUserScoreRequest(RoomId, PlaylistItem.ID, userId); protected override void OnScoresAdded(ScoreInfo[] scores) @@ -41,7 +30,5 @@ 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); } }