2022-03-15 02:31:13 +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.
|
|
|
|
|
|
2022-03-15 05:10:39 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2022-03-15 02:31:13 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2022-03-21 13:25:29 +08:00
|
|
|
|
using osu.Framework.Input.Events;
|
2022-03-15 05:10:39 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2022-03-21 13:25:29 +08:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2022-03-15 02:31:13 +08:00
|
|
|
|
using osuTK;
|
2022-03-21 13:25:29 +08:00
|
|
|
|
using osuTK.Graphics;
|
2022-03-15 02:31:13 +08:00
|
|
|
|
|
2022-03-20 05:49:14 +08:00
|
|
|
|
namespace osu.Game.Overlays.Chat.ChannelList
|
2022-03-15 02:31:13 +08:00
|
|
|
|
{
|
2022-03-21 13:25:29 +08:00
|
|
|
|
public class ChannelListItemCloseButton : OsuClickableContainer
|
2022-03-15 02:31:13 +08:00
|
|
|
|
{
|
2022-03-21 13:25:29 +08:00
|
|
|
|
private SpriteIcon icon = null!;
|
|
|
|
|
|
|
|
|
|
private Color4 normalColour;
|
|
|
|
|
private Color4 hoveredColour;
|
|
|
|
|
|
2022-03-20 01:23:59 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour osuColour)
|
2022-03-15 02:31:13 +08:00
|
|
|
|
{
|
2022-03-21 13:25:29 +08:00
|
|
|
|
normalColour = osuColour.Red2;
|
|
|
|
|
hoveredColour = Color4.White;
|
|
|
|
|
|
2022-03-15 02:31:13 +08:00
|
|
|
|
Alpha = 0f;
|
|
|
|
|
Size = new Vector2(20);
|
2022-03-21 13:25:29 +08:00
|
|
|
|
Add(icon = new SpriteIcon
|
2022-03-15 02:31:13 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2022-03-21 13:41:57 +08:00
|
|
|
|
Size = new Vector2(0.75f),
|
2022-03-15 02:31:13 +08:00
|
|
|
|
Icon = FontAwesome.Solid.TimesCircle,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2022-03-21 13:25:29 +08:00
|
|
|
|
Colour = normalColour,
|
2022-03-20 01:23:59 +08:00
|
|
|
|
});
|
2022-03-15 02:31:13 +08:00
|
|
|
|
}
|
2022-03-21 13:25:29 +08:00
|
|
|
|
|
|
|
|
|
// Transforms matching OsuAnimatedButton
|
|
|
|
|
protected override bool OnHover(HoverEvent e)
|
|
|
|
|
{
|
|
|
|
|
icon.FadeColour(hoveredColour, 300, Easing.OutQuint);
|
|
|
|
|
return base.OnHover(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnHoverLost(HoverLostEvent e)
|
|
|
|
|
{
|
|
|
|
|
icon.FadeColour(normalColour, 300, Easing.OutQuint);
|
|
|
|
|
base.OnHoverLost(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool OnMouseDown(MouseDownEvent e)
|
|
|
|
|
{
|
|
|
|
|
icon.ScaleTo(0.75f, 2000, Easing.OutQuint);
|
|
|
|
|
return base.OnMouseDown(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnMouseUp(MouseUpEvent e)
|
|
|
|
|
{
|
|
|
|
|
icon.ScaleTo(1, 1000, Easing.OutElastic);
|
|
|
|
|
base.OnMouseUp(e);
|
|
|
|
|
}
|
2022-03-15 02:31:13 +08:00
|
|
|
|
}
|
|
|
|
|
}
|