osu/osu.Game/Screens/Ranking/RetryButton.cs

55 lines
1.4 KiB
C#
Raw Normal View History

2019-11-01 06:32:06 +00:00
// 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.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Play;
using osuTK;
2020-03-17 08:43:16 +00:00
namespace osu.Game.Screens.Ranking
2019-11-01 06:32:06 +00:00
{
public class RetryButton : OsuAnimatedButton
{
private readonly Box background;
[Resolved(canBeNull: true)]
private Player player { get; set; }
public RetryButton()
{
Size = new Vector2(50, 30);
Children = new Drawable[]
{
background = new Box
{
RelativeSizeAxes = Axes.Both,
Depth = float.MaxValue
},
new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(13),
Icon = FontAwesome.Solid.ArrowCircleLeft,
},
};
2020-01-14 19:26:54 +00:00
TooltipText = "retry";
2019-11-01 06:32:06 +00:00
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
background.Colour = colours.Green;
if (player != null)
2019-11-01 06:51:10 +00:00
Action = () => player.Restart();
2019-11-01 06:32:06 +00:00
}
}
}