1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 08:55:35 +08:00

Display placeholder for leaderboard top scores

This commit is contained in:
Salman Ahmed 2022-07-25 09:10:35 +03:00
parent 91d1c9686c
commit f54cee0270

View File

@ -12,14 +12,17 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Resources.Localisation.Web; using osu.Game.Resources.Localisation.Web;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using osu.Game.Scoring; using osu.Game.Scoring;
using osu.Game.Scoring.Drawables;
using osuTK; using osuTK;
namespace osu.Game.Overlays.BeatmapSet.Scores namespace osu.Game.Overlays.BeatmapSet.Scores
@ -121,7 +124,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
maxComboColumn.Text = value.MaxCombo.ToLocalisableString(@"0\x"); maxComboColumn.Text = value.MaxCombo.ToLocalisableString(@"0\x");
ppColumn.Alpha = value.BeatmapInfo.Status.GrantsPerformancePoints() ? 1 : 0; ppColumn.Alpha = value.BeatmapInfo.Status.GrantsPerformancePoints() ? 1 : 0;
ppColumn.Text = value.PP?.ToLocalisableString(@"N0") ?? default;
if (value.PP is double pp)
ppColumn.Text = pp.ToLocalisableString(@"N0");
else
ppColumn.Drawable = new UnprocessedPerformancePointsPlaceholder { Size = new Vector2(smallFont.Size) };
statisticsColumns.ChildrenEnumerable = value.GetStatisticsForDisplay().Select(createStatisticsColumn); statisticsColumns.ChildrenEnumerable = value.GetStatisticsForDisplay().Select(createStatisticsColumn);
modsColumn.Mods = value.Mods; modsColumn.Mods = value.Mods;
@ -197,30 +204,48 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
} }
} }
private class TextColumn : InfoColumn private class TextColumn : InfoColumn, IHasCurrentValue<string>
{ {
private readonly SpriteText text; private readonly OsuTextFlowContainer text;
public TextColumn(LocalisableString title, FontUsage font, float? minWidth = null)
: this(title, new OsuSpriteText { Font = font }, minWidth)
{
}
private TextColumn(LocalisableString title, SpriteText text, float? minWidth = null)
: base(title, text, minWidth)
{
this.text = text;
}
public LocalisableString Text public LocalisableString Text
{ {
set => text.Text = value; set => text.Text = value;
} }
public Drawable Drawable
{
set
{
text.Clear();
text.AddArbitraryDrawable(value);
}
}
private Bindable<string> current;
public Bindable<string> Current public Bindable<string> Current
{ {
get => text.Current; get => current;
set => text.Current = value; set
{
text.Clear();
text.AddText(value.Value, t => t.Current = current = value);
}
}
public TextColumn(LocalisableString title, FontUsage font, float? minWidth = null)
: this(title, new OsuTextFlowContainer(t => t.Font = font)
{
AutoSizeAxes = Axes.Both
}, minWidth)
{
}
private TextColumn(LocalisableString title, OsuTextFlowContainer text, float? minWidth = null)
: base(title, text, minWidth)
{
this.text = text;
} }
} }