mirror of
https://github.com/ppy/osu.git
synced 2024-11-12 09:17:52 +08:00
54 lines
2.0 KiB
C#
54 lines
2.0 KiB
C#
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Graphics.Containers;
|
|
using osu.Framework.Graphics.Primitives;
|
|
using osu.Game.Rulesets.Catch.Objects;
|
|
using osu.Game.Rulesets.UI.Scrolling;
|
|
|
|
namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components
|
|
{
|
|
public class NestedOutlineContainer : CompositeDrawable
|
|
{
|
|
private readonly List<CatchHitObject> nestedHitObjects = new List<CatchHitObject>();
|
|
|
|
public NestedOutlineContainer()
|
|
{
|
|
Anchor = Anchor.BottomLeft;
|
|
}
|
|
|
|
public void UpdatePositionFrom(ScrollingHitObjectContainer hitObjectContainer, CatchHitObject parentHitObject)
|
|
{
|
|
X = parentHitObject.OriginalX;
|
|
Y = hitObjectContainer.PositionAtTime(parentHitObject.StartTime);
|
|
}
|
|
|
|
public void UpdateNestedObjectsFrom(ScrollingHitObjectContainer hitObjectContainer, CatchHitObject parentHitObject)
|
|
{
|
|
nestedHitObjects.Clear();
|
|
nestedHitObjects.AddRange(parentHitObject.NestedHitObjects
|
|
.OfType<CatchHitObject>()
|
|
.Where(h => !(h is TinyDroplet)));
|
|
|
|
while (nestedHitObjects.Count < InternalChildren.Count)
|
|
RemoveInternal(InternalChildren[^1]);
|
|
|
|
while (InternalChildren.Count < nestedHitObjects.Count)
|
|
AddInternal(new FruitOutline());
|
|
|
|
for (int i = 0; i < nestedHitObjects.Count; i++)
|
|
{
|
|
var hitObject = nestedHitObjects[i];
|
|
var outline = (FruitOutline)InternalChildren[i];
|
|
outline.UpdateFrom(hitObjectContainer, hitObject, parentHitObject);
|
|
outline.Scale *= hitObject is Droplet ? 0.5f : 1;
|
|
}
|
|
}
|
|
|
|
protected override bool ComputeIsMaskedAway(RectangleF maskingBounds) => false;
|
|
}
|
|
}
|