mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 10:22:56 +08:00
Reintroduce SimpleStatisticRow as a data class
This commit is contained in:
parent
f5e52c80b4
commit
7c3368ecbe
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
@ -28,7 +29,7 @@ namespace osu.Game.Screens.Ranking.Statistics
|
||||
/// </summary>
|
||||
/// <param name="columnCount">The number of columns to layout the <paramref name="items"/> into.</param>
|
||||
/// <param name="items">The <see cref="SimpleStatisticItem"/>s to display in this row.</param>
|
||||
public DrawableSimpleStatisticRow(int columnCount, IEnumerable<SimpleStatisticItem> items)
|
||||
public DrawableSimpleStatisticRow(int columnCount, [ItemNotNull] IEnumerable<SimpleStatisticItem> items)
|
||||
{
|
||||
if (columnCount < 1)
|
||||
throw new ArgumentOutOfRangeException(nameof(columnCount));
|
||||
|
34
osu.Game/Screens/Ranking/Statistics/SimpleStatisticRow.cs
Normal file
34
osu.Game/Screens/Ranking/Statistics/SimpleStatisticRow.cs
Normal file
@ -0,0 +1,34 @@
|
||||
// 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 JetBrains.Annotations;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens.Ranking.Statistics
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains textual statistic data to display in a <see cref="DrawableSimpleStatisticRow"/>.
|
||||
/// </summary>
|
||||
public class SimpleStatisticRow : IStatisticRow
|
||||
{
|
||||
/// <summary>
|
||||
/// The number of columns to layout the <see cref="Items"/> in.
|
||||
/// </summary>
|
||||
public int Columns { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="StatisticItem"/>s that this row should contain.
|
||||
/// </summary>
|
||||
[ItemNotNull]
|
||||
public SimpleStatisticItem[] Items { get; set; }
|
||||
|
||||
public Drawable CreateDrawableStatisticRow() => new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding(20),
|
||||
Child = new DrawableSimpleStatisticRow(Columns, Items)
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user