mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 18:52:55 +08:00
Adjust animation and add delay to URL open
This commit is contained in:
parent
93a8afe96e
commit
c70e7d340d
@ -12,6 +12,8 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
|
using osu.Framework.Threading;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
|
||||||
@ -25,6 +27,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
private CancellationTokenSource? cancellationTokenSource;
|
private CancellationTokenSource? cancellationTokenSource;
|
||||||
private SystemTitleImage? currentImage;
|
private SystemTitleImage? currentImage;
|
||||||
|
|
||||||
|
private ScheduledDelegate? openUrlAction;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(GameHost? gameHost)
|
private void load(GameHost? gameHost)
|
||||||
{
|
{
|
||||||
@ -32,29 +36,52 @@ namespace osu.Game.Screens.Menu
|
|||||||
Origin = Anchor.BottomCentre;
|
Origin = Anchor.BottomCentre;
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
InternalChild = content = new ClickableContainer
|
InternalChild = content = new OsuClickableContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Action = () =>
|
Action = () =>
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(Current.Value?.Url))
|
// Delay slightly to allow animation to play out.
|
||||||
gameHost?.OpenUrlExternally(Current.Value.Url);
|
openUrlAction?.Cancel();
|
||||||
|
openUrlAction = Scheduler.AddDelayed(() =>
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(Current.Value?.Url))
|
||||||
|
gameHost?.OpenUrlExternally(Current.Value.Url);
|
||||||
|
}, 250);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
content.ScaleTo(1.1f, 500, Easing.OutBounce);
|
content.ScaleTo(1.05f, 2000, Easing.OutQuint);
|
||||||
return base.OnHover(e);
|
return base.OnHover(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnHoverLost(HoverLostEvent e)
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
{
|
{
|
||||||
content.ScaleTo(1f, 500, Easing.OutBounce);
|
content.ScaleTo(1f, 500, Easing.OutQuint);
|
||||||
base.OnHoverLost(e);
|
base.OnHoverLost(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnClick(ClickEvent e)
|
||||||
|
{
|
||||||
|
//hover.FlashColour(FlashColour, 800, Easing.OutQuint);
|
||||||
|
return base.OnClick(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnMouseDown(MouseDownEvent e)
|
||||||
|
{
|
||||||
|
content.ScaleTo(0.95f, 500, Easing.OutQuint);
|
||||||
|
return base.OnMouseDown(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
|
{
|
||||||
|
content.ScaleTo(1, 500, Easing.OutElastic);
|
||||||
|
base.OnMouseUp(e);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
Loading…
Reference in New Issue
Block a user