// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. 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; namespace osu.Game.Rulesets.Osu.Skinning { public abstract class LegacySpinner : CompositeDrawable { protected DrawableSpinner DrawableSpinner { get; private set; } [BackgroundDependencyLoader] private void load(DrawableHitObject drawableHitObject) { RelativeSizeAxes = Axes.Both; DrawableSpinner = (DrawableSpinner)drawableHitObject; } protected override void LoadComplete() { base.LoadComplete(); DrawableSpinner.ApplyCustomUpdateState += UpdateStateTransforms; UpdateStateTransforms(DrawableSpinner, DrawableSpinner.State.Value); } protected virtual void UpdateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state) { } protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); if (DrawableSpinner != null) DrawableSpinner.ApplyCustomUpdateState -= UpdateStateTransforms; } } }