2021-06-19 01:33:50 +08: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.
|
|
|
|
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|
|
|
using osu.Game.Skinning;
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|
|
|
{
|
|
|
|
public class LegacySpinnerApproachCircle : CompositeDrawable
|
|
|
|
{
|
|
|
|
private DrawableSpinner drawableSpinner;
|
|
|
|
|
|
|
|
[CanBeNull]
|
2021-06-20 01:06:28 +08:00
|
|
|
private Sprite approachCircle;
|
2021-06-19 01:33:50 +08:00
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(DrawableHitObject drawableHitObject, ISkinSource source)
|
|
|
|
{
|
|
|
|
drawableSpinner = (DrawableSpinner)drawableHitObject;
|
|
|
|
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
var spinnerProvider = source.FindProvider(s =>
|
|
|
|
s.GetTexture("spinner-circle") != null ||
|
|
|
|
s.GetTexture("spinner-top") != null);
|
|
|
|
|
|
|
|
if (spinnerProvider is DefaultLegacySkin)
|
|
|
|
return;
|
|
|
|
|
2021-06-20 01:06:28 +08:00
|
|
|
InternalChild = approachCircle = new Sprite
|
2021-06-19 01:33:50 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Texture = source.GetTexture("spinner-approachcircle"),
|
2021-06-20 01:06:28 +08:00
|
|
|
Scale = new Vector2(1.86f),
|
2021-06-19 01:33:50 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
drawableSpinner.ApplyCustomUpdateState += updateStateTransforms;
|
|
|
|
updateStateTransforms(drawableSpinner, drawableSpinner.State.Value);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state)
|
|
|
|
{
|
|
|
|
if (!(drawableHitObject is DrawableSpinner spinner))
|
|
|
|
return;
|
|
|
|
|
|
|
|
using (BeginAbsoluteSequence(spinner.HitObject.StartTime))
|
2021-06-20 01:06:28 +08:00
|
|
|
approachCircle?.ScaleTo(0.1f, spinner.HitObject.Duration);
|
2021-06-19 01:33:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|