2021-10-18 03:05:26 +08: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.
|
|
|
|
|
|
|
|
using osu.Framework.Extensions.LocalisationExtensions;
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
using osu.Game.Resources.Localisation.Web;
|
|
|
|
|
|
|
|
namespace osu.Game.Beatmaps.Drawables.Cards.Statistics
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Shows the number of current nominations that a map has received, as well as the number of nominations required for qualification.
|
|
|
|
/// </summary>
|
|
|
|
public partial class NominationsStatistic : BeatmapCardStatistic
|
|
|
|
{
|
2021-12-17 18:13:07 +08:00
|
|
|
private NominationsStatistic(BeatmapSetNominationStatus nominationStatus)
|
2021-10-18 03:05:26 +08:00
|
|
|
{
|
|
|
|
Icon = FontAwesome.Solid.ThumbsUp;
|
|
|
|
Text = nominationStatus.Current.ToLocalisableString();
|
|
|
|
TooltipText = BeatmapsStrings.NominationsRequiredText(nominationStatus.Current.ToLocalisableString(), nominationStatus.Required.ToLocalisableString());
|
|
|
|
}
|
2021-12-17 18:13:07 +08:00
|
|
|
|
|
|
|
public static NominationsStatistic? CreateFor(IBeatmapSetOnlineInfo beatmapSetOnlineInfo)
|
|
|
|
// web does not show nominations unless hypes are also present.
|
|
|
|
// see: https://github.com/ppy/osu-web/blob/8ed7d071fd1d3eaa7e43cf0e4ff55ca2fef9c07c/resources/assets/lib/beatmapset-panel.tsx#L443
|
|
|
|
=> beatmapSetOnlineInfo.HypeStatus == null || beatmapSetOnlineInfo.NominationStatus == null ? null : new NominationsStatistic(beatmapSetOnlineInfo.NominationStatus);
|
2021-10-18 03:05:26 +08:00
|
|
|
}
|
|
|
|
}
|