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-18 12:57:36 +08:00
|
|
|
|
#nullable enable
|
|
|
|
|
|
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;
|
|
|
|
|
using osu.Framework.Input.Events;
|
2022-03-15 05:10:39 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2022-03-15 02:31:13 +08:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Chat.ChannelControl
|
|
|
|
|
{
|
|
|
|
|
public class ControlItemClose : OsuClickableContainer
|
|
|
|
|
{
|
|
|
|
|
private readonly SpriteIcon icon;
|
|
|
|
|
|
2022-03-15 05:10:39 +08:00
|
|
|
|
[Resolved]
|
|
|
|
|
private OsuColour osuColour { get; set; } = null!;
|
|
|
|
|
|
2022-03-15 02:31:13 +08:00
|
|
|
|
public ControlItemClose()
|
|
|
|
|
{
|
|
|
|
|
Alpha = 0f;
|
|
|
|
|
Size = new Vector2(20);
|
|
|
|
|
Child = icon = new SpriteIcon
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Scale = new Vector2(0.75f),
|
|
|
|
|
Icon = FontAwesome.Solid.TimesCircle,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool OnMouseDown(MouseDownEvent e)
|
|
|
|
|
{
|
|
|
|
|
icon.ScaleTo(0.5f, 1000, Easing.OutQuint);
|
|
|
|
|
return base.OnMouseDown(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnMouseUp(MouseUpEvent e)
|
|
|
|
|
{
|
|
|
|
|
icon.ScaleTo(0.75f, 1000, Easing.OutElastic);
|
|
|
|
|
base.OnMouseUp(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool OnHover(HoverEvent e)
|
|
|
|
|
{
|
2022-03-15 05:10:39 +08:00
|
|
|
|
icon.FadeColour(osuColour.Red1, 200, Easing.OutQuint);
|
2022-03-15 02:31:13 +08:00
|
|
|
|
return base.OnHover(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnHoverLost(HoverLostEvent e)
|
|
|
|
|
{
|
2022-03-15 05:10:39 +08:00
|
|
|
|
icon.FadeColour(Colour4.White, 200, Easing.OutQuint);
|
2022-03-15 02:31:13 +08:00
|
|
|
|
base.OnHoverLost(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|