mirror of
https://github.com/ppy/osu.git
synced 2024-11-16 04:39:34 +08:00
985604fab5
There were no usages of more than one column being provided per row, so it seemed like unnecessarily complexity. I'm currently trying to reduce complexity so we can improve the layout of the results screen, which currently has up to three levels of nested `GridContainer`s. Of note, I can't add backwards compatibility because the method signature has not changed in `Ruleset` (only the return type). If we do want to keep compatibility with other rulesets, we could designate a new name for the updated method.
47 lines
1.8 KiB
C#
47 lines
1.8 KiB
C#
// 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.
|
|
|
|
#nullable disable
|
|
|
|
using System;
|
|
using JetBrains.Annotations;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Localisation;
|
|
|
|
namespace osu.Game.Screens.Ranking.Statistics
|
|
{
|
|
/// <summary>
|
|
/// An item to be displayed in a row of statistics inside the results screen.
|
|
/// </summary>
|
|
public class StatisticItem
|
|
{
|
|
/// <summary>
|
|
/// The name of this item.
|
|
/// </summary>
|
|
public readonly LocalisableString Name;
|
|
|
|
/// <summary>
|
|
/// A function returning the <see cref="Drawable"/> content to be displayed.
|
|
/// </summary>
|
|
public readonly Func<Drawable> CreateContent;
|
|
|
|
/// <summary>
|
|
/// Whether this item requires hit events. If true, <see cref="CreateContent"/> will not be called if no hit events are available.
|
|
/// </summary>
|
|
public readonly bool RequiresHitEvents;
|
|
|
|
/// <summary>
|
|
/// Creates a new <see cref="StatisticItem"/>, to be displayed in the results screen.
|
|
/// </summary>
|
|
/// <param name="name">The name of the item. Can be <see langword="null"/> to hide the item header.</param>
|
|
/// <param name="createContent">A function returning the <see cref="Drawable"/> content to be displayed.</param>
|
|
/// <param name="requiresHitEvents">Whether this item requires hit events. If true, <see cref="CreateContent"/> will not be called if no hit events are available.</param>
|
|
public StatisticItem(LocalisableString name, [NotNull] Func<Drawable> createContent, bool requiresHitEvents = false)
|
|
{
|
|
Name = name;
|
|
RequiresHitEvents = requiresHitEvents;
|
|
CreateContent = createContent;
|
|
}
|
|
}
|
|
}
|