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
|
|
|
|
{
|
|
|
|
[Resolved(canBeNull: true)]
|
|
|
|
private DrawableHitObject drawableHitObject { get; set; }
|
|
|
|
|
2021-09-18 14:27:30 +00:00
|
|
|
private Drawable proxy;
|
|
|
|
|
2021-09-18 16:24:36 +00:00
|
|
|
[BackgroundDependencyLoader]
|
2021-09-27 19:45:26 +00:00
|
|
|
private void load(ISkinSource skinSource)
|
2021-09-01 10:34:57 +00:00
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
string lookupName = new OsuSkinComponent(OsuSkinComponents.ReverseArrow).LookupName;
|
|
|
|
|
2021-09-27 19:45:26 +00:00
|
|
|
var skin = skinSource.FindProvider(skin => skin.GetTexture(lookupName) != null);
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|