1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 04:07:25 +08:00

Hide "retry" button on results screen after watching a replay

This commit is contained in:
Dean Herbert 2020-03-29 23:52:50 +09:00
parent 66a990cd5e
commit 6e68b968f8
2 changed files with 22 additions and 10 deletions

View File

@ -3,6 +3,7 @@
using osu.Framework.Screens;
using osu.Game.Scoring;
using osu.Game.Screens.Ranking;
namespace osu.Game.Screens.Play
{
@ -29,6 +30,8 @@ namespace osu.Game.Screens.Play
this.Push(CreateResults(DrawableRuleset.ReplayScore.ScoreInfo));
}
protected override ResultsScreen CreateResults(ScoreInfo score) => new ResultsScreen(score, false);
protected override ScoreInfo CreateScore() => score.ScoreInfo;
}
}

View File

@ -33,16 +33,21 @@ namespace osu.Game.Screens.Ranking
public readonly ScoreInfo Score;
private readonly bool allowRetry;
private Drawable bottomPanel;
public ResultsScreen(ScoreInfo score)
public ResultsScreen(ScoreInfo score, bool allowRetry = true)
{
Score = score;
this.allowRetry = allowRetry;
}
[BackgroundDependencyLoader]
private void load()
{
FillFlowContainer buttons;
InternalChildren = new[]
{
new ResultsScrollContainer
@ -68,7 +73,7 @@ namespace osu.Game.Screens.Ranking
RelativeSizeAxes = Axes.Both,
Colour = Color4Extensions.FromHex("#333")
},
new FillFlowContainer
buttons = new FillFlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -78,7 +83,6 @@ namespace osu.Game.Screens.Ranking
Children = new Drawable[]
{
new ReplayDownloadButton(Score) { Width = 300 },
new RetryButton { Width = 300 },
}
}
}
@ -87,15 +91,20 @@ namespace osu.Game.Screens.Ranking
if (player != null)
{
AddInternal(new HotkeyRetryOverlay
if (allowRetry)
{
Action = () =>
{
if (!this.IsCurrentScreen()) return;
buttons.Add(new RetryButton { Width = 300 });
player?.Restart();
},
});
AddInternal(new HotkeyRetryOverlay
{
Action = () =>
{
if (!this.IsCurrentScreen()) return;
player?.Restart();
},
});
}
}
}