Make judgements able to be "added" plus make everything compile and run.

This commit is contained in:
smoogipooo
2017-09-06 17:02:13 +09:00
parent 84c22df3f5
commit ac8ec31b61
37 changed files with 337 additions and 361 deletions

View File

@ -1,6 +1,8 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Linq;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
@ -133,7 +135,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
holdStartTime = null;
// If the key has been released too early, the user should not receive full score for the release
if (!tail.Judged)
if (!tail.AllJudged)
hasBroken = true;
return true;
@ -160,12 +162,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
if (!base.OnPressed(action))
return false;
// We only want to trigger a holding state from the head if the head has received a judgement
if (!Judged)
return false;
// If the key has been released too early, the user should not receive full score for the release
if (Judgement.Result == HitResult.Miss)
if (Judgements.Any(j => j.Result == HitResult.Miss))
holdNote.hasBroken = true;
// The head note also handles early hits before the body, but we want accurate early hits to count as the body being held
@ -192,17 +190,32 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
Y = 0;
}
protected ManiaJudgement CreateJudgement() => new HoldNoteTailJudgement();
protected override void CheckJudgement(bool userTriggered)
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
{
base.CheckJudgement(userTriggered);
if (!userTriggered)
{
if (timeOffset > HitObject.HitWindows.Bad / 2)
{
AddJudgement(new HoldNoteTailJudgement
{
Result = HitResult.Miss,
HasBroken = holdNote.hasBroken
});
}
var tailJudgement = Judgement as HoldNoteTailJudgement;
if (tailJudgement == null)
return;
}
double offset = Math.Abs(timeOffset);
if (offset > HitObject.HitWindows.Miss / 2)
return;
tailJudgement.HasBroken = holdNote.hasBroken;
AddJudgement(new HoldNoteTailJudgement
{
Result = HitObject.HitWindows.ResultFor(offset) ?? HitResult.Miss,
HasBroken = holdNote.hasBroken
});
}
public override bool OnPressed(ManiaAction action) => false; // Tail doesn't handle key down
@ -213,9 +226,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
if (!holdNote.holdStartTime.HasValue)
return false;
if (Judgement.Result != HitResult.None)
return false;
if (action != Action)
return false;