mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:37:28 +08:00
Simplify/rename SimpleStatisticRow mess
This commit is contained in:
parent
ce013ac9b4
commit
ea1f07e311
@ -13,7 +13,7 @@ using osu.Game.Screens.Ranking.Statistics;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Ranking
|
||||
{
|
||||
public class TestSceneDrawableSimpleStatisticRow : OsuTestScene
|
||||
public class TestSceneSimpleStatisticTable : OsuTestScene
|
||||
{
|
||||
private Container container;
|
||||
|
||||
@ -45,7 +45,7 @@ namespace osu.Game.Tests.Visual.Ranking
|
||||
public void TestEmpty()
|
||||
{
|
||||
AddStep("create with no items",
|
||||
() => container.Add(new DrawableSimpleStatisticRow(2, Enumerable.Empty<SimpleStatisticItem>())));
|
||||
() => container.Add(new SimpleStatisticTable(2, Enumerable.Empty<SimpleStatisticItem>())));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -61,7 +61,7 @@ namespace osu.Game.Tests.Visual.Ranking
|
||||
Value = RNG.Next(100)
|
||||
});
|
||||
|
||||
container.Add(new DrawableSimpleStatisticRow(columnCount, items));
|
||||
container.Add(new SimpleStatisticTable(columnCount, items));
|
||||
});
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
// 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
|
||||
{
|
||||
/// <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)
|
||||
};
|
||||
}
|
||||
}
|
@ -14,10 +14,10 @@ using osu.Framework.Graphics.Shapes;
|
||||
namespace osu.Game.Screens.Ranking.Statistics
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a statistic row with simple statistics (ones that only need textual display).
|
||||
/// Represents a table with simple statistics (ones that only need textual display).
|
||||
/// Richer visualisations should be done with <see cref="StatisticRow"/>s and <see cref="StatisticItem"/>s.
|
||||
/// </summary>
|
||||
public class DrawableSimpleStatisticRow : CompositeDrawable
|
||||
public class SimpleStatisticTable : CompositeDrawable
|
||||
{
|
||||
private readonly SimpleStatisticItem[] items;
|
||||
private readonly int columnCount;
|
||||
@ -29,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, [ItemNotNull] IEnumerable<SimpleStatisticItem> items)
|
||||
public SimpleStatisticTable(int columnCount, [ItemNotNull] IEnumerable<SimpleStatisticItem> items)
|
||||
{
|
||||
if (columnCount < 1)
|
||||
throw new ArgumentOutOfRangeException(nameof(columnCount));
|
Loading…
Reference in New Issue
Block a user