mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:17:51 +08:00
Make hitobjects only have one judgement + result
This commit is contained in:
parent
0da6c8c1a7
commit
2a4994e5ce
@ -1,7 +1,6 @@
|
||||
// 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.Collections.Generic;
|
||||
using osu.Game.Rulesets.Catch.Judgements;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
|
||||
@ -11,6 +10,6 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
{
|
||||
public override FruitVisualRepresentation VisualRepresentation => FruitVisualRepresentation.Banana;
|
||||
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new CatchBananaJudgement() };
|
||||
protected override Judgement CreateJudgement() => new CatchBananaJudgement();
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
// 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.Graphics;
|
||||
@ -57,8 +56,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
||||
{
|
||||
if (CheckPosition == null) return;
|
||||
|
||||
if (timeOffset >= 0 && Results.Count > 0)
|
||||
ApplyResult(Results.Single(), r => r.Type = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss);
|
||||
if (timeOffset >= 0 && Result != null)
|
||||
ApplyResult(r => r.Type = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss);
|
||||
}
|
||||
|
||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Collections.Generic;
|
||||
using osu.Game.Rulesets.Catch.Judgements;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
|
||||
@ -9,6 +8,6 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
{
|
||||
public class Droplet : CatchHitObject
|
||||
{
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new CatchDropletJudgement() };
|
||||
protected override Judgement CreateJudgement() => new CatchDropletJudgement();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Collections.Generic;
|
||||
using osu.Game.Rulesets.Catch.Judgements;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
|
||||
@ -9,6 +8,6 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
{
|
||||
public class Fruit : CatchHitObject
|
||||
{
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new CatchJudgement() };
|
||||
protected override Judgement CreateJudgement() => new CatchJudgement();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Collections.Generic;
|
||||
using osu.Game.Rulesets.Catch.Judgements;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
|
||||
@ -9,6 +8,6 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
{
|
||||
public class TinyDroplet : Droplet
|
||||
{
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new CatchTinyDropletJudgement() };
|
||||
protected override Judgement CreateJudgement() => new CatchTinyDropletJudgement();
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
|
||||
{
|
||||
if (tail.AllJudged)
|
||||
ApplyResult(Results.Single(), r => r.Type = HitResult.Perfect);
|
||||
ApplyResult(r => r.Type = HitResult.Perfect);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
@ -165,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 (Results.Single().Type == HitResult.Miss)
|
||||
if (Result.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
|
||||
@ -204,7 +204,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
if (!userTriggered)
|
||||
{
|
||||
if (!HitObject.HitWindows.CanBeHit(timeOffset))
|
||||
ApplyResult(Results.Single(), r => r.Type = HitResult.Miss);
|
||||
ApplyResult(r => r.Type = HitResult.Miss);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -213,7 +213,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
if (result == HitResult.None)
|
||||
return;
|
||||
|
||||
ApplyResult(Results.Single(), r =>
|
||||
ApplyResult(r =>
|
||||
{
|
||||
if (holdNote.hasBroken && (result == HitResult.Perfect || result == HitResult.Perfect))
|
||||
result = HitResult.Good;
|
||||
|
@ -2,7 +2,6 @@
|
||||
// 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;
|
||||
@ -80,9 +79,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
var startTime = HoldStartTime?.Invoke();
|
||||
|
||||
if (startTime == null || startTime > HitObject.StartTime)
|
||||
ApplyResult(Results.Single(), r => r.Type = HitResult.Miss);
|
||||
ApplyResult(r => r.Type = HitResult.Miss);
|
||||
else
|
||||
ApplyResult(Results.Single(), r => r.Type = HitResult.Perfect);
|
||||
ApplyResult(r => r.Type = HitResult.Perfect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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;
|
||||
@ -61,7 +60,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
if (!userTriggered)
|
||||
{
|
||||
if (!HitObject.HitWindows.CanBeHit(timeOffset))
|
||||
ApplyResult(Results.Single(), r => r.Type = HitResult.Miss);
|
||||
ApplyResult(r => r.Type = HitResult.Miss);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -69,7 +68,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
if (result == HitResult.None)
|
||||
return;
|
||||
|
||||
ApplyResult(Results.Single(), r => r.Type = result);
|
||||
ApplyResult(r => r.Type = result);
|
||||
}
|
||||
|
||||
public virtual bool OnPressed(ManiaAction action)
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Collections.Generic;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
@ -98,6 +97,6 @@ namespace osu.Game.Rulesets.Mania.Objects
|
||||
}
|
||||
}
|
||||
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new HoldNoteJudgement() };
|
||||
protected override Judgement CreateJudgement() => new HoldNoteJudgement();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Collections.Generic;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Mania.Judgements;
|
||||
|
||||
@ -12,6 +11,6 @@ namespace osu.Game.Rulesets.Mania.Objects
|
||||
/// </summary>
|
||||
public class HoldNoteTick : ManiaHitObject
|
||||
{
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new HoldNoteTickJudgement() };
|
||||
protected override Judgement CreateJudgement() => new HoldNoteTickJudgement();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Collections.Generic;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Mania.Judgements;
|
||||
|
||||
@ -12,6 +11,6 @@ namespace osu.Game.Rulesets.Mania.Objects
|
||||
/// </summary>
|
||||
public class Note : ManiaHitObject
|
||||
{
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new ManiaJudgement() };
|
||||
protected override Judgement CreateJudgement() => new ManiaJudgement();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Collections.Generic;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Mania.Judgements;
|
||||
|
||||
@ -9,6 +8,6 @@ namespace osu.Game.Rulesets.Mania.Objects
|
||||
{
|
||||
public class TailNote : Note
|
||||
{
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new ManiaJudgement() };
|
||||
protected override Judgement CreateJudgement() => new ManiaJudgement();
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
if (auto && !userTriggered && timeOffset > 0)
|
||||
{
|
||||
// force success
|
||||
ApplyResult(Results.Single(), r => r.Type = HitResult.Great);
|
||||
ApplyResult(r => r.Type = HitResult.Great);
|
||||
}
|
||||
else
|
||||
base.CheckForJudgements(userTriggered, timeOffset);
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
||||
@ -82,7 +81,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
if (!userTriggered)
|
||||
{
|
||||
if (!HitObject.HitWindows.CanBeHit(timeOffset))
|
||||
ApplyResult(Results.Single(), r => r.Type = HitResult.Miss);
|
||||
ApplyResult(r => r.Type = HitResult.Miss);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -91,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
if (result == HitResult.None)
|
||||
return;
|
||||
|
||||
ApplyResult(Results.Single(), r => r.Type = result);
|
||||
ApplyResult(r => r.Type = result);
|
||||
}
|
||||
|
||||
protected override void UpdatePreemptState()
|
||||
|
@ -4,7 +4,6 @@
|
||||
using System;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Framework.Graphics;
|
||||
using System.Linq;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Rulesets.Osu.Judgements;
|
||||
@ -35,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
UpdatePreemptState();
|
||||
|
||||
var judgementOffset = Math.Min(HitObject.HitWindows.HalfWindowFor(HitResult.Miss), Results.FirstOrDefault()?.TimeOffset ?? 0);
|
||||
var judgementOffset = Math.Min(HitObject.HitWindows.HalfWindowFor(HitResult.Miss), Result?.TimeOffset ?? 0);
|
||||
|
||||
using (BeginDelayedSequence(HitObject.TimePreempt + judgementOffset, true))
|
||||
UpdateCurrentState(state);
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
@ -45,7 +44,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
|
||||
{
|
||||
if (repeatPoint.StartTime <= Time.Current)
|
||||
ApplyResult(Results.Single(), r => r.Type = drawableSlider.Tracking ? HitResult.Great : HitResult.Miss);
|
||||
ApplyResult(r => r.Type = drawableSlider.Tracking ? HitResult.Great : HitResult.Miss);
|
||||
}
|
||||
|
||||
protected override void UpdatePreemptState()
|
||||
|
@ -136,16 +136,16 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
if (userTriggered || Time.Current < slider.EndTime)
|
||||
return;
|
||||
|
||||
ApplyResult(Results.Single(), r =>
|
||||
ApplyResult(r =>
|
||||
{
|
||||
var judgementsCount = NestedHitObjects.Count();
|
||||
var judgementsHit = NestedHitObjects.Count(h => h.IsHit);
|
||||
|
||||
var hitFraction = (double)judgementsHit / judgementsCount;
|
||||
|
||||
if (hitFraction == 1 && HeadCircle.Results.Single().Type == HitResult.Great)
|
||||
if (hitFraction == 1 && HeadCircle.Result.Type == HitResult.Great)
|
||||
r.Type = HitResult.Great;
|
||||
else if (hitFraction >= 0.5 && HeadCircle.Results.Single().Type >= HitResult.Good)
|
||||
else if (hitFraction >= 0.5 && HeadCircle.Result.Type >= HitResult.Good)
|
||||
r.Type = HitResult.Good;
|
||||
else if (hitFraction > 0)
|
||||
r.Type = HitResult.Meh;
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Graphics;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
@ -32,7 +31,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
|
||||
{
|
||||
if (!userTriggered && timeOffset >= 0)
|
||||
ApplyResult(Results.Single(), r => r.Type = Tracking ? HitResult.Great : HitResult.Miss);
|
||||
ApplyResult(r => r.Type = Tracking ? HitResult.Great : HitResult.Miss);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Graphics;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using OpenTK;
|
||||
@ -51,7 +50,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
|
||||
{
|
||||
if (timeOffset >= 0)
|
||||
ApplyResult(Results.Single(), r => r.Type = Tracking ? HitResult.Great : HitResult.Miss);
|
||||
ApplyResult(r => r.Type = Tracking ? HitResult.Great : HitResult.Miss);
|
||||
}
|
||||
|
||||
protected override void UpdatePreemptState()
|
||||
|
@ -138,7 +138,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
if (userTriggered || Time.Current < Spinner.EndTime)
|
||||
return;
|
||||
|
||||
ApplyResult(Results.Single(), r =>
|
||||
ApplyResult(r =>
|
||||
{
|
||||
if (Progress >= 1)
|
||||
r.Type = HitResult.Great;
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Collections.Generic;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Osu.Judgements;
|
||||
|
||||
@ -9,6 +8,6 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
{
|
||||
public class HitCircle : OsuHitObject
|
||||
{
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new OsuJudgement() };
|
||||
protected override Judgement CreateJudgement() => new OsuJudgement();
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
@ -28,6 +27,6 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
TimePreempt = Math.Min(SpanDuration * 2, TimePreempt);
|
||||
}
|
||||
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new OsuJudgement() };
|
||||
protected override Judgement CreateJudgement() => new OsuJudgement();
|
||||
}
|
||||
}
|
||||
|
@ -214,6 +214,6 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
}
|
||||
}
|
||||
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new OsuJudgement() };
|
||||
protected override Judgement CreateJudgement() => new OsuJudgement();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Collections.Generic;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Osu.Judgements;
|
||||
|
||||
@ -14,6 +13,6 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
{
|
||||
}
|
||||
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new OsuSliderTailJudgement() };
|
||||
protected override Judgement CreateJudgement() => new OsuSliderTailJudgement();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Collections.Generic;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
@ -30,6 +29,6 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
TimePreempt = (StartTime - SpanStartTime) / 2 + offset;
|
||||
}
|
||||
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new OsuJudgement() };
|
||||
protected override Judgement CreateJudgement() => new OsuJudgement();
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
@ -33,6 +32,6 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
SpinsRequired = (int)Math.Max(1, SpinsRequired * 0.6);
|
||||
}
|
||||
|
||||
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new OsuJudgement() };
|
||||
protected override Judgement CreateJudgement() => new OsuJudgement();
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
/// <summary>
|
||||
/// Whether this <see cref="DrawableHitObject"/> and all of its nested <see cref="DrawableHitObject"/>s have been hit.
|
||||
/// </summary>
|
||||
public bool IsHit => Results.All(j => j.IsHit) && NestedHitObjects.All(n => n.IsHit);
|
||||
public bool IsHit => (Result?.IsHit ?? true) && NestedHitObjects.All(n => n.IsHit);
|
||||
|
||||
/// <summary>
|
||||
/// Whether this <see cref="DrawableHitObject"/> and all of its nested <see cref="DrawableHitObject"/>s have been judged.
|
||||
@ -57,17 +57,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
/// Whether this <see cref="DrawableHitObject"/> has been judged.
|
||||
/// Note: This does NOT include nested hitobjects.
|
||||
/// </summary>
|
||||
public bool Judged => Results.All(h => h.HasResult);
|
||||
public bool Judged => Result?.HasResult ?? true;
|
||||
|
||||
private readonly List<JudgementResult> results = new List<JudgementResult>();
|
||||
public IReadOnlyList<JudgementResult> Results => results;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="JudgementResult"/> that affects whether this <see cref="DrawableHitObject"/> has been hit or missed.
|
||||
/// By default, this is the last <see cref="JudgementResult"/> in <see cref="Results"/>, and should be overridden if the order
|
||||
/// of <see cref="Judgement"/>s in <see cref="HitObject.CreateJudgements"/> doesn't list the main <see cref="Judgement"/> as its last element.
|
||||
/// </summary>
|
||||
protected virtual JudgementResult MainResult => Results.LastOrDefault();
|
||||
public readonly JudgementResult Result;
|
||||
|
||||
private bool judgementOccurred;
|
||||
|
||||
@ -85,8 +77,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
{
|
||||
HitObject = hitObject;
|
||||
|
||||
foreach (var j in hitObject.Judgements)
|
||||
results.Add(CreateJudgementResult(j));
|
||||
if (hitObject.Judgement != null)
|
||||
Result = CreateJudgementResult(hitObject.Judgement);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -144,20 +136,15 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (lastUpdateTime > Time.Current)
|
||||
if (Result != null && lastUpdateTime > Time.Current)
|
||||
{
|
||||
var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;
|
||||
|
||||
for (int i = Results.Count - 1; i >= 0; i--)
|
||||
if (Result.TimeOffset + endTime < Time.Current)
|
||||
{
|
||||
var judgement = Results[i];
|
||||
OnJudgementRemoved?.Invoke(this, Result);
|
||||
|
||||
if (judgement.TimeOffset + endTime <= Time.Current)
|
||||
break;
|
||||
|
||||
OnJudgementRemoved?.Invoke(this, judgement);
|
||||
|
||||
judgement.Type = HitResult.None;
|
||||
Result.Type = HitResult.None;
|
||||
State.Value = ArmedState.Idle;
|
||||
}
|
||||
}
|
||||
@ -185,36 +172,29 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
/// Notifies that a new judgement has occurred for this <see cref="DrawableHitObject"/>.
|
||||
/// </summary>
|
||||
/// <param name="judgement">The <see cref="Judgement"/>.</param>
|
||||
protected void ApplyResult(JudgementResult result, Action<JudgementResult> application)
|
||||
protected void ApplyResult(Action<JudgementResult> application)
|
||||
{
|
||||
// Todo: Unsure if we want to keep this
|
||||
if (!Results.Contains(result))
|
||||
throw new ArgumentException($"The applied judgement result must be a part of {Results}.");
|
||||
|
||||
application?.Invoke(result);
|
||||
application?.Invoke(Result);
|
||||
|
||||
judgementOccurred = true;
|
||||
|
||||
// Ensure that the judgement is given a valid time offset, because this may not get set by the caller
|
||||
var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;
|
||||
result.TimeOffset = Time.Current - endTime;
|
||||
Result.TimeOffset = Time.Current - endTime;
|
||||
|
||||
if (result == MainResult)
|
||||
switch (Result.Type)
|
||||
{
|
||||
switch (result.Type)
|
||||
{
|
||||
case HitResult.None:
|
||||
break;
|
||||
case HitResult.Miss:
|
||||
State.Value = ArmedState.Miss;
|
||||
break;
|
||||
default:
|
||||
State.Value = ArmedState.Hit;
|
||||
break;
|
||||
}
|
||||
case HitResult.None:
|
||||
break;
|
||||
case HitResult.Miss:
|
||||
State.Value = ArmedState.Miss;
|
||||
break;
|
||||
default:
|
||||
State.Value = ArmedState.Hit;
|
||||
break;
|
||||
}
|
||||
|
||||
OnJudgement?.Invoke(this, result);
|
||||
OnJudgement?.Invoke(this, Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Lists;
|
||||
@ -64,8 +63,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
[JsonIgnore]
|
||||
public IReadOnlyList<HitObject> NestedHitObjects => nestedHitObjects.Value;
|
||||
|
||||
private readonly List<Judgement> judgements = new List<Judgement>();
|
||||
public IReadOnlyList<Judgement> Judgements => judgements;
|
||||
public Judgement Judgement { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Applies default values to this HitObject.
|
||||
@ -76,8 +74,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
{
|
||||
ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
||||
|
||||
judgements.Clear();
|
||||
judgements.AddRange(CreateJudgements());
|
||||
Judgement = CreateJudgement();
|
||||
|
||||
if (nestedHitObjects.IsValueCreated)
|
||||
nestedHitObjects.Value.Clear();
|
||||
@ -111,7 +108,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual IEnumerable<Judgement> CreateJudgements() => Enumerable.Empty<Judgement>();
|
||||
protected virtual Judgement CreateJudgement() => null;
|
||||
|
||||
protected void AddNested(HitObject hitObject) => nestedHitObjects.Value.Add(hitObject);
|
||||
|
||||
|
@ -224,13 +224,13 @@ namespace osu.Game.Rulesets.Scoring
|
||||
foreach (var nested in obj.NestedHitObjects)
|
||||
simulate(nested);
|
||||
|
||||
foreach (var judgement in obj.Judgements)
|
||||
{
|
||||
var result = CreateJudgementResult(judgement);
|
||||
result.Type = judgement.MaxResult;
|
||||
if (obj.Judgement == null)
|
||||
return;
|
||||
|
||||
AddJudgement(result);
|
||||
}
|
||||
var result = CreateJudgementResult(obj.Judgement);
|
||||
result.Type = obj.Judgement.MaxResult;
|
||||
|
||||
AddJudgement(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user