2022-06-29 16:23:35 +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.
|
|
|
|
|
|
2022-07-19 14:51:02 +08:00
|
|
|
|
using System.Diagnostics;
|
2022-07-04 04:51:30 +08:00
|
|
|
|
using osu.Framework.Bindables;
|
2022-06-29 16:23:35 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2022-07-15 16:24:40 +08:00
|
|
|
|
using osu.Framework.Utils;
|
2022-07-04 04:51:30 +08:00
|
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
2022-06-29 16:23:35 +08:00
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|
|
|
|
{
|
2022-07-15 07:52:45 +08:00
|
|
|
|
public class DefaultFollowCircle : FollowCircle
|
2022-06-29 16:23:35 +08:00
|
|
|
|
{
|
|
|
|
|
public DefaultFollowCircle()
|
|
|
|
|
{
|
|
|
|
|
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-04 04:51:30 +08:00
|
|
|
|
|
2022-07-15 07:52:45 +08:00
|
|
|
|
protected override void OnTrackingChanged(ValueChangedEvent<bool> tracking)
|
2022-07-04 04:51:30 +08:00
|
|
|
|
{
|
2022-07-19 14:51:02 +08:00
|
|
|
|
Debug.Assert(ParentObject != null);
|
|
|
|
|
|
2022-07-15 16:24:40 +08:00
|
|
|
|
const float duration = 300f;
|
2022-07-04 04:51:30 +08:00
|
|
|
|
|
2022-07-19 14:51:02 +08:00
|
|
|
|
if (ParentObject.Judged)
|
|
|
|
|
return;
|
|
|
|
|
|
2022-07-15 16:24:40 +08:00
|
|
|
|
if (tracking.NewValue)
|
|
|
|
|
{
|
|
|
|
|
if (Precision.AlmostEquals(0, Alpha))
|
|
|
|
|
this.ScaleTo(1);
|
|
|
|
|
|
|
|
|
|
this.ScaleTo(DrawableSliderBall.FOLLOW_AREA, duration, Easing.OutQuint)
|
|
|
|
|
.FadeTo(1f, duration, Easing.OutQuint);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.ScaleTo(DrawableSliderBall.FOLLOW_AREA * 1.2f, duration / 2, Easing.OutQuint)
|
|
|
|
|
.FadeTo(0, duration / 2, Easing.OutQuint);
|
|
|
|
|
}
|
2022-07-04 04:51:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-07-15 07:52:45 +08:00
|
|
|
|
protected override void OnSliderEnd()
|
2022-07-04 04:51:30 +08:00
|
|
|
|
{
|
2022-07-19 14:51:02 +08:00
|
|
|
|
const float fade_duration = 300;
|
2022-07-04 04:51:30 +08:00
|
|
|
|
|
2022-07-06 12:04:13 +08:00
|
|
|
|
// intentionally pile on an extra FadeOut to make it happen much faster
|
2022-07-19 14:51:02 +08:00
|
|
|
|
this.ScaleTo(1, fade_duration, Easing.OutQuint);
|
|
|
|
|
this.FadeOut(fade_duration / 2, Easing.OutQuint);
|
2022-07-04 04:51:30 +08:00
|
|
|
|
}
|
2022-06-29 16:23:35 +08:00
|
|
|
|
}
|
|
|
|
|
}
|