2022-06-29 08:23:35 +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.
|
|
|
|
|
|
2022-07-03 20:51:30 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Bindables;
|
2022-06-29 08:23:35 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2022-07-03 20:51:30 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
2022-06-29 08:23:35 +00:00
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|
|
|
|
{
|
|
|
|
|
public class DefaultFollowCircle : CompositeDrawable
|
|
|
|
|
{
|
2022-07-03 20:51:30 +00:00
|
|
|
|
[Resolved(canBeNull: true)]
|
|
|
|
|
private DrawableHitObject? parentObject { get; set; }
|
|
|
|
|
|
2022-06-29 08:23:35 +00:00
|
|
|
|
public DefaultFollowCircle()
|
|
|
|
|
{
|
2022-07-03 20:51:30 +00:00
|
|
|
|
Alpha = 0f;
|
2022-06-29 08:23:35 +00:00
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
|
|
InternalChild = new CircularContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Masking = true,
|
|
|
|
|
BorderThickness = 5,
|
|
|
|
|
BorderColour = Color4.Orange,
|
|
|
|
|
Blending = BlendingParameters.Additive,
|
|
|
|
|
Child = new Box
|
|
|
|
|
{
|
|
|
|
|
Colour = Color4.Orange,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Alpha = 0.2f,
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
2022-07-03 20:51:30 +00:00
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load()
|
|
|
|
|
{
|
|
|
|
|
if (parentObject != null)
|
|
|
|
|
{
|
|
|
|
|
var slider = (DrawableSlider)parentObject;
|
|
|
|
|
slider.Tracking.BindValueChanged(trackingChanged, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
|
|
if (parentObject != null)
|
|
|
|
|
{
|
|
|
|
|
parentObject.ApplyCustomUpdateState += updateStateTransforms;
|
|
|
|
|
updateStateTransforms(parentObject, parentObject.State.Value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void trackingChanged(ValueChangedEvent<bool> tracking)
|
|
|
|
|
{
|
|
|
|
|
const float scale_duration = 300f;
|
|
|
|
|
const float fade_duration = 300f;
|
|
|
|
|
|
|
|
|
|
this.ScaleTo(tracking.NewValue ? DrawableSliderBall.FOLLOW_AREA : 1f, scale_duration, Easing.OutQuint)
|
|
|
|
|
.FadeTo(tracking.NewValue ? 1f : 0, fade_duration, Easing.OutQuint);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateStateTransforms(DrawableHitObject drawableObject, ArmedState state)
|
|
|
|
|
{
|
|
|
|
|
if (drawableObject is not DrawableSlider)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
const float fade_time = 450f;
|
|
|
|
|
|
|
|
|
|
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime))
|
|
|
|
|
// intentionally pile on an extra FadeOut to make it happen much faster.
|
|
|
|
|
this.FadeOut(fade_time / 4, Easing.Out);
|
|
|
|
|
}
|
2022-06-29 08:23:35 +00:00
|
|
|
|
}
|
|
|
|
|
}
|