2019-01-24 17:43:03 +09: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 18:19:50 +09:00
|
|
|
|
|
2022-06-17 16:37:17 +09:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2020-12-03 14:28:37 +09:00
|
|
|
|
using System.Diagnostics;
|
2019-02-21 19:04:31 +09:00
|
|
|
|
using osu.Framework.Bindables;
|
2023-07-17 23:31:21 -04:00
|
|
|
|
using osu.Game.Rulesets.Osu.UI;
|
2021-02-03 22:12:20 +09:00
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2018-03-10 01:11:56 +09:00
|
|
|
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|
|
|
|
{
|
|
|
|
|
public partial class DrawableSliderHead : DrawableHitCircle
|
|
|
|
|
{
|
2021-02-03 21:25:05 +09:00
|
|
|
|
public new SliderHeadCircle HitObject => (SliderHeadCircle)base.HitObject;
|
|
|
|
|
|
2021-09-01 19:34:57 +09:00
|
|
|
|
public DrawableSlider DrawableSlider => (DrawableSlider)ParentHitObject;
|
2020-12-03 14:28:37 +09:00
|
|
|
|
|
2023-11-02 17:04:49 +09:00
|
|
|
|
public override bool DisplayResult
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (HitObject?.ClassicSliderBehaviour == true)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return base.DisplayResult;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-02-03 22:12:20 +09:00
|
|
|
|
|
2019-12-05 19:53:31 +09:00
|
|
|
|
private readonly IBindable<int> pathVersion = new Bindable<int>();
|
2018-11-09 13:58:46 +09:00
|
|
|
|
|
2020-03-28 13:39:08 +09:00
|
|
|
|
protected override OsuSkinComponents CirclePieceComponent => OsuSkinComponents.SliderHeadHitCircle;
|
|
|
|
|
|
2020-11-12 15:59:48 +09:00
|
|
|
|
public DrawableSliderHead()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DrawableSliderHead(SliderHeadCircle h)
|
2018-03-10 01:11:56 +09:00
|
|
|
|
: base(h)
|
|
|
|
|
{
|
2018-11-09 13:58:46 +09:00
|
|
|
|
}
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2020-11-27 10:13:05 +09:00
|
|
|
|
protected override void OnFree()
|
2020-11-12 15:59:48 +09:00
|
|
|
|
{
|
2020-11-27 10:13:05 +09:00
|
|
|
|
base.OnFree();
|
2020-11-12 15:59:48 +09:00
|
|
|
|
|
2020-12-03 20:03:39 +09:00
|
|
|
|
pathVersion.UnbindFrom(DrawableSlider.PathVersion);
|
2020-11-12 15:59:48 +09:00
|
|
|
|
}
|
|
|
|
|
|
2022-10-26 15:26:20 +09:00
|
|
|
|
protected override void UpdatePosition()
|
|
|
|
|
{
|
|
|
|
|
// Slider head is always drawn at (0,0).
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-03 19:46:42 +09:00
|
|
|
|
protected override void OnApply()
|
2020-11-12 15:59:48 +09:00
|
|
|
|
{
|
2020-12-03 19:46:42 +09:00
|
|
|
|
base.OnApply();
|
2020-11-12 15:59:48 +09:00
|
|
|
|
|
2020-12-03 20:03:39 +09:00
|
|
|
|
pathVersion.BindTo(DrawableSlider.PathVersion);
|
2020-11-12 15:59:48 +09:00
|
|
|
|
|
2023-08-23 13:12:18 +02:00
|
|
|
|
CheckHittable = (d, t, r) => DrawableSlider.CheckHittable?.Invoke(d, t, r) ?? ClickAction.Hit;
|
2018-03-10 01:11:56 +09:00
|
|
|
|
}
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2023-12-14 11:51:50 +09:00
|
|
|
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
|
|
|
|
{
|
|
|
|
|
base.CheckForResult(userTriggered, timeOffset);
|
2023-12-15 16:13:32 +09:00
|
|
|
|
DrawableSlider.SliderInputManager.PostProcessHeadJudgement(this);
|
2023-12-14 11:51:50 +09:00
|
|
|
|
}
|
|
|
|
|
|
2021-02-03 22:12:20 +09:00
|
|
|
|
protected override HitResult ResultFor(double timeOffset)
|
|
|
|
|
{
|
|
|
|
|
Debug.Assert(HitObject != null);
|
|
|
|
|
|
2023-11-02 23:42:52 +09:00
|
|
|
|
if (HitObject.ClassicSliderBehaviour)
|
|
|
|
|
{
|
|
|
|
|
// With classic slider behaviour, heads are considered fully hit if in the largest hit window.
|
2023-11-02 18:02:47 +09:00
|
|
|
|
// We can't award a full Great because the true Great judgement is awarded on the Slider itself,
|
2023-11-02 18:52:47 +01:00
|
|
|
|
// reduced based on number of ticks hit,
|
2023-11-02 18:02:47 +09:00
|
|
|
|
// so we use the most suitable LargeTick judgement here instead.
|
2023-11-02 23:42:52 +09:00
|
|
|
|
return base.ResultFor(timeOffset).IsHit() ? HitResult.LargeTickHit : HitResult.LargeTickMiss;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return base.ResultFor(timeOffset);
|
2021-02-03 22:12:20 +09:00
|
|
|
|
}
|
|
|
|
|
|
2022-09-22 14:30:01 +09:00
|
|
|
|
public override void Shake()
|
|
|
|
|
{
|
|
|
|
|
base.Shake();
|
|
|
|
|
DrawableSlider.Shake();
|
|
|
|
|
}
|
2018-03-10 01:11:56 +09:00
|
|
|
|
}
|
|
|
|
|
}
|