2021-09-01 10:34:57 +00:00
|
|
|
// 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.
|
|
|
|
|
2021-09-18 14:27:30 +00:00
|
|
|
using System.Diagnostics;
|
2021-09-01 10:34:57 +00:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|
|
|
using osu.Game.Skinning;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|
|
|
{
|
|
|
|
public class LegacyReverseArrow : CompositeDrawable
|
|
|
|
{
|
2021-09-18 14:28:44 +00:00
|
|
|
private ISkin skin { get; }
|
2021-09-01 10:34:57 +00:00
|
|
|
|
|
|
|
[Resolved(canBeNull: true)]
|
|
|
|
private DrawableHitObject drawableHitObject { get; set; }
|
|
|
|
|
2021-09-18 14:27:30 +00:00
|
|
|
private Drawable proxy;
|
|
|
|
|
2021-09-01 10:34:57 +00:00
|
|
|
public LegacyReverseArrow(ISkin skin)
|
|
|
|
{
|
|
|
|
this.skin = skin;
|
|
|
|
}
|
|
|
|
|
2021-09-18 14:27:30 +00:00
|
|
|
[BackgroundDependencyLoader(true)]
|
2021-09-01 10:34:57 +00:00
|
|
|
private void load()
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
string lookupName = new OsuSkinComponent(OsuSkinComponents.ReverseArrow).LookupName;
|
|
|
|
|
2021-09-18 14:28:25 +00:00
|
|
|
InternalChild = skin.GetAnimation(lookupName, true, true) ?? Empty();
|
2021-09-01 10:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
2021-09-18 14:27:30 +00:00
|
|
|
proxy = CreateProxy();
|
|
|
|
|
|
|
|
if (drawableHitObject != null)
|
|
|
|
{
|
|
|
|
drawableHitObject.HitObjectApplied += onHitObjectApplied;
|
|
|
|
onHitObjectApplied(drawableHitObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void onHitObjectApplied(DrawableHitObject drawableObject)
|
|
|
|
{
|
|
|
|
Debug.Assert(proxy.Parent == null);
|
|
|
|
|
2021-09-01 10:34:57 +00:00
|
|
|
// see logic in LegacySliderHeadHitCircle.
|
2021-09-18 14:27:30 +00:00
|
|
|
(drawableObject as DrawableSliderRepeat)?.DrawableSlider
|
|
|
|
.OverlayElementContainer.Add(proxy);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Dispose(bool isDisposing)
|
|
|
|
{
|
|
|
|
base.Dispose(isDisposing);
|
|
|
|
if (drawableHitObject != null)
|
|
|
|
drawableHitObject.HitObjectApplied -= onHitObjectApplied;
|
2021-09-01 10:34:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|