mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 09:02:58 +08:00
Only allow replay screen changes in menu + songselect
This commit is contained in:
parent
4c1abdcd8c
commit
d07a724970
@ -260,13 +260,6 @@ namespace osu.Game
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!menu.IsCurrentScreen)
|
|
||||||
{
|
|
||||||
menu.MakeCurrent();
|
|
||||||
this.Delay(500).Schedule(() => LoadScore(score), out scoreLoad);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var score = ScoreManager.GetScore(scoreInfo);
|
var score = ScoreManager.GetScore(scoreInfo);
|
||||||
if (score.Replay == null)
|
if (score.Replay == null)
|
||||||
{
|
{
|
||||||
@ -274,19 +267,46 @@ namespace osu.Game
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var databasedBeatmap = BeatmapManager.QueryBeatmap(b => b.ID == scoreInfo.BeatmapInfo.ID);
|
if (!currentScreen.AllowExternalScreenChange)
|
||||||
if (databasedBeatmap == null)
|
|
||||||
{
|
{
|
||||||
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ruleset.Value = score.Ruleset;
|
loadScore();
|
||||||
|
|
||||||
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap);
|
void loadScore()
|
||||||
Beatmap.Value.Mods.Value = score.Mods;
|
{
|
||||||
|
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)
|
protected override void Dispose(bool isDisposing)
|
||||||
|
@ -29,6 +29,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial;
|
protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial;
|
||||||
|
|
||||||
|
public override bool AllowExternalScreenChange => true;
|
||||||
|
|
||||||
private readonly BackgroundScreenDefault background;
|
private readonly BackgroundScreenDefault background;
|
||||||
private Screen songSelect;
|
private Screen songSelect;
|
||||||
|
|
||||||
|
@ -34,6 +34,8 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
protected virtual bool AllowBackButton => true;
|
protected virtual bool AllowBackButton => true;
|
||||||
|
|
||||||
|
public virtual bool AllowExternalScreenChange => false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Override to create a BackgroundMode for the current screen.
|
/// 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.
|
/// Note that the instance created may not be the used instance if it matches the BackgroundMode equality clause.
|
||||||
|
@ -40,6 +40,8 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
protected virtual bool ShowFooter => true;
|
protected virtual bool ShowFooter => true;
|
||||||
|
|
||||||
|
public override bool AllowExternalScreenChange => true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Can be null if <see cref="ShowFooter"/> is false.
|
/// Can be null if <see cref="ShowFooter"/> is false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user