1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 20:32:55 +08:00

Add setting to show or hide the moving average arrow

This commit is contained in:
Dean Herbert 2022-03-18 16:54:09 +09:00
parent 3f92bef9df
commit 331cb2aa80

View File

@ -30,6 +30,9 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
Precision = 0.1f,
};
[SettingSource("Show moving average arrow", "Whether an arrow should move beneath the bar showing the average error.")]
public Bindable<bool> ShowMovingAverage { get; } = new BindableBool(true);
private SpriteIcon arrow;
private SpriteIcon iconEarly;
private SpriteIcon iconLate;
@ -41,6 +44,12 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
private double maxHitWindow;
private double floatingAverage;
private Container colourBars;
private Container arrowContainer;
private const int max_concurrent_judgements = 50;
public BarHitErrorMeter()
{
AutoSizeAxes = Axes.Both;
@ -134,13 +143,16 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
},
}
},
new Container
arrowContainer = new Container
{
Name = "average chevron",
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Origin = Anchor.CentreRight,
Width = chevron_size,
X = chevron_size,
RelativeSizeAxes = Axes.Y,
Alpha = 0,
Scale = new Vector2(0, 1),
Child = arrow = new SpriteIcon
{
Anchor = Anchor.TopCentre,
@ -164,8 +176,15 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
colourBars.Height = 0;
colourBars.ResizeHeightTo(1, 800, Easing.OutQuint);
arrow.Alpha = 0;
arrow.Delay(200).FadeInFromZero(600);
// delay the arrow appearance animation for only the initial appearance.
using (arrowContainer.BeginDelayedSequence(250))
{
ShowMovingAverage.BindValueChanged(visible =>
{
arrowContainer.FadeTo(visible.NewValue ? 1 : 0, 250, Easing.OutQuint);
arrowContainer.ScaleTo(visible.NewValue ? new Vector2(1) : new Vector2(0, 1), 250, Easing.OutQuint);
}, true);
}
}
protected override void Update()
@ -233,11 +252,6 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
}
}
private double floatingAverage;
private Container colourBars;
private const int max_concurrent_judgements = 50;
protected override void OnNewJudgement(JudgementResult judgement)
{
const int arrow_move_duration = 800;