osu/osu.Game/Overlays/Chat/Tabs/TabCloseButton.cs

56 lines
1.5 KiB
C#
Raw Normal View History

2018-04-14 11:32:48 +00:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
2018-04-14 11:32:48 +00:00
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
2018-11-20 07:51:59 +00:00
using osuTK;
using osuTK.Graphics;
2018-04-14 11:32:48 +00:00
namespace osu.Game.Overlays.Chat.Tabs
2018-04-14 11:32:48 +00:00
{
public class TabCloseButton : OsuClickableContainer
2018-04-14 11:32:48 +00:00
{
private readonly SpriteIcon icon;
public TabCloseButton()
2018-04-14 11:32:48 +00:00
{
Size = new Vector2(20);
Child = icon = new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(0.75f),
Icon = FontAwesome.fa_close,
RelativeSizeAxes = Axes.Both,
};
}
protected override bool OnMouseDown(MouseDownEvent e)
2018-04-14 11:32:48 +00:00
{
icon.ScaleTo(0.5f, 1000, Easing.OutQuint);
return base.OnMouseDown(e);
2018-04-14 11:32:48 +00:00
}
protected override bool OnMouseUp(MouseUpEvent e)
2018-04-14 11:32:48 +00:00
{
icon.ScaleTo(0.75f, 1000, Easing.OutElastic);
return base.OnMouseUp(e);
2018-04-14 11:32:48 +00:00
}
protected override bool OnHover(HoverEvent e)
2018-04-14 11:32:48 +00:00
{
icon.FadeColour(Color4.Red, 200, Easing.OutQuint);
return base.OnHover(e);
2018-04-14 11:32:48 +00:00
}
protected override void OnHoverLost(HoverLostEvent e)
2018-04-14 11:32:48 +00:00
{
icon.FadeColour(Color4.White, 200, Easing.OutQuint);
base.OnHoverLost(e);
2018-04-14 11:32:48 +00:00
}
}
}