From 6cc7602db1dea88df5cecfdaa1ee360c4f96fc72 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 19 May 2017 19:02:53 -0300 Subject: [PATCH] Added download button animations --- osu.Game/Overlays/Direct/DirectListPanel.cs | 28 ++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index e107561388..434bdb01e0 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -15,6 +15,7 @@ using osu.Framework.Allocation; using osu.Framework.Localisation; using osu.Framework.Graphics.Textures; using System.Linq; +using osu.Framework.Input; namespace osu.Game.Overlays.Direct { @@ -153,12 +154,14 @@ namespace osu.Game.Overlays.Direct private class DownloadButton : ClickableContainer { + private readonly TextAwesome icon; + //todo: proper download button animations public DownloadButton() { Children = new Drawable[] { - new TextAwesome + icon = new TextAwesome { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -168,6 +171,29 @@ namespace osu.Game.Overlays.Direct }, }; } + + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + { + icon.ScaleTo(0.9f, 1000, EasingTypes.Out); + return base.OnMouseDown(state, args); + } + + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + { + icon.ScaleTo(1f, 500, EasingTypes.OutElastic); + return base.OnMouseUp(state, args); + } + + protected override bool OnHover(InputState state) + { + icon.ScaleTo(1.1f, 500, EasingTypes.OutElastic); + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + icon.ScaleTo(1, 500, EasingTypes.OutElastic); + } } } }