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

Remove counter sprite attributes for not being of any reasonable use

This commit is contained in:
Salman Ahmed 2020-08-19 07:44:45 +03:00
parent 9d10658e3c
commit 8f1a71c6b1
6 changed files with 13 additions and 54 deletions

View File

@ -20,7 +20,6 @@ namespace osu.Game.Tests.Visual.Gameplay
{
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,
TextSize = 40,
Margin = new MarginPadding(20),
};
Add(score);
@ -30,7 +29,6 @@ namespace osu.Game.Tests.Visual.Gameplay
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Margin = new MarginPadding(10),
TextSize = 40,
};
Add(comboCounter);

View File

@ -3,6 +3,7 @@
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Utils;
@ -28,7 +29,7 @@ namespace osu.Game.Graphics.UserInterface
}
[BackgroundDependencyLoader]
private void load(OsuColour colours) => AccentColour = colours.BlueLighter;
private void load(OsuColour colours) => Colour = colours.BlueLighter;
protected override string FormatCount(double count) => count.FormatAccuracy();
@ -38,11 +39,7 @@ namespace osu.Game.Graphics.UserInterface
}
protected override OsuSpriteText CreateSpriteText()
{
var spriteText = base.CreateSpriteText();
spriteText.Font = spriteText.Font.With(fixedWidth: true);
return spriteText;
}
=> base.CreateSpriteText().With(s => s.Font = s.Font.With(size: 20f, fixedWidth: true));
public override void Increment(double amount)
{

View File

@ -9,11 +9,10 @@ using System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osuTK.Graphics;
namespace osu.Game.Graphics.UserInterface
{
public abstract class RollingCounter<T> : Container, IHasAccentColour
public abstract class RollingCounter<T> : Container
where T : struct, IEquatable<T>
{
/// <summary>
@ -60,38 +59,6 @@ namespace osu.Game.Graphics.UserInterface
public abstract void Increment(T amount);
private float textSize = 40f;
public float TextSize
{
get => displayedCountSpriteText?.Font.Size ?? textSize;
set
{
if (TextSize == value)
return;
textSize = value;
if (displayedCountSpriteText != null)
displayedCountSpriteText.Font = displayedCountSpriteText.Font.With(size: value);
}
}
private Color4 accentColour;
public Color4 AccentColour
{
get => displayedCountSpriteText?.Colour ?? accentColour;
set
{
if (AccentColour == value)
return;
accentColour = value;
if (displayedCountSpriteText != null)
displayedCountSpriteText.Colour = value;
}
}
/// <summary>
/// Skeleton of a numeric counter which value rolls over time.
/// </summary>
@ -185,8 +152,7 @@ namespace osu.Game.Graphics.UserInterface
protected virtual OsuSpriteText CreateSpriteText() => new OsuSpriteText
{
Font = OsuFont.Numeric.With(size: textSize),
Colour = accentColour,
Font = OsuFont.Numeric.With(size: 40f),
};
}
}

View File

@ -29,7 +29,7 @@ namespace osu.Game.Graphics.UserInterface
}
[BackgroundDependencyLoader]
private void load(OsuColour colours) => AccentColour = colours.BlueLighter;
private void load(OsuColour colours) => Colour = colours.BlueLighter;
protected override double GetProportionalDuration(double currentValue, double newValue)
{
@ -50,11 +50,7 @@ namespace osu.Game.Graphics.UserInterface
}
protected override OsuSpriteText CreateSpriteText()
{
var spriteText = base.CreateSpriteText();
spriteText.Font = spriteText.Font.With(fixedWidth: true);
return spriteText;
}
=> base.CreateSpriteText().With(s => s.Font = s.Font.With(fixedWidth: true));
public override void Increment(double amount)
{

View File

@ -3,6 +3,8 @@
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Graphics.UserInterface
{
@ -19,7 +21,7 @@ namespace osu.Game.Graphics.UserInterface
}
[BackgroundDependencyLoader]
private void load(OsuColour colours) => AccentColour = colours.BlueLighter;
private void load(OsuColour colours) => Colour = colours.BlueLighter;
protected override string FormatCount(int count)
{
@ -35,5 +37,8 @@ namespace osu.Game.Graphics.UserInterface
{
Current.Value += amount;
}
protected override OsuSpriteText CreateSpriteText()
=> base.CreateSpriteText().With(s => s.Font = s.Font.With(size: 20f));
}
}

View File

@ -232,7 +232,6 @@ namespace osu.Game.Screens.Play
protected virtual RollingCounter<double> CreateAccuracyCounter() => new PercentageCounter
{
TextSize = 20,
BypassAutoSizeAxes = Axes.X,
Anchor = Anchor.TopLeft,
Origin = Anchor.TopRight,
@ -241,14 +240,12 @@ namespace osu.Game.Screens.Play
protected virtual ScoreCounter CreateScoreCounter() => new ScoreCounter(6)
{
TextSize = 40,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
};
protected virtual RollingCounter<int> CreateComboCounter() => new SimpleComboCounter
{
TextSize = 20,
BypassAutoSizeAxes = Axes.X,
Anchor = Anchor.TopRight,
Origin = Anchor.TopLeft,