1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 20:38:33 +08:00
osu-lazer/osu.Game/Screens/Play/FailOverlay.cs
Salman Ahmed e6236ba088 Update save score button to check availability after import
Previously was relying on whether `SaveReplay` returns null, but since
I've changed it to use the standard "prepare score for import" path, the
button has to check for local availability after import since that path
doesn't return null on fail.
2022-07-15 23:39:52 +03:00

69 lines
2.3 KiB
C#

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using System.Threading.Tasks;
using osu.Game.Scoring;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osuTK;
using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Screens.Play
{
public class FailOverlay : GameplayMenuOverlay
{
public Func<Task<ScoreInfo>> SaveReplay;
public override string Header => "failed";
public override string Description => "you're dead, try again?";
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke());
AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());
// from #10339 maybe this is a better visual effect
Add(new Container
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.X,
Height = TwoLayerButton.SIZE_EXTENDED.Y,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4Extensions.FromHex("#333")
},
new FillFlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.X,
RelativeSizeAxes = Axes.Y,
Spacing = new Vector2(5),
Padding = new MarginPadding(10),
Direction = FillDirection.Horizontal,
Children = new Drawable[]
{
new SaveFailedScoreButton(SaveReplay)
{
Width = 300
},
}
}
}
});
}
}
}