From d85a4a22e525cc4914c12bbe067e79f7ef8ba8cb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 18 Feb 2021 19:19:28 +0900 Subject: [PATCH 1/2] Allow beatmap imports from any derived version of SongSelect, rather than only PlaySongSelect --- osu.Game/OsuGame.cs | 2 +- osu.Game/PerformFromMenuRunner.cs | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 15785ea6bd..771bcd2310 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -383,7 +383,7 @@ namespace osu.Game Ruleset.Value = selection.Ruleset; Beatmap.Value = BeatmapManager.GetWorkingBeatmap(selection); - }, validScreens: new[] { typeof(PlaySongSelect) }); + }, validScreens: new[] { typeof(SongSelect) }); } /// diff --git a/osu.Game/PerformFromMenuRunner.cs b/osu.Game/PerformFromMenuRunner.cs index 7999023998..3df9ca5305 100644 --- a/osu.Game/PerformFromMenuRunner.cs +++ b/osu.Game/PerformFromMenuRunner.cs @@ -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 => type.IsAssignableFrom(t)) && !beatmap.Disabled) { finalAction(current); Cancel(); @@ -91,13 +93,14 @@ namespace osu.Game while (current != null) { - if (validScreens.Contains(current.GetType())) + if (validScreens.Any(t => type.IsAssignableFrom(t))) { current.MakeCurrent(); break; } current = current.GetParentScreen(); + type = current?.GetType(); } } From 1701d69a602520fb75c7f39f5c3fe7ad7d9f641d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 19 Feb 2021 14:33:08 +0900 Subject: [PATCH 2/2] Fix calls to IsAssignableFrom being back-to-front --- osu.Game/PerformFromMenuRunner.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/PerformFromMenuRunner.cs b/osu.Game/PerformFromMenuRunner.cs index 3df9ca5305..a4179c94da 100644 --- a/osu.Game/PerformFromMenuRunner.cs +++ b/osu.Game/PerformFromMenuRunner.cs @@ -84,7 +84,7 @@ namespace osu.Game // we may already be at the target screen type. var type = current.GetType(); - if (validScreens.Any(t => type.IsAssignableFrom(t)) && !beatmap.Disabled) + if (validScreens.Any(t => t.IsAssignableFrom(type)) && !beatmap.Disabled) { finalAction(current); Cancel(); @@ -93,7 +93,7 @@ namespace osu.Game while (current != null) { - if (validScreens.Any(t => type.IsAssignableFrom(t))) + if (validScreens.Any(t => t.IsAssignableFrom(type))) { current.MakeCurrent(); break;