2023-06-23 00:37:25 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2021-07-12 14:11:07 +08:00
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
|
2021-07-13 15:02:18 +08:00
|
|
|
|
namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
2021-07-12 14:11:07 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2021-07-12 14:18:38 +08:00
|
|
|
|
/// Displays contents in a "pill".
|
2021-07-12 14:11:07 +08:00
|
|
|
|
/// </summary>
|
2022-11-24 13:32:20 +08:00
|
|
|
|
public partial class PillContainer : Container
|
2021-07-12 14:11:07 +08:00
|
|
|
|
{
|
|
|
|
|
private const float padding = 8;
|
|
|
|
|
|
2021-07-14 15:48:53 +08:00
|
|
|
|
public readonly Drawable Background;
|
2021-07-12 14:11:07 +08:00
|
|
|
|
|
2021-08-06 16:03:44 +08:00
|
|
|
|
protected override Container<Drawable> Content => content;
|
|
|
|
|
private readonly Container content;
|
2021-07-12 14:18:38 +08:00
|
|
|
|
|
|
|
|
|
public PillContainer()
|
2021-07-12 14:11:07 +08:00
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.X;
|
|
|
|
|
Height = 16;
|
|
|
|
|
|
|
|
|
|
InternalChild = new CircularContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
|
Masking = true,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
Background = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.Black,
|
|
|
|
|
Alpha = 0.5f
|
|
|
|
|
},
|
2024-02-21 04:18:37 +08:00
|
|
|
|
new GridContainer
|
2021-07-12 14:11:07 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Padding = new MarginPadding { Horizontal = padding },
|
2024-02-21 04:18:37 +08:00
|
|
|
|
ColumnDimensions = new[]
|
2021-07-12 14:11:07 +08:00
|
|
|
|
{
|
2024-02-21 04:18:37 +08:00
|
|
|
|
new Dimension(GridSizeMode.AutoSize, minSize: 80 - 2 * padding)
|
|
|
|
|
},
|
|
|
|
|
Content = new[]
|
|
|
|
|
{
|
|
|
|
|
new[]
|
2021-07-12 14:11:07 +08:00
|
|
|
|
{
|
2024-02-21 04:18:37 +08:00
|
|
|
|
new Container
|
2021-08-06 16:03:44 +08:00
|
|
|
|
{
|
2024-02-21 04:18:37 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Padding = new MarginPadding { Bottom = 2 },
|
|
|
|
|
Child = content = new Container
|
2021-08-06 16:03:44 +08:00
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-12 14:11:07 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|