2023-06-23 00:37:25 +08:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
2020-06-19 19:31:52 +08:00
// See the LICENCE file in the repository root for full licence text.
2022-02-02 13:29:18 +08:00
using System ;
2020-06-19 19:31:52 +08:00
using osu.Framework.Graphics ;
2022-08-11 03:51:11 +08:00
using osu.Framework.Localisation ;
2020-06-19 19:31:52 +08:00
namespace osu.Game.Screens.Ranking.Statistics
{
2020-06-19 19:53:43 +08:00
/// <summary>
/// An item to be displayed in a row of statistics inside the results screen.
/// </summary>
2020-06-19 19:31:52 +08:00
public class StatisticItem
{
2023-07-13 17:29:20 +08:00
/// <summary>
/// The recommended font size to use in statistic items to make sure they match others.
/// </summary>
public const float FONT_SIZE = 13 ;
2020-06-19 19:53:43 +08:00
/// <summary>
/// The name of this item.
/// </summary>
2022-08-21 09:48:35 +08:00
public readonly LocalisableString Name ;
2020-06-19 19:53:43 +08:00
/// <summary>
2022-02-02 17:29:03 +08:00
/// A function returning the <see cref="Drawable"/> content to be displayed.
2020-06-19 19:53:43 +08:00
/// </summary>
2022-02-02 17:29:03 +08:00
public readonly Func < Drawable > CreateContent ;
2020-06-19 19:53:43 +08:00
2022-02-02 13:29:18 +08:00
/// <summary>
2022-02-02 17:29:03 +08:00
/// Whether this item requires hit events. If true, <see cref="CreateContent"/> will not be called if no hit events are available.
2022-02-02 13:29:18 +08:00
/// </summary>
public readonly bool RequiresHitEvents ;
2020-06-19 19:53:43 +08:00
/// <summary>
2023-06-01 13:35:14 +08:00
/// Creates a new <see cref="StatisticItem"/>, to be displayed in the results screen.
2020-06-19 19:53:43 +08:00
/// </summary>
2022-08-18 04:03:35 +08:00
/// <param name="name">The name of the item. Can be <see langword="null"/> to hide the item header.</param>
2022-02-02 17:29:03 +08:00
/// <param name="createContent">A function returning the <see cref="Drawable"/> content to be displayed.</param>
2022-02-02 22:02:38 +08:00
/// <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>
2023-06-23 23:59:36 +08:00
public StatisticItem ( LocalisableString name , Func < Drawable > createContent , bool requiresHitEvents = false )
2020-06-19 19:31:52 +08:00
{
Name = name ;
2022-02-02 13:29:18 +08:00
RequiresHitEvents = requiresHitEvents ;
2022-02-02 17:29:03 +08:00
CreateContent = createContent ;
2020-06-19 19:31:52 +08:00
}
}
}