Make Rulesets.Mania use the new judgement result structure

This commit is contained in:
smoogipoo
2018-08-02 20:36:54 +09:00
parent 4548d2c87f
commit 807794d512
12 changed files with 39 additions and 85 deletions

View File

@ -7,7 +7,6 @@ using osu.Framework.Graphics;
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
using OpenTK.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Mania.Judgements;
using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI.Scrolling;
@ -100,7 +99,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
{
if (tail.AllJudged)
ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Perfect);
ApplyResult(Results.Single(), r => r.Type = HitResult.Perfect);
}
protected override void Update()
@ -166,7 +165,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
return false;
// If the key has been released too early, the user should not receive full score for the release
if (HitObject.Judgement.Result == HitResult.Miss)
if (Results.Single().Type == 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
@ -205,13 +204,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
if (!userTriggered)
{
if (!HitObject.HitWindows.CanBeHit(timeOffset))
{
ApplyJudgement(holdNote.HitObject.Tail.Judgement, j =>
{
j.Result = HitResult.Miss;
((HoldNoteTailJudgement)j).HasBroken = holdNote.hasBroken;
});
}
ApplyResult(Results.Single(), r => r.Type = HitResult.Miss);
return;
}
@ -220,10 +213,12 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
if (result == HitResult.None)
return;
ApplyJudgement(holdNote.HitObject.Tail.Judgement, j =>
ApplyResult(Results.Single(), r =>
{
j.Result = result;
((HoldNoteTailJudgement)j).HasBroken = holdNote.hasBroken;
if (holdNote.hasBroken && (result == HitResult.Perfect || result == HitResult.Perfect))
result = HitResult.Good;
r.Type = result;
});
}

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Linq;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
@ -79,9 +80,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
var startTime = HoldStartTime?.Invoke();
if (startTime == null || startTime > HitObject.StartTime)
ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss);
ApplyResult(Results.Single(), r => r.Type = HitResult.Miss);
else
ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Perfect);
ApplyResult(Results.Single(), r => r.Type = HitResult.Perfect);
}
}
}

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using osu.Framework.Extensions.Color4Extensions;
using OpenTK.Graphics;
using osu.Framework.Graphics;
@ -60,7 +61,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
if (!userTriggered)
{
if (!HitObject.HitWindows.CanBeHit(timeOffset))
ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss);
ApplyResult(Results.Single(), r => r.Type = HitResult.Miss);
return;
}
@ -68,7 +69,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
if (result == HitResult.None)
return;
ApplyJudgement(HitObject.Judgement, j => j.Result = result);
ApplyResult(Results.Single(), r => r.Type = result);
}
public virtual bool OnPressed(ManiaAction action)