mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Fix hitobjects with unknown lifetimes by enforcing non-null judgement
We've seen multiple cases where DrawableHitObject are stuck in the lifetime management container due to not implementing a judgement (meaning they are never "hit" or "missed"). To avoid this going forward CreateJudgement() must be implemented and return a non-null judgement. This fixes BananaShower and JuiceStreams in osu!catch. This also makes HitObject abstract and cleans up convert HitObject implementations.
This commit is contained in:
parent
66317f9fcd
commit
ffc7eaa3f2
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Objects
|
namespace osu.Game.Rulesets.Catch.Objects
|
||||||
@ -11,6 +12,8 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
|
|
||||||
public override bool LastInCombo => true;
|
public override bool LastInCombo => true;
|
||||||
|
|
||||||
|
public override Judgement CreateJudgement() => new IgnoreJudgement();
|
||||||
|
|
||||||
protected override void CreateNestedHitObjects()
|
protected override void CreateNestedHitObjects()
|
||||||
{
|
{
|
||||||
base.CreateNestedHitObjects();
|
base.CreateNestedHitObjects();
|
||||||
|
@ -7,6 +7,7 @@ using osu.Game.Audio;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Rulesets.Catch.UI;
|
using osu.Game.Rulesets.Catch.UI;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
|
||||||
@ -19,6 +20,8 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private const float base_scoring_distance = 100;
|
private const float base_scoring_distance = 100;
|
||||||
|
|
||||||
|
public override Judgement CreateJudgement() => new IgnoreJudgement();
|
||||||
|
|
||||||
public int RepeatCount { get; set; }
|
public int RepeatCount { get; set; }
|
||||||
|
|
||||||
public double Velocity;
|
public double Velocity;
|
||||||
|
@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
foreach (HitResult result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Skip(1))
|
foreach (HitResult result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Skip(1))
|
||||||
{
|
{
|
||||||
AddStep("Show " + result.GetDescription(), () => SetContents(() =>
|
AddStep("Show " + result.GetDescription(), () => SetContents(() =>
|
||||||
new DrawableManiaJudgement(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null)
|
new DrawableManiaJudgement(new JudgementResult(new ConvertHitObject(), new Judgement()) { Type = result }, null)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
// 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.
|
|
||||||
|
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Judgements
|
|
||||||
{
|
|
||||||
public class HoldNoteJudgement : ManiaJudgement
|
|
||||||
{
|
|
||||||
public override bool AffectsCombo => false;
|
|
||||||
|
|
||||||
protected override int NumericResultFor(HitResult result) => 0;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Objects
|
namespace osu.Game.Rulesets.Mania.Objects
|
||||||
@ -8,5 +9,7 @@ namespace osu.Game.Rulesets.Mania.Objects
|
|||||||
public class BarLine : ManiaHitObject, IBarLine
|
public class BarLine : ManiaHitObject, IBarLine
|
||||||
{
|
{
|
||||||
public bool Major { get; set; }
|
public bool Major { get; set; }
|
||||||
|
|
||||||
|
public override Judgement CreateJudgement() => new IgnoreJudgement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Mania.Judgements;
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
@ -103,7 +102,7 @@ namespace osu.Game.Rulesets.Mania.Objects
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Judgement CreateJudgement() => new HoldNoteJudgement();
|
public override Judgement CreateJudgement() => new IgnoreJudgement();
|
||||||
|
|
||||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
foreach (HitResult result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Skip(1))
|
foreach (HitResult result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Skip(1))
|
||||||
{
|
{
|
||||||
AddStep("Show " + result.GetDescription(), () => SetContents(() =>
|
AddStep("Show " + result.GetDescription(), () => SetContents(() =>
|
||||||
new DrawableOsuJudgement(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null)
|
new DrawableOsuJudgement(new JudgementResult(new ConvertHitObject(), new Judgement()) { Type = result }, null)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
// 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.
|
|
||||||
|
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Judgements
|
|
||||||
{
|
|
||||||
public class OsuSliderTailJudgement : OsuJudgement
|
|
||||||
{
|
|
||||||
public override bool AffectsCombo => false;
|
|
||||||
|
|
||||||
protected override int NumericResultFor(HitResult result) => 0;
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,7 +4,6 @@
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Judgements;
|
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects
|
namespace osu.Game.Rulesets.Osu.Objects
|
||||||
@ -23,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
pathVersion.BindValueChanged(_ => Position = slider.EndPosition);
|
pathVersion.BindValueChanged(_ => Position = slider.EndPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Judgement CreateJudgement() => new OsuSliderTailJudgement();
|
public override Judgement CreateJudgement() => new IgnoreJudgement();
|
||||||
|
|
||||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Rulesets.Taiko.Judgements;
|
|
||||||
using osu.Game.Rulesets.Taiko.Objects;
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
@ -28,7 +27,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
public void TestZeroTickTimeOffsets()
|
public void TestZeroTickTimeOffsets()
|
||||||
{
|
{
|
||||||
AddUntilStep("gameplay finished", () => Player.ScoreProcessor.HasCompleted);
|
AddUntilStep("gameplay finished", () => Player.ScoreProcessor.HasCompleted);
|
||||||
AddAssert("all tick offsets are 0", () => Player.Results.Where(r => r.Judgement is TaikoSwellTickJudgement).All(r => r.TimeOffset == 0));
|
AddAssert("all tick offsets are 0", () => Player.Results.Where(r => r.HitObject is SwellTick).All(r => r.TimeOffset == 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool Autoplay => true;
|
protected override bool Autoplay => true;
|
||||||
|
@ -148,7 +148,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
|
|
||||||
var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) };
|
var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) };
|
||||||
|
|
||||||
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new HitObject(), new TaikoJudgement()) { Type = hitResult });
|
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new ConvertHitObject(), new TaikoJudgement()) { Type = hitResult });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addStrongHitJudgement(bool kiai)
|
private void addStrongHitJudgement(bool kiai)
|
||||||
@ -163,13 +163,13 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
|
|
||||||
var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) };
|
var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) };
|
||||||
|
|
||||||
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new HitObject(), new TaikoJudgement()) { Type = hitResult });
|
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new ConvertHitObject(), new TaikoJudgement()) { Type = hitResult });
|
||||||
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(new TestStrongNestedHit(h), new JudgementResult(new HitObject(), new TaikoStrongJudgement()) { Type = HitResult.Great });
|
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(new TestStrongNestedHit(h), new JudgementResult(new ConvertHitObject(), new TaikoStrongJudgement()) { Type = HitResult.Great });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addMissJudgement()
|
private void addMissJudgement()
|
||||||
{
|
{
|
||||||
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(new DrawableTestHit(new Hit()), new JudgementResult(new HitObject(), new TaikoJudgement()) { Type = HitResult.Miss });
|
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(new DrawableTestHit(new Hit()), new JudgementResult(new ConvertHitObject(), new TaikoJudgement()) { Type = HitResult.Miss });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addBarLine(bool major, double delay = scroll_time)
|
private void addBarLine(bool major, double delay = scroll_time)
|
||||||
|
@ -3,13 +3,12 @@
|
|||||||
|
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Rulesets.Taiko.Judgements;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Objects
|
namespace osu.Game.Rulesets.Taiko.Objects
|
||||||
{
|
{
|
||||||
public class SwellTick : TaikoHitObject
|
public class SwellTick : TaikoHitObject
|
||||||
{
|
{
|
||||||
public override Judgement CreateJudgement() => new TaikoSwellTickJudgement();
|
public override Judgement CreateJudgement() => new IgnoreJudgement();
|
||||||
|
|
||||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
||||||
}
|
}
|
||||||
|
@ -154,6 +154,7 @@ namespace osu.Game.Tests.Gameplay
|
|||||||
private class JudgeableHitObject : HitObject
|
private class JudgeableHitObject : HitObject
|
||||||
{
|
{
|
||||||
public override Judgement CreateJudgement() => new Judgement();
|
public override Judgement CreateJudgement() => new Judgement();
|
||||||
|
protected override HitWindows CreateHitWindows() => new HitWindows();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ namespace osu.Game.Tests.Gameplay
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestHitObjectWithCombo : HitObject, IHasComboInformation
|
private class TestHitObjectWithCombo : ConvertHitObject, IHasComboInformation
|
||||||
{
|
{
|
||||||
public bool NewCombo { get; } = false;
|
public bool NewCombo { get; } = false;
|
||||||
public int ComboOffset { get; } = 0;
|
public int ComboOffset { get; } = 0;
|
||||||
|
@ -27,9 +27,9 @@ namespace osu.Game.Tests.Gameplay
|
|||||||
{
|
{
|
||||||
DrawableHitObject hitObject = null;
|
DrawableHitObject hitObject = null;
|
||||||
|
|
||||||
AddStep("setup", () => container.Add(new TestDrawableHitObject(new HitObject { StartTime = 500 })));
|
AddStep("setup", () => container.Add(new TestDrawableHitObject(new ConvertHitObject { StartTime = 500 })));
|
||||||
|
|
||||||
AddStep("add late hitobject", () => container.Add(hitObject = new TestDrawableHitObject(new HitObject { StartTime = 1000 })));
|
AddStep("add late hitobject", () => container.Add(hitObject = new TestDrawableHitObject(new ConvertHitObject { StartTime = 1000 })));
|
||||||
|
|
||||||
AddAssert("hitobject index is 0", () => container.IndexOf(hitObject) == 0);
|
AddAssert("hitobject index is 0", () => container.IndexOf(hitObject) == 0);
|
||||||
}
|
}
|
||||||
@ -39,9 +39,9 @@ namespace osu.Game.Tests.Gameplay
|
|||||||
{
|
{
|
||||||
DrawableHitObject hitObject = null;
|
DrawableHitObject hitObject = null;
|
||||||
|
|
||||||
AddStep("setup", () => container.Add(new TestDrawableHitObject(new HitObject { StartTime = 500 })));
|
AddStep("setup", () => container.Add(new TestDrawableHitObject(new ConvertHitObject { StartTime = 500 })));
|
||||||
|
|
||||||
AddStep("add early hitobject", () => container.Add(hitObject = new TestDrawableHitObject(new HitObject())));
|
AddStep("add early hitobject", () => container.Add(hitObject = new TestDrawableHitObject(new ConvertHitObject())));
|
||||||
|
|
||||||
AddAssert("hitobject index is 0", () => container.IndexOf(hitObject) == 1);
|
AddAssert("hitobject index is 0", () => container.IndexOf(hitObject) == 1);
|
||||||
}
|
}
|
||||||
@ -54,8 +54,8 @@ namespace osu.Game.Tests.Gameplay
|
|||||||
|
|
||||||
AddStep("setup", () =>
|
AddStep("setup", () =>
|
||||||
{
|
{
|
||||||
container.Add(firstObject = new TestDrawableHitObject(new HitObject()));
|
container.Add(firstObject = new TestDrawableHitObject(new ConvertHitObject()));
|
||||||
container.Add(secondObject = new TestDrawableHitObject(new HitObject { StartTime = 1000 }));
|
container.Add(secondObject = new TestDrawableHitObject(new ConvertHitObject { StartTime = 1000 }));
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("move first object after second", () => firstObject.HitObject.StartTime = 2000);
|
AddStep("move first object after second", () => firstObject.HitObject.StartTime = 2000);
|
||||||
|
@ -163,7 +163,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
var beatmap = new Beatmap<HitObject> { BeatmapInfo = { Ruleset = new OsuRuleset().RulesetInfo } };
|
var beatmap = new Beatmap<HitObject> { BeatmapInfo = { Ruleset = new OsuRuleset().RulesetInfo } };
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
beatmap.HitObjects.Add(new HitObject { StartTime = i * time_range });
|
beatmap.HitObjects.Add(new ConvertHitObject { StartTime = i * time_range });
|
||||||
|
|
||||||
return beatmap;
|
return beatmap;
|
||||||
}
|
}
|
||||||
@ -289,7 +289,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
#region HitObject
|
#region HitObject
|
||||||
|
|
||||||
private class TestHitObject : HitObject, IHasEndTime
|
private class TestHitObject : ConvertHitObject, IHasEndTime
|
||||||
{
|
{
|
||||||
public double EndTime { get; set; }
|
public double EndTime { get; set; }
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
private void newJudgement(double offset = 0)
|
private void newJudgement(double offset = 0)
|
||||||
{
|
{
|
||||||
var judgement = new JudgementResult(new HitObject(), new Judgement())
|
var judgement = new JudgementResult(new ConvertHitObject(), new Judgement())
|
||||||
{
|
{
|
||||||
TimeOffset = offset == 0 ? RNG.Next(-150, 150) : offset,
|
TimeOffset = offset == 0 ? RNG.Next(-150, 150) : offset,
|
||||||
Type = HitResult.Perfect,
|
Type = HitResult.Perfect,
|
||||||
|
@ -224,7 +224,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
private class TestDrawableControlPoint : DrawableHitObject<HitObject>
|
private class TestDrawableControlPoint : DrawableHitObject<HitObject>
|
||||||
{
|
{
|
||||||
public TestDrawableControlPoint(ScrollingDirection direction, double time)
|
public TestDrawableControlPoint(ScrollingDirection direction, double time)
|
||||||
: base(new HitObject { StartTime = time })
|
: base(new ConvertHitObject { StartTime = time })
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
private class TestDrawableHitObject : DrawableHitObject<HitObject>
|
private class TestDrawableHitObject : DrawableHitObject<HitObject>
|
||||||
{
|
{
|
||||||
public TestDrawableHitObject(double time)
|
public TestDrawableHitObject(double time)
|
||||||
: base(new HitObject { StartTime = time })
|
: base(new ConvertHitObject { StartTime = time })
|
||||||
{
|
{
|
||||||
Origin = Anchor.Custom;
|
Origin = Anchor.Custom;
|
||||||
OriginPosition = new Vector2(75 / 4.0f);
|
OriginPosition = new Vector2(75 / 4.0f);
|
||||||
|
@ -123,7 +123,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
var objects = new List<HitObject>();
|
var objects = new List<HitObject>();
|
||||||
for (double i = 0; i < 5000; i += RNG.NextDouble() * 10 + i / 1000)
|
for (double i = 0; i < 5000; i += RNG.NextDouble() * 10 + i / 1000)
|
||||||
objects.Add(new HitObject { StartTime = i });
|
objects.Add(new ConvertHitObject { StartTime = i });
|
||||||
|
|
||||||
replaceObjects(objects);
|
replaceObjects(objects);
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
var objects = new List<HitObject>();
|
var objects = new List<HitObject>();
|
||||||
for (double i = 0; i < 5000; i++)
|
for (double i = 0; i < 5000; i++)
|
||||||
objects.Add(new HitObject { StartTime = i });
|
objects.Add(new ConvertHitObject { StartTime = i });
|
||||||
|
|
||||||
replaceObjects(objects);
|
replaceObjects(objects);
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
public new BufferedWedgeInfo Info => base.Info;
|
public new BufferedWedgeInfo Info => base.Info;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestHitObject : HitObject, IHasPosition
|
private class TestHitObject : ConvertHitObject, IHasPosition
|
||||||
{
|
{
|
||||||
public float X { get; } = 0;
|
public float X { get; } = 0;
|
||||||
public float Y { get; } = 0;
|
public float Y { get; } = 0;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Judgements
|
namespace osu.Game.Rulesets.Judgements
|
||||||
{
|
{
|
||||||
public class TaikoSwellTickJudgement : TaikoJudgement
|
public class IgnoreJudgement : Judgement
|
||||||
{
|
{
|
||||||
public override bool AffectsCombo => false;
|
public override bool AffectsCombo => false;
|
||||||
|
|
18
osu.Game/Rulesets/Objects/ConvertHitObject.cs
Normal file
18
osu.Game/Rulesets/Objects/ConvertHitObject.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Objects
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A hit object only used for conversion, not actual gameplay.
|
||||||
|
/// </summary>
|
||||||
|
public class ConvertHitObject : HitObject
|
||||||
|
{
|
||||||
|
public override Judgement CreateJudgement() => new IgnoreJudgement();
|
||||||
|
|
||||||
|
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
||||||
|
}
|
||||||
|
}
|
@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
/// HitObjects may contain more properties for which you should be checking through the IHas* types.
|
/// HitObjects may contain more properties for which you should be checking through the IHas* types.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class HitObject
|
public abstract class HitObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A small adjustment to the start time of control points to account for rounding/precision errors.
|
/// A small adjustment to the start time of control points to account for rounding/precision errors.
|
||||||
@ -83,7 +83,7 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public IReadOnlyList<HitObject> NestedHitObjects => nestedHitObjects;
|
public IReadOnlyList<HitObject> NestedHitObjects => nestedHitObjects;
|
||||||
|
|
||||||
public HitObject()
|
protected HitObject()
|
||||||
{
|
{
|
||||||
StartTimeBindable.ValueChanged += time =>
|
StartTimeBindable.ValueChanged += time =>
|
||||||
{
|
{
|
||||||
@ -144,9 +144,10 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the <see cref="Judgement"/> that represents the scoring information for this <see cref="HitObject"/>.
|
/// Creates the <see cref="Judgement"/> that represents the scoring information for this <see cref="HitObject"/>.
|
||||||
/// May be null.
|
/// Used to decide on drawable object lifetimes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual Judgement CreateJudgement() => null;
|
[NotNull]
|
||||||
|
public abstract Judgement CreateJudgement();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the <see cref="HitWindows"/> for this <see cref="HitObject"/>.
|
/// Creates the <see cref="HitWindows"/> for this <see cref="HitObject"/>.
|
||||||
@ -156,7 +157,7 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
/// </para>
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[NotNull]
|
[NotNull]
|
||||||
protected virtual HitWindows CreateHitWindows() => new HitWindows();
|
protected abstract HitWindows CreateHitWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class HitObjectExtensions
|
public static class HitObjectExtensions
|
||||||
|
@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Legacy osu!catch Hit-type, used for parsing Beatmaps.
|
/// Legacy osu!catch Hit-type, used for parsing Beatmaps.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class ConvertHit : HitObject, IHasCombo, IHasXPosition
|
internal sealed class ConvertHit : ConvertHitObject, IHasCombo, IHasXPosition
|
||||||
{
|
{
|
||||||
public float X { get; set; }
|
public float X { get; set; }
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Legacy osu!catch Spinner-type, used for parsing Beatmaps.
|
/// Legacy osu!catch Spinner-type, used for parsing Beatmaps.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class ConvertSpinner : HitObject, IHasEndTime, IHasXPosition, IHasCombo
|
internal sealed class ConvertSpinner : ConvertHitObject, IHasEndTime, IHasXPosition, IHasCombo
|
||||||
{
|
{
|
||||||
public double EndTime { get; set; }
|
public double EndTime { get; set; }
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ using osu.Game.Beatmaps.ControlPoints;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy
|
namespace osu.Game.Rulesets.Objects.Legacy
|
||||||
{
|
{
|
||||||
internal abstract class ConvertSlider : HitObject, IHasCurve, IHasLegacyLastTickOffset
|
internal abstract class ConvertSlider : ConvertHitObject, IHasCurve, IHasLegacyLastTickOffset
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Scoring distance with a speed-adjusted beat length of 1 second.
|
/// Scoring distance with a speed-adjusted beat length of 1 second.
|
||||||
|
@ -2,17 +2,14 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Legacy osu!mania Hit-type, used for parsing Beatmaps.
|
/// Legacy osu!mania Hit-type, used for parsing Beatmaps.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class ConvertHit : HitObject, IHasXPosition
|
internal sealed class ConvertHit : ConvertHitObject, IHasXPosition
|
||||||
{
|
{
|
||||||
public float X { get; set; }
|
public float X { get; set; }
|
||||||
|
|
||||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,18 +2,15 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
||||||
{
|
{
|
||||||
internal sealed class ConvertHold : HitObject, IHasXPosition, IHasEndTime
|
internal sealed class ConvertHold : ConvertHitObject, IHasXPosition, IHasEndTime
|
||||||
{
|
{
|
||||||
public float X { get; set; }
|
public float X { get; set; }
|
||||||
|
|
||||||
public double EndTime { get; set; }
|
public double EndTime { get; set; }
|
||||||
|
|
||||||
public double Duration => EndTime - StartTime;
|
public double Duration => EndTime - StartTime;
|
||||||
|
|
||||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
||||||
{
|
{
|
||||||
@ -12,7 +11,5 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
|||||||
internal sealed class ConvertSlider : Legacy.ConvertSlider, IHasXPosition
|
internal sealed class ConvertSlider : Legacy.ConvertSlider, IHasXPosition
|
||||||
{
|
{
|
||||||
public float X { get; set; }
|
public float X { get; set; }
|
||||||
|
|
||||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,21 +2,18 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Legacy osu!mania Spinner-type, used for parsing Beatmaps.
|
/// Legacy osu!mania Spinner-type, used for parsing Beatmaps.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class ConvertSpinner : HitObject, IHasEndTime, IHasXPosition
|
internal sealed class ConvertSpinner : ConvertHitObject, IHasEndTime, IHasXPosition
|
||||||
{
|
{
|
||||||
public double EndTime { get; set; }
|
public double EndTime { get; set; }
|
||||||
|
|
||||||
public double Duration => EndTime - StartTime;
|
public double Duration => EndTime - StartTime;
|
||||||
|
|
||||||
public float X { get; set; }
|
public float X { get; set; }
|
||||||
|
|
||||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
||||||
@ -10,7 +9,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Legacy osu! Hit-type, used for parsing Beatmaps.
|
/// Legacy osu! Hit-type, used for parsing Beatmaps.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class ConvertHit : HitObject, IHasPosition, IHasCombo
|
internal sealed class ConvertHit : ConvertHitObject, IHasPosition, IHasCombo
|
||||||
{
|
{
|
||||||
public Vector2 Position { get; set; }
|
public Vector2 Position { get; set; }
|
||||||
|
|
||||||
@ -21,7 +20,5 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
|||||||
public bool NewCombo { get; set; }
|
public bool NewCombo { get; set; }
|
||||||
|
|
||||||
public int ComboOffset { get; set; }
|
public int ComboOffset { get; set; }
|
||||||
|
|
||||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
||||||
@ -21,7 +20,5 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
|||||||
public bool NewCombo { get; set; }
|
public bool NewCombo { get; set; }
|
||||||
|
|
||||||
public int ComboOffset { get; set; }
|
public int ComboOffset { get; set; }
|
||||||
|
|
||||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
||||||
@ -10,7 +9,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Legacy osu! Spinner-type, used for parsing Beatmaps.
|
/// Legacy osu! Spinner-type, used for parsing Beatmaps.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class ConvertSpinner : HitObject, IHasEndTime, IHasPosition, IHasCombo
|
internal sealed class ConvertSpinner : ConvertHitObject, IHasEndTime, IHasPosition, IHasCombo
|
||||||
{
|
{
|
||||||
public double EndTime { get; set; }
|
public double EndTime { get; set; }
|
||||||
|
|
||||||
@ -22,8 +21,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
|||||||
|
|
||||||
public float Y => Position.Y;
|
public float Y => Position.Y;
|
||||||
|
|
||||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
|
||||||
|
|
||||||
public bool NewCombo { get; set; }
|
public bool NewCombo { get; set; }
|
||||||
|
|
||||||
public int ComboOffset { get; set; }
|
public int ComboOffset { get; set; }
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Taiko
|
namespace osu.Game.Rulesets.Objects.Legacy.Taiko
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Legacy osu!taiko Hit-type, used for parsing Beatmaps.
|
/// Legacy osu!taiko Hit-type, used for parsing Beatmaps.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class ConvertHit : HitObject
|
internal sealed class ConvertHit : ConvertHitObject
|
||||||
{
|
{
|
||||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Taiko
|
namespace osu.Game.Rulesets.Objects.Legacy.Taiko
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -10,6 +8,5 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class ConvertSlider : Legacy.ConvertSlider
|
internal sealed class ConvertSlider : Legacy.ConvertSlider
|
||||||
{
|
{
|
||||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,19 +2,16 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Taiko
|
namespace osu.Game.Rulesets.Objects.Legacy.Taiko
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Legacy osu!taiko Spinner-type, used for parsing Beatmaps.
|
/// Legacy osu!taiko Spinner-type, used for parsing Beatmaps.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class ConvertSpinner : HitObject, IHasEndTime
|
internal sealed class ConvertSpinner : ConvertHitObject, IHasEndTime
|
||||||
{
|
{
|
||||||
public double EndTime { get; set; }
|
public double EndTime { get; set; }
|
||||||
|
|
||||||
public double Duration => EndTime - StartTime;
|
public double Duration => EndTime - StartTime;
|
||||||
|
|
||||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user