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

Only allow replay screen changes in menu + songselect

This commit is contained in:
smoogipoo 2018-11-29 17:18:59 +09:00
parent 4c1abdcd8c
commit d07a724970
4 changed files with 40 additions and 14 deletions

View File

@ -260,13 +260,6 @@ namespace osu.Game
return;
}
if (!menu.IsCurrentScreen)
{
menu.MakeCurrent();
this.Delay(500).Schedule(() => LoadScore(score), out scoreLoad);
return;
}
var score = ScoreManager.GetScore(scoreInfo);
if (score.Replay == null)
{
@ -274,19 +267,46 @@ namespace osu.Game
return;
}
var databasedBeatmap = BeatmapManager.QueryBeatmap(b => b.ID == scoreInfo.BeatmapInfo.ID);
if (databasedBeatmap == null)
if (!currentScreen.AllowExternalScreenChange)
{
Logger.Log("Tried to load a score for a beatmap we don't have!", LoggingTarget.Information);
notifications.Post(new SimpleNotification
{
Text = $"Click here to watch {scoreInfo.User.Username} on {scoreInfo.BeatmapInfo}",
Activated = () =>
{
loadScore();
return true;
}
});
return;
}
ruleset.Value = score.Ruleset;
loadScore();
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap);
Beatmap.Value.Mods.Value = score.Mods;
void loadScore()
{
if (!menu.IsCurrentScreen)
{
menu.MakeCurrent();
this.Delay(500).Schedule(loadScore, out scoreLoad);
return;
}
menu.Push(new PlayerLoader(new ReplayPlayer(score)));
var databasedBeatmap = BeatmapManager.QueryBeatmap(b => b.ID == scoreInfo.BeatmapInfo.ID);
if (databasedBeatmap == null)
{
Logger.Log("Tried to load a score for a beatmap we don't have!", LoggingTarget.Information);
return;
}
ruleset.Value = score.Ruleset;
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap);
Beatmap.Value.Mods.Value = score.Mods;
currentScreen.Push(new PlayerLoader(new ReplayPlayer(score)));
}
}
protected override void Dispose(bool isDisposing)

View File

@ -29,6 +29,8 @@ namespace osu.Game.Screens.Menu
protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial;
public override bool AllowExternalScreenChange => true;
private readonly BackgroundScreenDefault background;
private Screen songSelect;

View File

@ -34,6 +34,8 @@ namespace osu.Game.Screens
protected virtual bool AllowBackButton => true;
public virtual bool AllowExternalScreenChange => false;
/// <summary>
/// Override to create a BackgroundMode for the current screen.
/// Note that the instance created may not be the used instance if it matches the BackgroundMode equality clause.

View File

@ -40,6 +40,8 @@ namespace osu.Game.Screens.Select
protected virtual bool ShowFooter => true;
public override bool AllowExternalScreenChange => true;
/// <summary>
/// Can be null if <see cref="ShowFooter"/> is false.
/// </summary>