2022-04-30 04:33:32 +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.
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
2022-05-05 18:13:48 +08:00
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
2022-04-30 04:33:32 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
using osu.Framework.Graphics.Textures;
|
2022-05-05 18:13:48 +08:00
|
|
|
using osu.Framework.Input.Events;
|
2022-04-30 04:33:32 +08:00
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2022-05-27 13:23:03 +08:00
|
|
|
using osu.Game.Resources.Localisation.Web;
|
2022-04-30 04:33:32 +08:00
|
|
|
using osuTK;
|
2022-05-05 18:13:48 +08:00
|
|
|
using osuTK.Graphics;
|
2022-04-30 04:33:32 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Chat
|
|
|
|
{
|
|
|
|
public partial class ChatOverlayTopBar : Container
|
|
|
|
{
|
2022-05-05 18:13:48 +08:00
|
|
|
private Box background = null!;
|
|
|
|
|
|
|
|
private Color4 backgroundColour;
|
2022-04-30 04:33:32 +08:00
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(OverlayColourProvider colourProvider, TextureStore textures)
|
|
|
|
{
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2022-05-05 18:13:48 +08:00
|
|
|
background = new Box
|
2022-04-30 04:33:32 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2022-05-05 18:13:48 +08:00
|
|
|
Colour = backgroundColour = colourProvider.Background3,
|
2022-04-30 04:33:32 +08:00
|
|
|
},
|
|
|
|
new GridContainer
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
ColumnDimensions = new[]
|
|
|
|
{
|
|
|
|
new Dimension(GridSizeMode.Absolute, 50),
|
|
|
|
new Dimension(),
|
|
|
|
},
|
|
|
|
Content = new[]
|
|
|
|
{
|
|
|
|
new Drawable[]
|
|
|
|
{
|
|
|
|
new Sprite
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Texture = textures.Get("Icons/Hexacons/messaging"),
|
|
|
|
Size = new Vector2(18),
|
|
|
|
},
|
|
|
|
// Placeholder text
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
Origin = Anchor.CentreLeft,
|
2022-05-27 13:23:03 +08:00
|
|
|
Text = ChatStrings.TitleCompact,
|
2022-04-30 04:33:32 +08:00
|
|
|
Font = OsuFont.Torus.With(size: 16, weight: FontWeight.SemiBold),
|
|
|
|
Margin = new MarginPadding { Bottom = 2f },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
2022-05-05 18:13:48 +08:00
|
|
|
|
|
|
|
protected override bool OnHover(HoverEvent e)
|
|
|
|
{
|
|
|
|
background.FadeColour(backgroundColour.Lighten(0.1f), 300, Easing.OutQuint);
|
|
|
|
return base.OnHover(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnHoverLost(HoverLostEvent e)
|
|
|
|
{
|
|
|
|
background.FadeColour(backgroundColour, 300, Easing.OutQuint);
|
|
|
|
base.OnHoverLost(e);
|
|
|
|
}
|
2022-04-30 04:33:32 +08:00
|
|
|
}
|
|
|
|
}
|