2019-01-24 16:43:03 +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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using osu.Framework.Graphics;
|
2019-03-27 18:29:27 +08:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2018-10-02 11:02:47 +08:00
|
|
|
|
using osu.Framework.Input.Events;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2020-01-05 01:26:31 +08:00
|
|
|
|
using osu.Game.Online.Placeholders;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-12-14 18:51:27 +08:00
|
|
|
|
namespace osu.Game.Online.Leaderboards
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
public class RetrievalFailurePlaceholder : Placeholder
|
|
|
|
|
{
|
|
|
|
|
public Action OnRetry;
|
|
|
|
|
|
|
|
|
|
public RetrievalFailurePlaceholder()
|
|
|
|
|
{
|
2018-06-28 12:04:39 +08:00
|
|
|
|
AddArbitraryDrawable(new RetryButton
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2018-06-28 12:04:39 +08:00
|
|
|
|
Action = () => OnRetry?.Invoke(),
|
|
|
|
|
Padding = new MarginPadding { Right = 10 }
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
AddText(@"Couldn't retrieve scores!");
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class RetryButton : OsuHoverContainer
|
|
|
|
|
{
|
|
|
|
|
private readonly SpriteIcon icon;
|
|
|
|
|
|
|
|
|
|
public new Action Action;
|
|
|
|
|
|
|
|
|
|
public RetryButton()
|
|
|
|
|
{
|
2018-06-28 12:04:39 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Child = new OsuClickableContainer
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Action = () => Action?.Invoke(),
|
|
|
|
|
Child = icon = new SpriteIcon
|
|
|
|
|
{
|
2019-04-02 18:55:24 +08:00
|
|
|
|
Icon = FontAwesome.Solid.Sync,
|
2018-06-28 12:04:39 +08:00
|
|
|
|
Size = new Vector2(TEXT_SIZE),
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Shadow = true,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-02 11:02:47 +08:00
|
|
|
|
protected override bool OnMouseDown(MouseDownEvent e)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
icon.ScaleTo(0.8f, 4000, Easing.OutQuint);
|
2018-10-02 11:02:47 +08:00
|
|
|
|
return base.OnMouseDown(e);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-01-20 17:17:21 +08:00
|
|
|
|
protected override void OnMouseUp(MouseUpEvent e)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
icon.ScaleTo(1, 1000, Easing.OutElastic);
|
2020-01-20 17:17:21 +08:00
|
|
|
|
base.OnMouseUp(e);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|