Fix clicking a leaderboard score at song select transtiioning briefly to main menu

- Regressed in #20567.
- Closes #20651.
This commit is contained in:
Dean Herbert 2022-10-10 16:20:17 +09:00
parent 26a473e85e
commit b783fdf667

View File

@ -563,6 +563,15 @@ namespace osu.Game
// This should be able to be performed from song select, but that is disabled for now
// due to the weird decoupled ruleset logic (which can cause a crash in certain filter scenarios).
//
// As a special case, if the beatmap and ruleset already match, allow immediately displaying the score from song select.
// This is guaranteed to not crash, and feels better from a user's perspective (ie. if they are clicking a score in the
// song select leaderboard).
IEnumerable<Type> validScreens =
Beatmap.Value.BeatmapInfo.Equals(databasedBeatmap) && Ruleset.Value.Equals(databasedScore.ScoreInfo.Ruleset)
? new[] { typeof(SongSelect) }
: Array.Empty<Type>();
PerformFromScreen(screen =>
{
Logger.Log($"{nameof(PresentScore)} updating beatmap ({databasedBeatmap}) and ruleset ({databasedScore.ScoreInfo.Ruleset}) to match score");
@ -580,7 +589,7 @@ namespace osu.Game
screen.Push(new SoloResultsScreen(databasedScore.ScoreInfo, false));
break;
}
});
}, validScreens: validScreens);
}
public override Task Import(params ImportTask[] imports)