1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 18:13:09 +08:00

Refactor to remove resolved dependency

This commit is contained in:
smoogipoo 2021-08-24 13:29:19 +09:00
parent 956c1cc216
commit de0de451fe
6 changed files with 15 additions and 8 deletions

View File

@ -52,7 +52,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
Action = () => Action = () =>
{ {
if (matchSubScreen.IsCurrentScreen()) if (matchSubScreen.IsCurrentScreen())
matchSubScreen.Push(new MultiplayerMatchSongSelect()); matchSubScreen.Push(new MultiplayerMatchSongSelect(matchSubScreen.Room));
}, },
Alpha = 0 Alpha = 0
} }

View File

@ -24,9 +24,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
/// <summary> /// <summary>
/// Construct a new instance of multiplayer song select. /// Construct a new instance of multiplayer song select.
/// </summary> /// </summary>
/// <param name="room">The room.</param>
/// <param name="beatmap">An optional initial beatmap selection to perform.</param> /// <param name="beatmap">An optional initial beatmap selection to perform.</param>
/// <param name="ruleset">An optional initial ruleset selection to perform.</param> /// <param name="ruleset">An optional initial ruleset selection to perform.</param>
public MultiplayerMatchSongSelect(WorkingBeatmap beatmap = null, RulesetInfo ruleset = null) public MultiplayerMatchSongSelect(Room room, WorkingBeatmap beatmap = null, RulesetInfo ruleset = null)
: base(room)
{ {
if (beatmap != null || ruleset != null) if (beatmap != null || ruleset != null)
{ {

View File

@ -412,7 +412,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
return; return;
} }
this.Push(new MultiplayerMatchSongSelect(beatmap, ruleset)); this.Push(new MultiplayerMatchSongSelect(Room, beatmap, ruleset));
} }
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)

View File

@ -33,9 +33,6 @@ namespace osu.Game.Screens.OnlinePlay
[Resolved(typeof(Room), nameof(Room.Playlist))] [Resolved(typeof(Room), nameof(Room.Playlist))]
protected BindableList<PlaylistItem> Playlist { get; private set; } protected BindableList<PlaylistItem> Playlist { get; private set; }
[Resolved]
private Room room { get; set; }
protected override UserActivity InitialActivity => new UserActivity.InLobby(room); protected override UserActivity InitialActivity => new UserActivity.InLobby(room);
protected readonly Bindable<IReadOnlyList<Mod>> FreeMods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>()); protected readonly Bindable<IReadOnlyList<Mod>> FreeMods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
@ -45,14 +42,17 @@ namespace osu.Game.Screens.OnlinePlay
private IBindable<PlaylistItem> selectedItem { get; set; } private IBindable<PlaylistItem> selectedItem { get; set; }
private readonly FreeModSelectOverlay freeModSelectOverlay; private readonly FreeModSelectOverlay freeModSelectOverlay;
private readonly Room room;
private WorkingBeatmap initialBeatmap; private WorkingBeatmap initialBeatmap;
private RulesetInfo initialRuleset; private RulesetInfo initialRuleset;
private IReadOnlyList<Mod> initialMods; private IReadOnlyList<Mod> initialMods;
private bool itemSelected; private bool itemSelected;
protected OnlinePlaySongSelect() protected OnlinePlaySongSelect(Room room)
{ {
this.room = room;
Padding = new MarginPadding { Horizontal = HORIZONTAL_OVERFLOW_PADDING }; Padding = new MarginPadding { Horizontal = HORIZONTAL_OVERFLOW_PADDING };
freeModSelectOverlay = new FreeModSelectOverlay freeModSelectOverlay = new FreeModSelectOverlay

View File

@ -189,7 +189,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
EditPlaylist = () => EditPlaylist = () =>
{ {
if (this.IsCurrentScreen()) if (this.IsCurrentScreen())
this.Push(new PlaylistsSongSelect()); this.Push(new PlaylistsSongSelect(Room));
}, },
}; };

View File

@ -16,6 +16,11 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
[Resolved] [Resolved]
private BeatmapManager beatmaps { get; set; } private BeatmapManager beatmaps { get; set; }
public PlaylistsSongSelect(Room room)
: base(room)
{
}
protected override BeatmapDetailArea CreateBeatmapDetailArea() => new MatchBeatmapDetailArea protected override BeatmapDetailArea CreateBeatmapDetailArea() => new MatchBeatmapDetailArea
{ {
CreateNewItem = createNewItem CreateNewItem = createNewItem