1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 09:07:25 +08:00
osu-lazer/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableJuiceStream.cs
Dean Herbert 5c79bdc41c Use switch pattern matching in more places
Also switch access to many classes to public.

(cherry picked from commit 86cc3b7)
2018-01-12 18:33:41 +09:00

49 lines
1.6 KiB
C#

// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using OpenTK;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Catch.Objects.Drawable
{
public class DrawableJuiceStream : DrawableCatchHitObject<JuiceStream>
{
private readonly Container dropletContainer;
public DrawableJuiceStream(JuiceStream s)
: base(s)
{
RelativeSizeAxes = Axes.Both;
Origin = Anchor.BottomLeft;
X = 0;
Child = dropletContainer = new Container { RelativeSizeAxes = Axes.Both, };
foreach (var tick in s.NestedHitObjects)
{
switch (tick)
{
case TinyDroplet tiny:
AddNested(new DrawableDroplet(tiny) { Scale = new Vector2(0.5f) });
break;
case Droplet droplet:
AddNested(new DrawableDroplet(droplet));
break;
case Fruit fruit:
AddNested(new DrawableFruit(fruit));
break;
}
}
}
protected override void AddNested(DrawableHitObject h)
{
((DrawableCatchHitObject)h).CheckPosition = o => CheckPosition?.Invoke(o) ?? false;
dropletContainer.Add(h);
base.AddNested(h);
}
}
}