1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 17:23:22 +08:00

Add support for ScorePrefix and ScoreOverlap values in legacy skins

This commit is contained in:
Morilli 2020-10-16 06:16:20 +02:00
parent 583fdc3a95
commit 085d8d0ecb
3 changed files with 18 additions and 3 deletions

View File

@ -15,6 +15,9 @@ namespace osu.Game.Skinning
{ {
private readonly ISkin skin; private readonly ISkin skin;
private readonly string scorePrefix;
private readonly int scoreOverlap;
public LegacyAccuracyCounter(ISkin skin) public LegacyAccuracyCounter(ISkin skin)
{ {
Anchor = Anchor.TopRight; Anchor = Anchor.TopRight;
@ -24,16 +27,19 @@ namespace osu.Game.Skinning
Margin = new MarginPadding(10); Margin = new MarginPadding(10);
this.skin = skin; this.skin = skin;
scorePrefix = skin.GetConfig<LegacySkinConfiguration.LegacySetting, string>(LegacySkinConfiguration.LegacySetting.ScorePrefix)?.Value ?? "score";
scoreOverlap = skin.GetConfig<LegacySkinConfiguration.LegacySetting, int>(LegacySkinConfiguration.LegacySetting.ScoreOverlap)?.Value ?? -2;
} }
[Resolved(canBeNull: true)] [Resolved(canBeNull: true)]
private HUDOverlay hud { get; set; } private HUDOverlay hud { get; set; }
protected sealed override OsuSpriteText CreateSpriteText() => protected sealed override OsuSpriteText CreateSpriteText() =>
new LegacySpriteText(skin, "score" /*, true*/) new LegacySpriteText(skin, scorePrefix)
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Spacing = new Vector2(-scoreOverlap, 0)
}; };
protected override void Update() protected override void Update()

View File

@ -5,6 +5,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osuTK;
namespace osu.Game.Skinning namespace osu.Game.Skinning
{ {
@ -12,6 +13,9 @@ namespace osu.Game.Skinning
{ {
private readonly ISkin skin; private readonly ISkin skin;
private readonly string scorePrefix;
private readonly int scoreOverlap;
protected override double RollingDuration => 1000; protected override double RollingDuration => 1000;
protected override Easing RollingEasing => Easing.Out; protected override Easing RollingEasing => Easing.Out;
@ -24,18 +28,21 @@ namespace osu.Game.Skinning
Origin = Anchor.TopRight; Origin = Anchor.TopRight;
this.skin = skin; this.skin = skin;
scorePrefix = skin.GetConfig<LegacySkinConfiguration.LegacySetting, string>(LegacySkinConfiguration.LegacySetting.ScorePrefix)?.Value ?? "score";
scoreOverlap = skin.GetConfig<LegacySkinConfiguration.LegacySetting, int>(LegacySkinConfiguration.LegacySetting.ScoreOverlap)?.Value ?? -2;
// base class uses int for display, but externally we bind to ScoreProcesssor as a double for now. // base class uses int for display, but externally we bind to ScoreProcessor as a double for now.
Current.BindValueChanged(v => base.Current.Value = (int)v.NewValue); Current.BindValueChanged(v => base.Current.Value = (int)v.NewValue);
Margin = new MarginPadding(10); Margin = new MarginPadding(10);
} }
protected sealed override OsuSpriteText CreateSpriteText() => protected sealed override OsuSpriteText CreateSpriteText() =>
new LegacySpriteText(skin, "score" /*, true*/) new LegacySpriteText(skin, scorePrefix)
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Spacing = new Vector2(-scoreOverlap, 0)
}; };
} }
} }

View File

@ -17,6 +17,8 @@ namespace osu.Game.Skinning
Version, Version,
ComboPrefix, ComboPrefix,
ComboOverlap, ComboOverlap,
ScorePrefix,
ScoreOverlap,
AnimationFramerate, AnimationFramerate,
LayeredHitSounds LayeredHitSounds
} }