1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-30 15:02:56 +08:00
osu-lazer/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySliderHeadHitCircle.cs

54 lines
1.7 KiB
C#
Raw Normal View History

// 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.Diagnostics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables;
namespace osu.Game.Rulesets.Osu.Skinning.Legacy
{
2022-11-24 13:32:20 +08:00
public partial class LegacySliderHeadHitCircle : LegacyMainCirclePiece
{
[Resolved(canBeNull: true)]
private DrawableHitObject? drawableHitObject { get; set; }
private Drawable proxiedOverlayLayer = null!;
public LegacySliderHeadHitCircle()
: base("sliderstartcircle")
{
}
protected override void LoadComplete()
{
base.LoadComplete();
proxiedOverlayLayer = OverlayLayer.CreateProxy();
if (drawableHitObject != null)
{
drawableHitObject.HitObjectApplied += onHitObjectApplied;
onHitObjectApplied(drawableHitObject);
}
}
private void onHitObjectApplied(DrawableHitObject drawableObject)
{
Debug.Assert(proxiedOverlayLayer.Parent == null);
// see logic in LegacyReverseArrow.
(drawableObject as DrawableSliderHead)?.DrawableSlider
.OverlayElementContainer.Add(proxiedOverlayLayer.With(d => d.Depth = float.MinValue));
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (drawableHitObject != null)
drawableHitObject.HitObjectApplied -= onHitObjectApplied;
}
}
}