mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
Add setting to change the style of the centre marker
This commit is contained in:
@ -33,6 +33,9 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
[SettingSource("Show moving average arrow", "Whether an arrow should move beneath the bar showing the average error.")]
|
[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);
|
public Bindable<bool> ShowMovingAverage { get; } = new BindableBool(true);
|
||||||
|
|
||||||
|
[SettingSource("Centre marker style", "How to signify the centre of the display")]
|
||||||
|
public Bindable<CentreMarker> CentreMarkerStyle { get; } = new Bindable<CentreMarker>(CentreMarker.Circle);
|
||||||
|
|
||||||
private SpriteIcon arrow;
|
private SpriteIcon arrow;
|
||||||
private SpriteIcon iconEarly;
|
private SpriteIcon iconEarly;
|
||||||
private SpriteIcon iconLate;
|
private SpriteIcon iconLate;
|
||||||
@ -48,8 +51,14 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
private Container colourBars;
|
private Container colourBars;
|
||||||
private Container arrowContainer;
|
private Container arrowContainer;
|
||||||
|
|
||||||
|
private (HitResult result, double length)[] hitWindows;
|
||||||
|
|
||||||
private const int max_concurrent_judgements = 50;
|
private const int max_concurrent_judgements = 50;
|
||||||
|
|
||||||
|
private Drawable[] centreMarkerDrawables;
|
||||||
|
|
||||||
|
private const int centre_marker_size = 8;
|
||||||
|
|
||||||
public BarHitErrorMeter()
|
public BarHitErrorMeter()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
@ -58,13 +67,12 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
const int centre_marker_size = 8;
|
|
||||||
const int bar_height = 200;
|
const int bar_height = 200;
|
||||||
const int bar_width = 2;
|
const int bar_width = 2;
|
||||||
const float chevron_size = 8;
|
const float chevron_size = 8;
|
||||||
const float icon_size = 14;
|
const float icon_size = 14;
|
||||||
|
|
||||||
var hitWindows = HitWindows.GetAllAvailableWindows().ToArray();
|
hitWindows = HitWindows.GetAllAvailableWindows().ToArray();
|
||||||
|
|
||||||
InternalChild = new Container
|
InternalChild = new Container
|
||||||
{
|
{
|
||||||
@ -116,14 +124,6 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Height = 0.5f,
|
Height = 0.5f,
|
||||||
},
|
},
|
||||||
new Circle
|
|
||||||
{
|
|
||||||
Name = "middle marker behind",
|
|
||||||
Colour = GetColourForHitResult(hitWindows.Last().result),
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Size = new Vector2(centre_marker_size),
|
|
||||||
},
|
|
||||||
judgementsContainer = new Container
|
judgementsContainer = new Container
|
||||||
{
|
{
|
||||||
Name = "judgements",
|
Name = "judgements",
|
||||||
@ -132,15 +132,6 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Width = judgement_line_width,
|
Width = judgement_line_width,
|
||||||
},
|
},
|
||||||
new Circle
|
|
||||||
{
|
|
||||||
Name = "middle marker in front",
|
|
||||||
Colour = GetColourForHitResult(hitWindows.Last().result).Darken(0.3f),
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Size = new Vector2(centre_marker_size),
|
|
||||||
Scale = new Vector2(0.5f),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
arrowContainer = new Container
|
arrowContainer = new Container
|
||||||
@ -176,8 +167,10 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
colourBars.Height = 0;
|
colourBars.Height = 0;
|
||||||
colourBars.ResizeHeightTo(1, 800, Easing.OutQuint);
|
colourBars.ResizeHeightTo(1, 800, Easing.OutQuint);
|
||||||
|
|
||||||
// delay the arrow appearance animation for only the initial appearance.
|
CentreMarkerStyle.BindValueChanged(style => recreateCentreMarker(style.NewValue), true);
|
||||||
using (arrowContainer.BeginDelayedSequence(250))
|
|
||||||
|
// delay the appearance animations for only the initial appearance.
|
||||||
|
using (arrowContainer.BeginDelayedSequence(450))
|
||||||
{
|
{
|
||||||
ShowMovingAverage.BindValueChanged(visible =>
|
ShowMovingAverage.BindValueChanged(visible =>
|
||||||
{
|
{
|
||||||
@ -187,6 +180,65 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void recreateCentreMarker(CentreMarker style)
|
||||||
|
{
|
||||||
|
if (centreMarkerDrawables != null)
|
||||||
|
{
|
||||||
|
foreach (var d in centreMarkerDrawables)
|
||||||
|
{
|
||||||
|
d.ScaleTo(0, 500, Easing.OutQuint)
|
||||||
|
.FadeOut(500, Easing.OutQuint);
|
||||||
|
|
||||||
|
d.Expire();
|
||||||
|
}
|
||||||
|
|
||||||
|
centreMarkerDrawables = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (style)
|
||||||
|
{
|
||||||
|
case CentreMarker.None:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CentreMarker.Circle:
|
||||||
|
centreMarkerDrawables = new Drawable[]
|
||||||
|
{
|
||||||
|
new Circle
|
||||||
|
{
|
||||||
|
Name = "middle marker behind",
|
||||||
|
Colour = GetColourForHitResult(hitWindows.Last().result),
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Depth = float.MaxValue,
|
||||||
|
Size = new Vector2(centre_marker_size),
|
||||||
|
},
|
||||||
|
new Circle
|
||||||
|
{
|
||||||
|
Name = "middle marker in front",
|
||||||
|
Colour = GetColourForHitResult(hitWindows.Last().result).Darken(0.3f),
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Depth = float.MinValue,
|
||||||
|
Size = new Vector2(centre_marker_size),
|
||||||
|
Scale = new Vector2(0.5f),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (centreMarkerDrawables != null)
|
||||||
|
{
|
||||||
|
foreach (var d in centreMarkerDrawables)
|
||||||
|
{
|
||||||
|
colourBars.Add(d);
|
||||||
|
|
||||||
|
Vector2 originalScale = d.Scale;
|
||||||
|
d.FadeInFromZero(500, Easing.OutQuint)
|
||||||
|
.ScaleTo(0).ScaleTo(originalScale, 1000, Easing.OutElasticHalf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
@ -333,5 +385,11 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void Clear() => judgementsContainer.Clear();
|
public override void Clear() => judgementsContainer.Clear();
|
||||||
|
|
||||||
|
public enum CentreMarker
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Circle
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user