mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:37:28 +08:00
Fix incorrect implementation of wireframe digits
This commit is contained in:
parent
962c8ba4ac
commit
3f5899dae0
@ -3,7 +3,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
@ -15,6 +16,8 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public partial class ArgonScoreCounter : GameplayScoreCounter, ISerialisableDrawable
|
||||
{
|
||||
private ArgonScoreTextComponent scoreText = null!;
|
||||
|
||||
protected override double RollingDuration => 500;
|
||||
protected override Easing RollingEasing => Easing.OutQuint;
|
||||
|
||||
@ -33,13 +36,42 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
protected override LocalisableString FormatCount(long count) => count.ToLocalisableString();
|
||||
|
||||
protected override IHasText CreateText() => new ArgonScoreTextComponent(Anchor.TopRight, BeatmapsetsStrings.ShowScoreboardHeadersScore.ToUpper())
|
||||
protected override IHasText CreateText() => scoreText = new ArgonScoreTextComponent(Anchor.TopRight, BeatmapsetsStrings.ShowScoreboardHeadersScore.ToUpper())
|
||||
{
|
||||
RequiredDisplayDigits = { BindTarget = RequiredDisplayDigits },
|
||||
WireframeOpacity = { BindTarget = WireframeOpacity },
|
||||
ShowLabel = { BindTarget = ShowLabel },
|
||||
};
|
||||
|
||||
public ArgonScoreCounter()
|
||||
{
|
||||
RequiredDisplayDigits.BindValueChanged(_ => updateWireframe());
|
||||
}
|
||||
|
||||
public override long DisplayedCount
|
||||
{
|
||||
get => base.DisplayedCount;
|
||||
set
|
||||
{
|
||||
base.DisplayedCount = value;
|
||||
updateWireframe();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateWireframe()
|
||||
{
|
||||
scoreText.RequiredDisplayDigits.Value =
|
||||
Math.Max(RequiredDisplayDigits.Value, getDigitsRequiredForDisplayCount());
|
||||
}
|
||||
|
||||
private int getDigitsRequiredForDisplayCount()
|
||||
{
|
||||
int digitsRequired = 1;
|
||||
long c = DisplayedCount;
|
||||
while ((c /= 10) > 0)
|
||||
digitsRequired++;
|
||||
return digitsRequired;
|
||||
}
|
||||
|
||||
private partial class ArgonScoreTextComponent : ArgonCounterTextComponent
|
||||
{
|
||||
public ArgonScoreTextComponent(Anchor anchor, LocalisableString? label = null)
|
||||
|
Loading…
Reference in New Issue
Block a user