1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 02:22:55 +08:00

Rename and simplify circle logic

This commit is contained in:
Dean Herbert 2020-01-24 11:54:48 +09:00
parent 851b891285
commit eb5abcab8c

View File

@ -28,7 +28,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
public override void OnNewJudgement(JudgementResult judgement) => judgementsFlow.Push(GetColourForHitResult(HitWindows.ResultFor(judgement.TimeOffset))); public override void OnNewJudgement(JudgementResult judgement) => judgementsFlow.Push(GetColourForHitResult(HitWindows.ResultFor(judgement.TimeOffset)));
private class JudgementFlow : FillFlowContainer<DrawableResult> private class JudgementFlow : FillFlowContainer<HitErrorCircle>
{ {
private const int max_available_judgements = 20; private const int max_available_judgements = 20;
private const int drawable_judgement_size = 8; private const int drawable_judgement_size = 8;
@ -48,46 +48,43 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
public void Push(Color4 colour) public void Push(Color4 colour)
{ {
Add(new DrawableResult(colour, drawable_judgement_size)); Add(new HitErrorCircle(colour, drawable_judgement_size));
if (Children.Count > max_available_judgements) if (Children.Count > max_available_judgements)
Children.FirstOrDefault(c => !c.IsRemoved)?.Remove(); Children.FirstOrDefault(c => !c.IsRemoved)?.Remove();
} }
} }
private class DrawableResult : Container private class HitErrorCircle : Container
{ {
public bool IsRemoved { get; private set; } public bool IsRemoved { get; private set; }
private readonly CircularContainer content; private readonly Circle circle;
public DrawableResult(Color4 colour, int size) public HitErrorCircle(Color4 colour, int size)
{ {
Size = new Vector2(size); Size = new Vector2(size);
Child = content = new CircularContainer Child = circle = new Circle
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Masking = true,
Alpha = 0, Alpha = 0,
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colour Colour = colour
},
}; };
} }
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
content.FadeInFromZero(animation_duration, Easing.OutQuint);
content.MoveToY(-DrawSize.Y); circle.FadeInFromZero(animation_duration, Easing.OutQuint);
content.MoveToY(0, animation_duration, Easing.OutQuint); circle.MoveToY(-DrawSize.Y);
circle.MoveToY(0, animation_duration, Easing.OutQuint);
} }
public void Remove() public void Remove()
{ {
IsRemoved = true; IsRemoved = true;
this.FadeOut(animation_duration, Easing.OutQuint).Expire(); this.FadeOut(animation_duration, Easing.OutQuint).Expire();
} }
} }