// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Edit.Layers.Selection { public class HitObjectOverlayLayer : CompositeDrawable { private readonly Dictionary existingOverlays = new Dictionary(); public HitObjectOverlayLayer() { RelativeSizeAxes = Axes.Both; } /// /// Adds an overlay for a which adds movement support. /// /// The to create an overlay for. public void AddOverlay(DrawableHitObject hitObject) { var overlay = CreateOverlayFor(hitObject); if (overlay == null) return; existingOverlays[hitObject] = overlay; AddInternal(overlay); } /// /// Removes the overlay for a . /// /// The to remove the overlay for. public void RemoveOverlay(DrawableHitObject hitObject) { if (!existingOverlays.TryGetValue(hitObject, out var existing)) return; existing.Hide(); existing.Expire(); } /// /// Creates a for a specific . /// /// The to create the overlay for. protected virtual HitObjectOverlay CreateOverlayFor(DrawableHitObject hitObject) => null; } }