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-14 19:32:48 +08:00
|
|
|
|
|
|
|
|
|
using osu.Framework.Graphics;
|
2019-03-27 18:29:27 +08:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2018-11-12 19:41:10 +08:00
|
|
|
|
using osu.Framework.Input.Events;
|
2018-04-14 19:32:48 +08:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK;
|
|
|
|
|
using osuTK.Graphics;
|
2018-04-14 19:32:48 +08:00
|
|
|
|
|
2018-07-10 01:42:57 +08:00
|
|
|
|
namespace osu.Game.Overlays.Chat.Tabs
|
2018-04-14 19:32:48 +08:00
|
|
|
|
{
|
2018-07-10 01:42:57 +08:00
|
|
|
|
public class TabCloseButton : OsuClickableContainer
|
2018-04-14 19:32:48 +08:00
|
|
|
|
{
|
|
|
|
|
private readonly SpriteIcon icon;
|
|
|
|
|
|
2018-07-10 01:42:57 +08:00
|
|
|
|
public TabCloseButton()
|
2018-04-14 19:32:48 +08:00
|
|
|
|
{
|
|
|
|
|
Size = new Vector2(20);
|
|
|
|
|
|
|
|
|
|
Child = icon = new SpriteIcon
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Scale = new Vector2(0.75f),
|
2019-04-02 18:55:24 +08:00
|
|
|
|
Icon = FontAwesome.Solid.TimesCircle,
|
2018-04-14 19:32:48 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-12 19:41:10 +08:00
|
|
|
|
protected override bool OnMouseDown(MouseDownEvent e)
|
2018-04-14 19:32:48 +08:00
|
|
|
|
{
|
|
|
|
|
icon.ScaleTo(0.5f, 1000, Easing.OutQuint);
|
2018-11-12 19:41:10 +08:00
|
|
|
|
return base.OnMouseDown(e);
|
2018-04-14 19:32:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-11-12 19:41:10 +08:00
|
|
|
|
protected override bool OnMouseUp(MouseUpEvent e)
|
2018-04-14 19:32:48 +08:00
|
|
|
|
{
|
|
|
|
|
icon.ScaleTo(0.75f, 1000, Easing.OutElastic);
|
2018-11-12 19:41:10 +08:00
|
|
|
|
return base.OnMouseUp(e);
|
2018-04-14 19:32:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-11-12 19:41:10 +08:00
|
|
|
|
protected override bool OnHover(HoverEvent e)
|
2018-04-14 19:32:48 +08:00
|
|
|
|
{
|
|
|
|
|
icon.FadeColour(Color4.Red, 200, Easing.OutQuint);
|
2018-11-12 19:41:10 +08:00
|
|
|
|
return base.OnHover(e);
|
2018-04-14 19:32:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-11-12 19:41:10 +08:00
|
|
|
|
protected override void OnHoverLost(HoverLostEvent e)
|
2018-04-14 19:32:48 +08:00
|
|
|
|
{
|
|
|
|
|
icon.FadeColour(Color4.White, 200, Easing.OutQuint);
|
2018-11-12 19:41:10 +08:00
|
|
|
|
base.OnHoverLost(e);
|
2018-04-14 19:32:48 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|