1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 02:03:22 +08:00

Fix selection being blocked after early return

This commit is contained in:
Dan Balasescu 2022-06-18 14:28:25 +09:00
parent e04df371d1
commit 77e7e4ecb2
3 changed files with 15 additions and 8 deletions

View File

@ -75,10 +75,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
loadingLayer.Hide();
}
protected override void SelectItem(PlaylistItem item)
protected override bool SelectItem(PlaylistItem item)
{
if (operationInProgress.Value)
return;
return false;
// If the client is already in a room, update via the client.
// Otherwise, update the playlist directly in preparation for it to be submitted to the API on match creation.
@ -124,6 +124,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
Playlist.Add(item);
this.Exit();
}
return true;
}
protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea();

View File

@ -118,8 +118,6 @@ namespace osu.Game.Screens.OnlinePlay
protected sealed override bool OnStart()
{
itemSelected = true;
var item = new PlaylistItem(Beatmap.Value.BeatmapInfo)
{
RulesetID = Ruleset.Value.OnlineID,
@ -127,15 +125,21 @@ namespace osu.Game.Screens.OnlinePlay
AllowedMods = FreeMods.Value.Select(m => new APIMod(m)).ToArray()
};
SelectItem(item);
return true;
if (SelectItem(item))
{
itemSelected = true;
return true;
}
return false;
}
/// <summary>
/// Invoked when the user has requested a selection of a beatmap.
/// </summary>
/// <param name="item">The resultant <see cref="PlaylistItem"/>. This item has not yet been added to the <see cref="Room"/>'s.</param>
protected abstract void SelectItem(PlaylistItem item);
/// <returns><c>true</c> if a selection occurred.</returns>
protected abstract bool SelectItem(PlaylistItem item);
public override bool OnBackButton()
{

View File

@ -24,7 +24,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
CreateNewItem = createNewItem
};
protected override void SelectItem(PlaylistItem item)
protected override bool SelectItem(PlaylistItem item)
{
switch (Playlist.Count)
{
@ -39,6 +39,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
}
this.Exit();
return true;
}
private void createNewItem()