mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Allow providing custom sprite text for RollingCounter<T>
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Screens.Ranking.Expanded.Accuracy;
|
||||
using osu.Game.Utils;
|
||||
@ -43,16 +44,18 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
||||
|
||||
protected override Easing RollingEasing => AccuracyCircle.ACCURACY_TRANSFORM_EASING;
|
||||
|
||||
public Counter()
|
||||
{
|
||||
DisplayedCountSpriteText.Font = OsuFont.Torus.With(size: 20, fixedWidth: true);
|
||||
DisplayedCountSpriteText.Spacing = new Vector2(-2, 0);
|
||||
}
|
||||
|
||||
protected override string FormatCount(double count) => count.FormatAccuracy();
|
||||
|
||||
public override void Increment(double amount)
|
||||
=> Current.Value += amount;
|
||||
|
||||
protected override OsuSpriteText CreateSpriteText()
|
||||
{
|
||||
var spriteText = base.CreateSpriteText();
|
||||
spriteText.Font = OsuFont.Torus.With(size: 20, fixedWidth: true);
|
||||
spriteText.Spacing = new Vector2(-2, 0);
|
||||
return spriteText;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Screens.Ranking.Expanded.Accuracy;
|
||||
using osuTK;
|
||||
@ -43,10 +44,12 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
||||
|
||||
protected override Easing RollingEasing => AccuracyCircle.ACCURACY_TRANSFORM_EASING;
|
||||
|
||||
public Counter()
|
||||
protected override OsuSpriteText CreateSpriteText()
|
||||
{
|
||||
DisplayedCountSpriteText.Font = OsuFont.Torus.With(size: 20, fixedWidth: true);
|
||||
DisplayedCountSpriteText.Spacing = new Vector2(-2, 0);
|
||||
var spriteText = base.CreateSpriteText();
|
||||
spriteText.Font = OsuFont.Torus.With(size: 20, fixedWidth: true);
|
||||
spriteText.Spacing = new Vector2(-2, 0);
|
||||
return spriteText;
|
||||
}
|
||||
|
||||
public override void Increment(int amount)
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Screens.Ranking.Expanded.Accuracy;
|
||||
using osuTK;
|
||||
@ -23,15 +24,21 @@ namespace osu.Game.Screens.Ranking.Expanded
|
||||
// Todo: AutoSize X removed here due to https://github.com/ppy/osu-framework/issues/3369
|
||||
AutoSizeAxes = Axes.Y;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
DisplayedCountSpriteText.Anchor = Anchor.TopCentre;
|
||||
DisplayedCountSpriteText.Origin = Anchor.TopCentre;
|
||||
|
||||
DisplayedCountSpriteText.Font = OsuFont.Torus.With(size: 60, weight: FontWeight.Light, fixedWidth: true);
|
||||
DisplayedCountSpriteText.Spacing = new Vector2(-5, 0);
|
||||
}
|
||||
|
||||
protected override string FormatCount(long count) => count.ToString("N0");
|
||||
|
||||
protected override OsuSpriteText CreateSpriteText()
|
||||
{
|
||||
var spriteText = base.CreateSpriteText();
|
||||
spriteText.Anchor = Anchor.TopCentre;
|
||||
spriteText.Origin = Anchor.TopCentre;
|
||||
|
||||
spriteText.Font = OsuFont.Torus.With(size: 60, weight: FontWeight.Light, fixedWidth: true);
|
||||
spriteText.Spacing = new Vector2(-5, 0);
|
||||
return spriteText;
|
||||
}
|
||||
|
||||
public override void Increment(long amount)
|
||||
=> Current.Value += amount;
|
||||
}
|
||||
|
Reference in New Issue
Block a user