mirror of
https://github.com/ppy/osu.git
synced 2025-01-19 13:02:54 +08:00
Merge pull request #10018 from peppy/fix-unhide-hud-not-updating-stats
Fix counters not updating correctly immediately after unhiding HUD
This commit is contained in:
commit
288c4142aa
@ -40,10 +40,5 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
protected override OsuSpriteText CreateSpriteText()
|
||||
=> base.CreateSpriteText().With(s => s.Font = s.Font.With(size: 20f, fixedWidth: true));
|
||||
|
||||
public override void Increment(double amount)
|
||||
{
|
||||
Current.Value += amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,20 +57,12 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void Increment(T amount);
|
||||
|
||||
/// <summary>
|
||||
/// Skeleton of a numeric counter which value rolls over time.
|
||||
/// </summary>
|
||||
protected RollingCounter()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
Current.ValueChanged += val =>
|
||||
{
|
||||
if (IsLoaded)
|
||||
TransformCount(DisplayedCount, val.NewValue);
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -81,6 +73,13 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Child = displayedCountSpriteText;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Current.BindValueChanged(val => TransformCount(DisplayedCount, val.NewValue), true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets count value, bypassing rollover animation.
|
||||
/// </summary>
|
||||
|
@ -51,10 +51,5 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
protected override OsuSpriteText CreateSpriteText()
|
||||
=> base.CreateSpriteText().With(s => s.Font = s.Font.With(fixedWidth: true));
|
||||
|
||||
public override void Increment(double amount)
|
||||
{
|
||||
Current.Value += amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,11 +33,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
return Math.Abs(currentValue - newValue) * RollingDuration * 100.0f;
|
||||
}
|
||||
|
||||
public override void Increment(int amount)
|
||||
{
|
||||
Current.Value += amount;
|
||||
}
|
||||
|
||||
protected override OsuSpriteText CreateSpriteText()
|
||||
=> base.CreateSpriteText().With(s => s.Font = s.Font.With(size: 20f));
|
||||
}
|
||||
|
@ -1,32 +0,0 @@
|
||||
// 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 osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to display combo with a roll-up animation in results screen.
|
||||
/// </summary>
|
||||
public class ComboResultCounter : RollingCounter<long>
|
||||
{
|
||||
protected override double RollingDuration => 500;
|
||||
protected override Easing RollingEasing => Easing.Out;
|
||||
|
||||
protected override double GetProportionalDuration(long currentValue, long newValue)
|
||||
{
|
||||
return currentValue > newValue ? currentValue - newValue : newValue - currentValue;
|
||||
}
|
||||
|
||||
protected override string FormatCount(long count)
|
||||
{
|
||||
return $@"{count}x";
|
||||
}
|
||||
|
||||
public override void Increment(long amount)
|
||||
{
|
||||
Current.Value += amount;
|
||||
}
|
||||
}
|
||||
}
|
@ -46,9 +46,6 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
||||
|
||||
protected override string FormatCount(double count) => count.FormatAccuracy();
|
||||
|
||||
public override void Increment(double amount)
|
||||
=> Current.Value += amount;
|
||||
|
||||
protected override OsuSpriteText CreateSpriteText() => base.CreateSpriteText().With(s =>
|
||||
{
|
||||
s.Font = OsuFont.Torus.With(size: 20, fixedWidth: true);
|
||||
|
@ -49,9 +49,6 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
||||
s.Font = OsuFont.Torus.With(size: 20, fixedWidth: true);
|
||||
s.Spacing = new Vector2(-2, 0);
|
||||
});
|
||||
|
||||
public override void Increment(int amount)
|
||||
=> Current.Value += amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,8 +36,5 @@ namespace osu.Game.Screens.Ranking.Expanded
|
||||
s.Font = OsuFont.Torus.With(size: 60, weight: FontWeight.Light, fixedWidth: true);
|
||||
s.Spacing = new Vector2(-5, 0);
|
||||
});
|
||||
|
||||
public override void Increment(long amount)
|
||||
=> Current.Value += amount;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user