mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Adjust displays to use new results/orderings
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -16,6 +17,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
||||
public class CounterStatistic : StatisticDisplay
|
||||
{
|
||||
private readonly int count;
|
||||
private readonly int? maxCount;
|
||||
|
||||
private RollingCounter<int> counter;
|
||||
|
||||
@ -24,10 +26,12 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
||||
/// </summary>
|
||||
/// <param name="header">The name of the statistic.</param>
|
||||
/// <param name="count">The value to display.</param>
|
||||
public CounterStatistic(string header, int count)
|
||||
/// <param name="maxCount">The maximum value of <paramref name="count"/>. Not displayed if null.</param>
|
||||
public CounterStatistic(string header, int count, int? maxCount = null)
|
||||
: base(header)
|
||||
{
|
||||
this.count = count;
|
||||
this.maxCount = maxCount;
|
||||
}
|
||||
|
||||
public override void Appear()
|
||||
@ -36,7 +40,33 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
||||
counter.Current.Value = count;
|
||||
}
|
||||
|
||||
protected override Drawable CreateContent() => counter = new Counter();
|
||||
protected override Drawable CreateContent()
|
||||
{
|
||||
var container = new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Child = counter = new Counter
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre
|
||||
}
|
||||
};
|
||||
|
||||
if (maxCount != null)
|
||||
{
|
||||
container.Add(new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Font = OsuFont.Torus.With(size: 12, fixedWidth: true),
|
||||
Spacing = new Vector2(-2, 0),
|
||||
Text = $"/{maxCount}"
|
||||
});
|
||||
}
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
private class Counter : RollingCounter<int>
|
||||
{
|
||||
|
Reference in New Issue
Block a user