1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-29 23:51:01 +08:00

Fix several issues with leaderboard score display

- Enforces minimum width on accuracy / max combo displays which could
  previously look broken in CJK languages, thus fixing
  https://github.com/ppy/osu/issues/33434. Minimum sizes were chosen to
  accomodate what could be considered reasonably possible with some
  leeway on top.

- Fixes hilariously broken logic that was supposed to highlight perfect
  / FC / max combo scores in green but instead did nothing due to two
  disparate bugs in a single line of code.

- Extends the highlighting logic to also apply to 100% accuracy because
  web does this and I think it's nice.
This commit is contained in:
Bartłomiej Dach
2025-06-06 11:11:01 +02:00
Unverified
parent c180983393
commit b61688596b
2 changed files with 23 additions and 17 deletions
@@ -205,7 +205,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
Position = 999,
Rank = ScoreRank.X,
Accuracy = 1,
MaxCombo = 244,
MaxCombo = 3000,
TotalScore = RNG.Next(1_800_000, 2_000_000),
MaximumStatistics = { { HitResult.Great, 3000 } },
Ruleset = new OsuRuleset().RulesetInfo,
@@ -223,7 +223,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
Position = 22333,
Rank = ScoreRank.S,
Accuracy = 0.1f,
MaxCombo = 32040,
MaxCombo = 2204,
TotalScore = RNG.Next(1_200_000, 1_500_000),
MaximumStatistics = { { HitResult.Great, 3000 } },
Ruleset = new OsuRuleset().RulesetInfo,
@@ -330,7 +330,11 @@ namespace osu.Game.Screens.SelectV2
Origin = Anchor.CentreRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Children = getStatistics(score).Select(s => new ScoreComponentLabel(s, score)).ToList(),
Children = new Drawable[]
{
new ScoreComponentLabel(BeatmapsetsStrings.ShowScoreboardHeadersCombo.ToUpper(), $"{score.MaxCombo.ToString()}x", score.MaxCombo == score.GetMaximumAchievableCombo(), 60),
new ScoreComponentLabel(BeatmapsetsStrings.ShowScoreboardHeadersAccuracy.ToUpper(), score.DisplayAccuracy, score.Accuracy == 1, 55),
},
Alpha = 0,
}
}
@@ -640,48 +644,50 @@ namespace osu.Game.Screens.SelectV2
private partial class ScoreComponentLabel : Container
{
private readonly (LocalisableString Name, LocalisableString Value) statisticInfo;
private readonly ScoreInfo score;
private readonly LocalisableString name;
private readonly LocalisableString value;
private readonly bool perfect;
private readonly float minWidth;
private FillFlowContainer content = null!;
public override bool Contains(Vector2 screenSpacePos) => content.Contains(screenSpacePos);
public ScoreComponentLabel((LocalisableString Name, LocalisableString Value) statisticInfo, ScoreInfo score)
public ScoreComponentLabel(LocalisableString name, LocalisableString value, bool perfect, float minWidth)
{
this.statisticInfo = statisticInfo;
this.score = score;
this.name = name;
this.value = value;
this.perfect = perfect;
this.minWidth = minWidth;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours, OverlayColourProvider colourProvider)
{
AutoSizeAxes = Axes.Both;
OsuSpriteText value;
Child = content = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Children = new Drawable[]
Children = new[]
{
new OsuSpriteText
{
Colour = colourProvider.Content2,
Text = statisticInfo.Name,
Text = name,
Font = OsuFont.Style.Caption2.With(weight: FontWeight.SemiBold),
},
value = new OsuSpriteText
new OsuSpriteText
{
// We don't want the value setting the horizontal size, since it leads to wonky accuracy container length,
// since the accuracy is sometimes longer than its name.
BypassAutoSizeAxes = Axes.X,
Text = statisticInfo.Value,
Text = value,
Font = OsuFont.Style.Body,
}
Colour = perfect ? colours.Lime1 : Color4.White,
},
Empty().With(d => d.Width = minWidth),
}
};
if (score.Combo != score.MaxCombo && statisticInfo.Name == BeatmapsetsStrings.ShowScoreboardHeadersCombo)
value.Colour = colours.Lime1;
}
}