mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:18:22 +08:00
Display extended statistics on card hover
This commit is contained in:
parent
c0b5b0e909
commit
1f405a7e71
@ -36,6 +36,16 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
||||
withStatistics.FavouriteCount = 284_239;
|
||||
withStatistics.PlayCount = 999_001;
|
||||
withStatistics.Ranked = DateTimeOffset.Now.AddDays(-45);
|
||||
withStatistics.HypeStatus = new BeatmapSetHypeStatus
|
||||
{
|
||||
Current = 34,
|
||||
Required = 5
|
||||
};
|
||||
withStatistics.NominationStatus = new BeatmapSetNominationStatus
|
||||
{
|
||||
Current = 1,
|
||||
Required = 2
|
||||
};
|
||||
|
||||
var undownloadable = getUndownloadableBeatmapSet();
|
||||
undownloadable.LastUpdated = DateTimeOffset.Now.AddYears(-1);
|
||||
|
@ -279,6 +279,12 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
||||
|
||||
private IEnumerable<BeatmapCardStatistic> createStatistics()
|
||||
{
|
||||
if (beatmapSet.HypeStatus != null)
|
||||
yield return new HypesStatistic(beatmapSet.HypeStatus);
|
||||
|
||||
if (beatmapSet.NominationStatus != null)
|
||||
yield return new NominationsStatistic(beatmapSet.NominationStatus);
|
||||
|
||||
yield return new FavouritesStatistic(beatmapSet);
|
||||
yield return new PlayCountStatistic(beatmapSet);
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
// 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 hypes that a map has received, as well as the number of hypes required for nomination.
|
||||
/// </summary>
|
||||
public class HypesStatistic : BeatmapCardStatistic
|
||||
{
|
||||
public HypesStatistic(BeatmapSetHypeStatus hypeStatus)
|
||||
{
|
||||
Icon = FontAwesome.Solid.Bullhorn;
|
||||
Text = hypeStatus.Current.ToLocalisableString();
|
||||
TooltipText = BeatmapsStrings.HypeRequiredText(hypeStatus.Current.ToLocalisableString(), hypeStatus.Required.ToLocalisableString());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
// 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 class NominationsStatistic : BeatmapCardStatistic
|
||||
{
|
||||
public NominationsStatistic(BeatmapSetNominationStatus nominationStatus)
|
||||
{
|
||||
Icon = FontAwesome.Solid.ThumbsUp;
|
||||
Text = nominationStatus.Current.ToLocalisableString();
|
||||
TooltipText = BeatmapsStrings.NominationsRequiredText(nominationStatus.Current.ToLocalisableString(), nominationStatus.Required.ToLocalisableString());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user