mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 06:03:08 +08:00
More ComboCounter fixups + refactorings.
This commit is contained in:
parent
b56d7f19e0
commit
605326e8f6
@ -8,7 +8,6 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Framework.Screens.Testing;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Modes.Osu.UI;
|
||||
using osu.Game.Modes.UI;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
@ -90,7 +89,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
|
||||
AddButton(@"miss...", delegate
|
||||
{
|
||||
comboCounter.Roll();
|
||||
comboCounter.Current.Value = 0;
|
||||
denominator++;
|
||||
accuracyCounter.SetFraction(numerator, denominator);
|
||||
});
|
||||
|
@ -71,10 +71,7 @@ namespace osu.Game.Modes.UI
|
||||
|
||||
private void comboChanged(object sender, System.EventArgs e)
|
||||
{
|
||||
if (Current.Value == 0)
|
||||
Roll();
|
||||
else
|
||||
updateCount(Current);
|
||||
updateCount(Current.Value == 0);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -129,24 +126,7 @@ namespace osu.Game.Modes.UI
|
||||
/// </summary>
|
||||
public void StopRolling()
|
||||
{
|
||||
updateCount(Current);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Animates roll-up/roll-back to an specific value.
|
||||
/// </summary>
|
||||
/// <param name="newValue">Target value.</param>
|
||||
public virtual void Roll(long newValue = 0)
|
||||
{
|
||||
updateCount(newValue, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets count to default value.
|
||||
/// </summary>
|
||||
public virtual void ResetCount()
|
||||
{
|
||||
updateCount(0);
|
||||
updateCount(false);
|
||||
}
|
||||
|
||||
protected virtual string FormatCount(long count)
|
||||
@ -186,10 +166,10 @@ namespace osu.Game.Modes.UI
|
||||
OnDisplayedCountChange(newValue);
|
||||
}
|
||||
|
||||
private void updateCount(long value, bool rolling = false)
|
||||
private void updateCount(bool rolling)
|
||||
{
|
||||
long prev = previousValue;
|
||||
previousValue = Current.Value;
|
||||
previousValue = Current;
|
||||
|
||||
if (!IsLoaded)
|
||||
return;
|
||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Modes.UI
|
||||
|
||||
public virtual void OnMiss(HitObject h)
|
||||
{
|
||||
ComboCounter?.Roll();
|
||||
ComboCounter.Current.Value = 0;
|
||||
AccuracyCounter?.Set(AccuracyCounter.Count - 0.01f);
|
||||
}
|
||||
|
||||
|
@ -16,9 +16,9 @@ namespace osu.Game.Modes.UI
|
||||
|
||||
protected HealthDisplay()
|
||||
{
|
||||
Current.ValueChanged += (s, e) => SetHP((float)Current);
|
||||
Current.ValueChanged += (s, e) => SetHealth((float)Current);
|
||||
}
|
||||
|
||||
protected abstract void SetHP(float value);
|
||||
protected abstract void SetHealth(float value);
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,6 @@ namespace osu.Game.Modes.UI
|
||||
};
|
||||
}
|
||||
|
||||
protected override void SetHP(float value) => fill.ScaleTo(new Vector2(value, 1), 200, EasingTypes.OutQuint);
|
||||
protected override void SetHealth(float value) => fill.ScaleTo(new Vector2(value, 1), 200, EasingTypes.OutQuint);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user