mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
Save score button on failed screen
This commit is contained in:
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -11,12 +12,14 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
public class FailOverlay : GameplayMenuOverlay
|
public class FailOverlay : GameplayMenuOverlay
|
||||||
{
|
{
|
||||||
|
public Action SaveReplay;
|
||||||
public override string Header => "failed";
|
public override string Header => "failed";
|
||||||
public override string Description => "you're dead, try again?";
|
public override string Description => "you're dead, try again?";
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
|
AddButton("Save replay and Quit", colours.Blue, () => SaveReplay?.Invoke());
|
||||||
AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke());
|
AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke());
|
||||||
AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());
|
AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());
|
||||||
}
|
}
|
||||||
|
@ -266,6 +266,7 @@ namespace osu.Game.Screens.Play
|
|||||||
},
|
},
|
||||||
FailOverlay = new FailOverlay
|
FailOverlay = new FailOverlay
|
||||||
{
|
{
|
||||||
|
SaveReplay = saveReplay,
|
||||||
OnRetry = Restart,
|
OnRetry = Restart,
|
||||||
OnQuit = () => PerformExit(true),
|
OnQuit = () => PerformExit(true),
|
||||||
},
|
},
|
||||||
@ -1043,6 +1044,21 @@ namespace osu.Game.Screens.Play
|
|||||||
return base.OnExiting(e);
|
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>
|
/// <summary>
|
||||||
/// Creates the player's <see cref="Scoring.Score"/>.
|
/// Creates the player's <see cref="Scoring.Score"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Reference in New Issue
Block a user