mirror of
https://github.com/ppy/osu.git
synced 2024-12-16 00:52:59 +08:00
83 lines
2.9 KiB
C#
83 lines
2.9 KiB
C#
// 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;
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Graphics.Containers;
|
|
using osu.Framework.Graphics.Shapes;
|
|
using osu.Framework.Graphics.Sprites;
|
|
using osu.Framework.Graphics.Textures;
|
|
using osu.Framework.Input.Events;
|
|
using osu.Game.Graphics;
|
|
using osu.Game.Graphics.Sprites;
|
|
using osu.Game.Resources.Localisation.Web;
|
|
using osuTK;
|
|
using osuTK.Graphics;
|
|
|
|
namespace osu.Game.Overlays.Chat
|
|
{
|
|
public partial class ChatOverlayTopBar : Container
|
|
{
|
|
private Box background = null!;
|
|
|
|
private Color4 backgroundColour;
|
|
|
|
[BackgroundDependencyLoader]
|
|
private void load(OverlayColourProvider colourProvider, TextureStore textures)
|
|
{
|
|
Children = new Drawable[]
|
|
{
|
|
background = new Box
|
|
{
|
|
RelativeSizeAxes = Axes.Both,
|
|
Colour = backgroundColour = colourProvider.Background3,
|
|
},
|
|
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,
|
|
Text = ChatStrings.TitleCompact,
|
|
Font = OsuFont.Torus.With(size: 16, weight: FontWeight.SemiBold),
|
|
Margin = new MarginPadding { Bottom = 2f },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
}
|