1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:17:26 +08:00

Rename StatisticContainer to StatisticItemContainer and add a background

This commit is contained in:
Dean Herbert 2023-07-13 18:55:54 +09:00
parent b333945cde
commit e34839c891
2 changed files with 34 additions and 11 deletions

View File

@ -3,6 +3,7 @@
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation; using osu.Framework.Localisation;
@ -15,21 +16,41 @@ namespace osu.Game.Screens.Ranking.Statistics
/// <summary> /// <summary>
/// Wraps a <see cref="StatisticItem"/> to add a header and suitable layout for use in <see cref="ResultsScreen"/>. /// Wraps a <see cref="StatisticItem"/> to add a header and suitable layout for use in <see cref="ResultsScreen"/>.
/// </summary> /// </summary>
internal partial class StatisticContainer : CompositeDrawable internal partial class StatisticItemContainer : CompositeDrawable
{ {
/// <summary> /// <summary>
/// Creates a new <see cref="StatisticContainer"/>. /// Creates a new <see cref="StatisticItemContainer"/>.
/// </summary> /// </summary>
/// <param name="item">The <see cref="StatisticItem"/> to display.</param> /// <param name="item">The <see cref="StatisticItem"/> to display.</param>
public StatisticContainer(StatisticItem item) public StatisticItemContainer(StatisticItem item)
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
InternalChild = new FillFlowContainer Padding = new MarginPadding(5);
InternalChild = new Container
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Masking = true,
CornerRadius = 6,
Children = new Drawable[]
{
new Box
{
Colour = ColourInfo.GradientVertical(
OsuColour.Gray(0.25f),
OsuColour.Gray(0.18f)
),
Alpha = 0.95f,
RelativeSizeAxes = Axes.Both,
},
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding(5),
Children = new[] Children = new[]
{ {
createHeader(item), createHeader(item),
@ -37,10 +58,12 @@ namespace osu.Game.Screens.Ranking.Statistics
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Margin = new MarginPadding { Top = 15 }, Padding = new MarginPadding(10) { Top = 30 },
Child = item.CreateContent() Child = item.CreateContent()
} }
} }
},
}
}; };
} }
@ -52,7 +75,7 @@ namespace osu.Game.Screens.Ranking.Statistics
return new FillFlowContainer return new FillFlowContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, Height = 20,
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
Spacing = new Vector2(5, 0), Spacing = new Vector2(5, 0),
Children = new Drawable[] Children = new Drawable[]

View File

@ -153,7 +153,7 @@ namespace osu.Game.Screens.Ranking.Statistics
continue; continue;
} }
flow.Add(new StatisticContainer(item) flow.Add(new StatisticItemContainer(item)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,