2018-04-14 19:32:48 +08: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;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
|
using OpenTK;
|
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
|
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),
|
|
|
|
|
Icon = FontAwesome.fa_close,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
icon.ScaleTo(0.5f, 1000, Easing.OutQuint);
|
|
|
|
|
return base.OnMouseDown(state, args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
icon.ScaleTo(0.75f, 1000, Easing.OutElastic);
|
|
|
|
|
return base.OnMouseUp(state, args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool OnHover(InputState state)
|
|
|
|
|
{
|
|
|
|
|
icon.FadeColour(Color4.Red, 200, Easing.OutQuint);
|
|
|
|
|
return base.OnHover(state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnHoverLost(InputState state)
|
|
|
|
|
{
|
|
|
|
|
icon.FadeColour(Color4.White, 200, Easing.OutQuint);
|
|
|
|
|
base.OnHoverLost(state);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|