1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 23:42:55 +08:00

Make statistic header optional

This commit is contained in:
Bartłomiej Dach 2020-08-27 20:18:53 +02:00
parent f152e1b924
commit ce013ac9b4
2 changed files with 35 additions and 27 deletions

View File

@ -32,9 +32,35 @@ namespace osu.Game.Screens.Ranking.Statistics
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Content = new[] Content = new[]
{ {
new[]
{
createHeader(item)
},
new Drawable[] new Drawable[]
{ {
new FillFlowContainer new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Margin = new MarginPadding { Top = 15 },
Child = item.Content
}
},
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
}
};
}
private static Drawable createHeader(StatisticItem item)
{
if (string.IsNullOrEmpty(item.Name))
return Empty();
return new FillFlowContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
@ -58,24 +84,6 @@ namespace osu.Game.Screens.Ranking.Statistics
Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold), Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold),
} }
} }
}
},
new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Margin = new MarginPadding { Top = 15 },
Child = item.Content
}
},
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
}
}; };
} }
} }

View File

@ -30,7 +30,7 @@ namespace osu.Game.Screens.Ranking.Statistics
/// <summary> /// <summary>
/// Creates a new <see cref="StatisticItem"/>, to be displayed inside a <see cref="StatisticRow"/> in the results screen. /// Creates a new <see cref="StatisticItem"/>, to be displayed inside a <see cref="StatisticRow"/> in the results screen.
/// </summary> /// </summary>
/// <param name="name">The name of the item.</param> /// <param name="name">The name of the item. Can be <see cref="string.Empty"/> to hide the item header.</param>
/// <param name="content">The <see cref="Drawable"/> content to be displayed.</param> /// <param name="content">The <see cref="Drawable"/> content to be displayed.</param>
/// <param name="dimension">The <see cref="Dimension"/> of this item. This can be thought of as the column dimension of an encompassing <see cref="GridContainer"/>.</param> /// <param name="dimension">The <see cref="Dimension"/> of this item. This can be thought of as the column dimension of an encompassing <see cref="GridContainer"/>.</param>
public StatisticItem([NotNull] string name, [NotNull] Drawable content, [CanBeNull] Dimension dimension = null) public StatisticItem([NotNull] string name, [NotNull] Drawable content, [CanBeNull] Dimension dimension = null)