1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 06:12:56 +08:00

Update styling

This commit is contained in:
smoogipoo 2021-09-30 17:54:52 +09:00
parent 84bddf0885
commit d2a8f35b4c
2 changed files with 45 additions and 6 deletions

View File

@ -25,7 +25,7 @@ namespace osu.Game.Graphics.UserInterface
set => current.Current = value;
}
private SpriteText displayedCountSpriteText;
private IHasText displayedCountSpriteText;
/// <summary>
/// If true, the roll-up duration will be proportional to change in value.
@ -72,10 +72,10 @@ namespace osu.Game.Graphics.UserInterface
[BackgroundDependencyLoader]
private void load()
{
displayedCountSpriteText = CreateSpriteText();
displayedCountSpriteText = CreateText();
UpdateDisplay();
Child = displayedCountSpriteText;
Child = (Drawable)displayedCountSpriteText;
}
protected void UpdateDisplay()
@ -160,6 +160,8 @@ namespace osu.Game.Graphics.UserInterface
this.TransformTo(nameof(DisplayedCount), newValue, rollingTotalDuration, RollingEasing);
}
protected virtual IHasText CreateText() => CreateSpriteText();
protected virtual OsuSpriteText CreateSpriteText() => new OsuSpriteText
{
Font = OsuFont.Numeric.With(size: 40f),

View File

@ -68,10 +68,9 @@ namespace osu.Game.Screens.Play.HUD
Current.Value = (int)(ppProcessor?.Calculate() ?? 0);
}
protected override LocalisableString FormatCount(int count) => $@"{count}pp";
protected override LocalisableString FormatCount(int count) => count.ToString(@"D");
protected override OsuSpriteText CreateSpriteText()
=> base.CreateSpriteText().With(s => s.Font = s.Font.With(size: 20f));
protected override IHasText CreateText() => new TextComponent();
protected override void Dispose(bool isDisposing)
{
@ -81,6 +80,44 @@ namespace osu.Game.Screens.Play.HUD
scoreProcessor.NewJudgement -= onNewJudgement;
}
private class TextComponent : CompositeDrawable, IHasText
{
public LocalisableString Text
{
get => text.Text;
set => text.Text = value;
}
private readonly OsuSpriteText text;
public TextComponent()
{
AutoSizeAxes = Axes.Both;
InternalChild = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Spacing = new Vector2(2),
Children = new Drawable[]
{
text = new OsuSpriteText
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Font = OsuFont.Numeric.With(size: 16)
},
new OsuSpriteText
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Text = @"pp",
Font = OsuFont.Numeric.With(size: 8)
}
}
};
}
}
private class GameplayWorkingBeatmap : WorkingBeatmap
{
private readonly GameplayBeatmap gameplayBeatmap;