Merge pull request #11827 from peppy/perform-from-screen-subclass-support

Allow beatmap imports from any derived version of SongSelect, rather than only PlaySongSelect
This commit is contained in:
Dan Balasescu 2021-02-19 15:05:18 +09:00 committed by GitHub
commit a6d163619a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -383,7 +383,7 @@ namespace osu.Game
Ruleset.Value = selection.Ruleset;
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(selection);
}, validScreens: new[] { typeof(PlaySongSelect) });
}, validScreens: new[] { typeof(SongSelect) });
}
/// <summary>

View File

@ -82,7 +82,9 @@ namespace osu.Game
game?.CloseAllOverlays(false);
// we may already be at the target screen type.
if (validScreens.Contains(current.GetType()) && !beatmap.Disabled)
var type = current.GetType();
if (validScreens.Any(t => t.IsAssignableFrom(type)) && !beatmap.Disabled)
{
finalAction(current);
Cancel();
@ -91,13 +93,14 @@ namespace osu.Game
while (current != null)
{
if (validScreens.Contains(current.GetType()))
if (validScreens.Any(t => t.IsAssignableFrom(type)))
{
current.MakeCurrent();
break;
}
current = current.GetParentScreen();
type = current?.GetType();
}
}