1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-27 15:32:57 +08:00
osu-lazer/osu.Game/Screens/Ranking/RetryButton.cs

57 lines
1.4 KiB
C#
Raw Normal View History

2019-11-01 14:32:06 +08: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.
2022-06-17 15:37:17 +08:00
#nullable disable
2019-11-01 14:32:06 +08:00
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 16:43:16 +08:00
namespace osu.Game.Screens.Ranking
2019-11-01 14:32:06 +08: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.Redo,
2019-11-01 14:32:06 +08:00
},
};
2020-01-15 03:26:54 +08:00
TooltipText = "retry";
2019-11-01 14:32:06 +08:00
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
background.Colour = colours.Green;
if (player != null)
2019-11-01 14:51:10 +08:00
Action = () => player.Restart();
2019-11-01 14:32:06 +08:00
}
}
}