mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
More ComboCounter fixups + refactorings.
This commit is contained in:
@ -8,7 +8,6 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Framework.Screens.Testing;
|
using osu.Framework.Screens.Testing;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Modes.Osu.UI;
|
|
||||||
using osu.Game.Modes.UI;
|
using osu.Game.Modes.UI;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
@ -90,7 +89,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
AddButton(@"miss...", delegate
|
AddButton(@"miss...", delegate
|
||||||
{
|
{
|
||||||
comboCounter.Roll();
|
comboCounter.Current.Value = 0;
|
||||||
denominator++;
|
denominator++;
|
||||||
accuracyCounter.SetFraction(numerator, denominator);
|
accuracyCounter.SetFraction(numerator, denominator);
|
||||||
});
|
});
|
||||||
|
@ -71,10 +71,7 @@ namespace osu.Game.Modes.UI
|
|||||||
|
|
||||||
private void comboChanged(object sender, System.EventArgs e)
|
private void comboChanged(object sender, System.EventArgs e)
|
||||||
{
|
{
|
||||||
if (Current.Value == 0)
|
updateCount(Current.Value == 0);
|
||||||
Roll();
|
|
||||||
else
|
|
||||||
updateCount(Current);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -129,24 +126,7 @@ namespace osu.Game.Modes.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void StopRolling()
|
public void StopRolling()
|
||||||
{
|
{
|
||||||
updateCount(Current);
|
updateCount(false);
|
||||||
}
|
|
||||||
|
|
||||||
/// <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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual string FormatCount(long count)
|
protected virtual string FormatCount(long count)
|
||||||
@ -186,10 +166,10 @@ namespace osu.Game.Modes.UI
|
|||||||
OnDisplayedCountChange(newValue);
|
OnDisplayedCountChange(newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateCount(long value, bool rolling = false)
|
private void updateCount(bool rolling)
|
||||||
{
|
{
|
||||||
long prev = previousValue;
|
long prev = previousValue;
|
||||||
previousValue = Current.Value;
|
previousValue = Current;
|
||||||
|
|
||||||
if (!IsLoaded)
|
if (!IsLoaded)
|
||||||
return;
|
return;
|
||||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Modes.UI
|
|||||||
|
|
||||||
public virtual void OnMiss(HitObject h)
|
public virtual void OnMiss(HitObject h)
|
||||||
{
|
{
|
||||||
ComboCounter?.Roll();
|
ComboCounter.Current.Value = 0;
|
||||||
AccuracyCounter?.Set(AccuracyCounter.Count - 0.01f);
|
AccuracyCounter?.Set(AccuracyCounter.Count - 0.01f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,9 +16,9 @@ namespace osu.Game.Modes.UI
|
|||||||
|
|
||||||
protected HealthDisplay()
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user