mirror of
https://github.com/ppy/osu.git
synced 2024-12-16 09:22:58 +08:00
Don't force exit to main menu when presenting scores from within online screens
Struck me as weird when reviewing https://github.com/ppy/osu/pull/29057. Like sure, that PR adds the replay button, but it's a bit terrible that clicking the button quits the daily challenge screen and you're back at main menu when done watching...? Also extended to cover playlists and multiplayer, which have the same issue.
This commit is contained in:
parent
09a1fd2cd1
commit
662e9eab8c
@ -63,6 +63,8 @@ using osu.Game.Screens;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Footer;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Screens.OnlinePlay;
|
||||
using osu.Game.Screens.OnlinePlay.DailyChallenge;
|
||||
using osu.Game.Screens.OnlinePlay.Multiplayer;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Ranking;
|
||||
@ -749,23 +751,34 @@ namespace osu.Game
|
||||
return;
|
||||
}
|
||||
|
||||
// This should be able to be performed from song select, but that is disabled for now
|
||||
// This should be able to be performed from song select always, 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).
|
||||
// Similar exemptions are made here for online flows where there are good chances that beatmap and ruleset match
|
||||
// (playlists / multiplayer / daily challenge).
|
||||
IEnumerable<Type> validScreens =
|
||||
Beatmap.Value.BeatmapInfo.Equals(databasedBeatmap) && Ruleset.Value.Equals(databasedScore.ScoreInfo.Ruleset)
|
||||
? new[] { typeof(SongSelect) }
|
||||
? new[] { typeof(SongSelect), typeof(OnlinePlayScreen), typeof(DailyChallenge) }
|
||||
: Array.Empty<Type>();
|
||||
|
||||
PerformFromScreen(screen =>
|
||||
{
|
||||
Logger.Log($"{nameof(PresentScore)} updating beatmap ({databasedBeatmap}) and ruleset ({databasedScore.ScoreInfo.Ruleset}) to match score");
|
||||
|
||||
Ruleset.Value = databasedScore.ScoreInfo.Ruleset;
|
||||
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap);
|
||||
// some screens (mostly online) disable the ruleset/beatmap bindable.
|
||||
// attempting to set the ruleset/beatmap in that state will crash.
|
||||
// however, the `validScreens` pre-check above should ensure that we actually never come from one of those screens
|
||||
// while simultaneously having mismatched ruleset/beatmap.
|
||||
// therefore this is just a safety against touching the possibly-disabled bindables if we don't actually have to touch them.
|
||||
// if it ever fails, then this probably *should* crash anyhow (so that we can fix it).
|
||||
if (!Ruleset.Value.Equals(databasedScore.ScoreInfo.Ruleset))
|
||||
Ruleset.Value = databasedScore.ScoreInfo.Ruleset;
|
||||
|
||||
if (!Beatmap.Value.BeatmapInfo.Equals(databasedBeatmap))
|
||||
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap);
|
||||
|
||||
switch (presentType)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user