2019-12-23 14:43:58 +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-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2019-12-23 14:43:58 +08:00
|
|
|
using System.Diagnostics;
|
2021-05-12 15:35:05 +08:00
|
|
|
using osu.Framework.Graphics;
|
2021-09-16 17:26:12 +08:00
|
|
|
using osu.Framework.Input.Events;
|
2019-12-23 14:43:58 +08:00
|
|
|
using osu.Game.Rulesets.Scoring;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// The tail of a <see cref="DrawableHoldNote"/>.
|
|
|
|
/// </summary>
|
2022-11-24 13:32:20 +08:00
|
|
|
public partial class DrawableHoldNoteTail : DrawableNote
|
2019-12-23 14:43:58 +08:00
|
|
|
{
|
2020-03-31 14:39:00 +08:00
|
|
|
protected override ManiaSkinComponents Component => ManiaSkinComponents.HoldNoteTail;
|
|
|
|
|
2023-03-14 15:59:18 +08:00
|
|
|
protected internal DrawableHoldNote HoldNote => (DrawableHoldNote)ParentHitObject;
|
2019-12-23 14:43:58 +08:00
|
|
|
|
2021-05-12 15:35:05 +08:00
|
|
|
public DrawableHoldNoteTail()
|
|
|
|
: this(null)
|
2019-12-23 14:43:58 +08:00
|
|
|
{
|
2021-05-12 15:35:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public DrawableHoldNoteTail(TailNote tailNote)
|
|
|
|
: base(tailNote)
|
|
|
|
{
|
|
|
|
Anchor = Anchor.TopCentre;
|
|
|
|
Origin = Anchor.TopCentre;
|
2019-12-23 14:43:58 +08:00
|
|
|
}
|
|
|
|
|
2019-12-23 16:48:48 +08:00
|
|
|
public void UpdateResult() => base.UpdateResult(true);
|
|
|
|
|
2019-12-23 14:43:58 +08:00
|
|
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
|
|
|
{
|
|
|
|
Debug.Assert(HitObject.HitWindows != null);
|
|
|
|
|
|
|
|
// Factor in the release lenience
|
2023-01-19 19:53:35 +08:00
|
|
|
timeOffset /= TailNote.RELEASE_WINDOW_LENIENCE;
|
2019-12-23 14:43:58 +08:00
|
|
|
|
|
|
|
if (!userTriggered)
|
|
|
|
{
|
|
|
|
if (!HitObject.HitWindows.CanBeHit(timeOffset))
|
2020-10-03 04:58:10 +08:00
|
|
|
ApplyResult(r => r.Type = r.Judgement.MinResult);
|
2019-12-23 14:43:58 +08:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var result = HitObject.HitWindows.ResultFor(timeOffset);
|
|
|
|
if (result == HitResult.None)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ApplyResult(r =>
|
|
|
|
{
|
2019-12-23 17:49:08 +08:00
|
|
|
// If the head wasn't hit or the hold note was broken, cap the max score to Meh.
|
2023-10-09 08:47:00 +08:00
|
|
|
bool hasComboBreak = !HoldNote.Head.IsHit || HoldNote.Body.HasHoldBreak;
|
|
|
|
|
|
|
|
if (result > HitResult.Meh && hasComboBreak)
|
2019-12-23 17:49:08 +08:00
|
|
|
result = HitResult.Meh;
|
2019-12-23 14:43:58 +08:00
|
|
|
|
|
|
|
r.Type = result;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-09-16 17:26:12 +08:00
|
|
|
public override bool OnPressed(KeyBindingPressEvent<ManiaAction> e) => false; // Handled by the hold note
|
2019-12-23 14:43:58 +08:00
|
|
|
|
2021-09-16 17:26:12 +08:00
|
|
|
public override void OnReleased(KeyBindingReleaseEvent<ManiaAction> e)
|
2020-01-22 12:22:34 +08:00
|
|
|
{
|
|
|
|
}
|
2019-12-23 14:43:58 +08:00
|
|
|
}
|
|
|
|
}
|