mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 21:47:25 +08:00
Save score button on failed screen
This commit is contained in:
parent
9518e1db05
commit
9a6f4ef76d
@ -3,6 +3,7 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using osu.Game.Graphics;
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
@ -11,12 +12,14 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class FailOverlay : GameplayMenuOverlay
|
||||
{
|
||||
public Action SaveReplay;
|
||||
public override string Header => "failed";
|
||||
public override string Description => "you're dead, try again?";
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
AddButton("Save replay and Quit", colours.Blue, () => SaveReplay?.Invoke());
|
||||
AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke());
|
||||
AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());
|
||||
}
|
||||
|
@ -266,6 +266,7 @@ namespace osu.Game.Screens.Play
|
||||
},
|
||||
FailOverlay = new FailOverlay
|
||||
{
|
||||
SaveReplay = saveReplay,
|
||||
OnRetry = Restart,
|
||||
OnQuit = () => PerformExit(true),
|
||||
},
|
||||
@ -1043,6 +1044,21 @@ namespace osu.Game.Screens.Play
|
||||
return base.OnExiting(e);
|
||||
}
|
||||
|
||||
// Don't know if prepareScoreForResults useful
|
||||
private async void saveReplay()
|
||||
{
|
||||
var scoreCopy = Score.DeepClone();
|
||||
try
|
||||
{
|
||||
await ImportScore(scoreCopy).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error(ex, @"Score import failed!");
|
||||
}
|
||||
PerformExit(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the player's <see cref="Scoring.Score"/>.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user