osu/osu.Game/Screens/Ranking/Statistics/StatisticItem.cs

52 lines
2.2 KiB
C#
Raw Normal View History

2020-06-19 11:31:52 +00:00
// 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.
2022-02-02 05:29:18 +00:00
using System;
2020-06-19 11:31:52 +00:00
using JetBrains.Annotations;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Screens.Ranking.Statistics
{
/// <summary>
/// An item to be displayed in a row of statistics inside the results screen.
/// </summary>
2020-06-19 11:31:52 +00:00
public class StatisticItem
{
/// <summary>
/// The name of this item.
/// </summary>
2020-06-19 11:31:52 +00:00
public readonly string Name;
/// <summary>
/// The <see cref="Drawable"/> content to be displayed.
/// </summary>
2022-02-02 05:29:18 +00:00
public readonly Func<Drawable> Content;
/// <summary>
/// The <see cref="Dimension"/> of this row. This can be thought of as the column dimension of an encompassing <see cref="GridContainer"/>.
/// </summary>
2020-06-19 11:31:52 +00:00
public readonly Dimension Dimension;
2022-02-02 05:29:18 +00:00
/// <summary>
/// Whether this item requires hit events. If true, the <see cref="Content"/> will not be created if no hit events are available.
/// </summary>
public readonly bool RequiresHitEvents;
/// <summary>
/// Creates a new <see cref="StatisticItem"/>, to be displayed inside a <see cref="StatisticRow"/> in the results screen.
/// </summary>
2020-08-27 18:18:53 +00:00
/// <param name="name">The name of the item. Can be <see cref="string.Empty"/> to hide the item header.</param>
2022-02-02 05:29:18 +00:00
/// <param name="requiresHitEvents">Whether this item requires hit events. If true, the <see cref="Content"/> will not be created if no hit events are available.</param>
/// <param name="content">The <see cref="Drawable"/> content to be displayed.</param>
2020-06-19 12:41:48 +00:00
/// <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>
2022-02-02 05:29:18 +00:00
public StatisticItem([NotNull] string name, bool requiresHitEvents, [NotNull] Func<Drawable> content, [CanBeNull] Dimension dimension = null)
2020-06-19 11:31:52 +00:00
{
Name = name;
2022-02-02 05:29:18 +00:00
RequiresHitEvents = requiresHitEvents;
2020-06-19 11:31:52 +00:00
Content = content;
Dimension = dimension;
}
}
}