2019-01-24 08:43:03 +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.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2019-02-21 10:04:31 +00:00
|
|
|
|
using osu.Framework.Bindables;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
2018-11-20 07:51:59 +00:00
|
|
|
|
using osuTK;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|
|
|
|
{
|
|
|
|
|
public class DrawableSliderTail : DrawableOsuHitObject, IRequireTracking
|
|
|
|
|
{
|
2018-10-29 06:36:43 +00:00
|
|
|
|
private readonly Slider slider;
|
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The judgement text is provided by the <see cref="DrawableSlider"/>.
|
|
|
|
|
/// </summary>
|
2018-08-06 02:31:46 +00:00
|
|
|
|
public override bool DisplayResult => false;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
public bool Tracking { get; set; }
|
|
|
|
|
|
2018-11-09 04:58:46 +00:00
|
|
|
|
private readonly IBindable<Vector2> positionBindable = new Bindable<Vector2>();
|
2019-12-05 10:53:31 +00:00
|
|
|
|
private readonly IBindable<int> pathVersion = new Bindable<int>();
|
2018-11-09 04:58:46 +00:00
|
|
|
|
|
2018-08-01 12:46:22 +00:00
|
|
|
|
public DrawableSliderTail(Slider slider, SliderTailCircle hitCircle)
|
2018-04-13 09:19:50 +00:00
|
|
|
|
: base(hitCircle)
|
|
|
|
|
{
|
2018-10-29 06:36:43 +00:00
|
|
|
|
this.slider = slider;
|
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
|
Origin = Anchor.Centre;
|
|
|
|
|
|
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
FillMode = FillMode.Fit;
|
|
|
|
|
|
|
|
|
|
AlwaysPresent = true;
|
|
|
|
|
|
2018-11-09 04:58:46 +00:00
|
|
|
|
positionBindable.BindTo(hitCircle.PositionBindable);
|
2019-12-05 10:53:31 +00:00
|
|
|
|
pathVersion.BindTo(slider.Path.Version);
|
2018-11-14 05:29:22 +00:00
|
|
|
|
|
|
|
|
|
positionBindable.BindValueChanged(_ => updatePosition());
|
2019-12-05 10:53:31 +00:00
|
|
|
|
pathVersion.BindValueChanged(_ => updatePosition(), true);
|
2019-10-08 08:56:56 +00:00
|
|
|
|
|
|
|
|
|
// TODO: This has no drawable content. Support for skins should be added.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-08-06 02:31:46 +00:00
|
|
|
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
|
|
|
|
if (!userTriggered && timeOffset >= 0)
|
2020-03-19 09:19:10 +00:00
|
|
|
|
ApplyResult(r => r.Type = Tracking ? r.Judgement.MaxResult : HitResult.Miss);
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
2018-10-29 06:36:43 +00:00
|
|
|
|
|
|
|
|
|
private void updatePosition() => Position = HitObject.Position - slider.Position;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|