mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:17:51 +08:00
Revert changes to make HitObject abstract
This commit is contained in:
parent
401bf1c928
commit
a047456354
@ -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 ConvertHitObject(), new Judgement()) { Type = result }, null)
|
new DrawableManiaJudgement(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
@ -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 ConvertHitObject(), new Judgement()) { Type = result }, null)
|
new DrawableOsuJudgement(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
@ -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 ConvertHitObject(), new TaikoJudgement()) { Type = hitResult });
|
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new HitObject(), 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 ConvertHitObject(), new TaikoJudgement()) { Type = hitResult });
|
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new HitObject(), new TaikoJudgement()) { Type = hitResult });
|
||||||
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(new TestStrongNestedHit(h), new JudgementResult(new ConvertHitObject(), new TaikoStrongJudgement()) { Type = HitResult.Great });
|
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(new TestStrongNestedHit(h), new JudgementResult(new HitObject(), new TaikoStrongJudgement()) { Type = HitResult.Great });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addMissJudgement()
|
private void addMissJudgement()
|
||||||
{
|
{
|
||||||
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(new DrawableTestHit(new Hit()), new JudgementResult(new ConvertHitObject(), new TaikoJudgement()) { Type = HitResult.Miss });
|
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(new DrawableTestHit(new Hit()), new JudgementResult(new HitObject(), new TaikoJudgement()) { Type = HitResult.Miss });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addBarLine(bool major, double delay = scroll_time)
|
private void addBarLine(bool major, double delay = scroll_time)
|
||||||
|
@ -11,8 +11,8 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Objects.Legacy;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
|
@ -27,9 +27,9 @@ namespace osu.Game.Tests.Gameplay
|
|||||||
{
|
{
|
||||||
DrawableHitObject hitObject = null;
|
DrawableHitObject hitObject = null;
|
||||||
|
|
||||||
AddStep("setup", () => container.Add(new TestDrawableHitObject(new ConvertHitObject { StartTime = 500 })));
|
AddStep("setup", () => container.Add(new TestDrawableHitObject(new HitObject { StartTime = 500 })));
|
||||||
|
|
||||||
AddStep("add late hitobject", () => container.Add(hitObject = new TestDrawableHitObject(new ConvertHitObject { StartTime = 1000 })));
|
AddStep("add late hitobject", () => container.Add(hitObject = new TestDrawableHitObject(new HitObject { 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 ConvertHitObject { StartTime = 500 })));
|
AddStep("setup", () => container.Add(new TestDrawableHitObject(new HitObject { StartTime = 500 })));
|
||||||
|
|
||||||
AddStep("add early hitobject", () => container.Add(hitObject = new TestDrawableHitObject(new ConvertHitObject())));
|
AddStep("add early hitobject", () => container.Add(hitObject = new TestDrawableHitObject(new HitObject())));
|
||||||
|
|
||||||
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 ConvertHitObject()));
|
container.Add(firstObject = new TestDrawableHitObject(new HitObject()));
|
||||||
container.Add(secondObject = new TestDrawableHitObject(new ConvertHitObject { StartTime = 1000 }));
|
container.Add(secondObject = new TestDrawableHitObject(new HitObject { StartTime = 1000 }));
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("move first object after second", () => firstObject.HitObject.StartTime = 2000);
|
AddStep("move first object after second", () => firstObject.HitObject.StartTime = 2000);
|
||||||
|
@ -20,6 +20,7 @@ using osu.Game.Rulesets.Difficulty;
|
|||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Objects.Legacy;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
@ -163,7 +164,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 ConvertHitObject { StartTime = i * time_range });
|
beatmap.HitObjects.Add(new HitObject { StartTime = i * time_range });
|
||||||
|
|
||||||
return beatmap;
|
return beatmap;
|
||||||
}
|
}
|
||||||
|
@ -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 NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
@ -12,6 +11,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Rulesets.Catch.Scoring;
|
using osu.Game.Rulesets.Catch.Scoring;
|
||||||
using osu.Game.Rulesets.Mania.Scoring;
|
using osu.Game.Rulesets.Mania.Scoring;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Scoring;
|
using osu.Game.Rulesets.Osu.Scoring;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Rulesets.Taiko.Scoring;
|
using osu.Game.Rulesets.Taiko.Scoring;
|
||||||
@ -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 ConvertHitObject(), new Judgement())
|
var judgement = new JudgementResult(new HitObject(), 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 ConvertHitObject { StartTime = time })
|
: base(new HitObject { 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 ConvertHitObject { StartTime = time })
|
: base(new HitObject { 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 ConvertHitObject { StartTime = i });
|
objects.Add(new HitObject { 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 ConvertHitObject { StartTime = i });
|
objects.Add(new HitObject { StartTime = i });
|
||||||
|
|
||||||
replaceObjects(objects);
|
replaceObjects(objects);
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ using osu.Game.Rulesets;
|
|||||||
using osu.Game.Rulesets.Catch;
|
using osu.Game.Rulesets.Catch;
|
||||||
using osu.Game.Rulesets.Mania;
|
using osu.Game.Rulesets.Mania;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Legacy;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Taiko;
|
using osu.Game.Rulesets.Taiko;
|
||||||
|
@ -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 abstract class HitObject
|
public 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;
|
||||||
|
|
||||||
protected HitObject()
|
public HitObject()
|
||||||
{
|
{
|
||||||
StartTimeBindable.ValueChanged += time =>
|
StartTimeBindable.ValueChanged += time =>
|
||||||
{
|
{
|
||||||
@ -147,7 +147,7 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
/// Used to decide on drawable object lifetimes.
|
/// Used to decide on drawable object lifetimes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[NotNull]
|
[NotNull]
|
||||||
public abstract Judgement CreateJudgement();
|
public virtual Judgement CreateJudgement() => new Judgement();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the <see cref="HitWindows"/> for this <see cref="HitObject"/>.
|
/// Creates the <see cref="HitWindows"/> for this <see cref="HitObject"/>.
|
||||||
@ -157,7 +157,7 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
/// </para>
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[NotNull]
|
[NotNull]
|
||||||
protected abstract HitWindows CreateHitWindows();
|
protected virtual HitWindows CreateHitWindows() => new HitWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class HitObjectExtensions
|
public static class HitObjectExtensions
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects
|
namespace osu.Game.Rulesets.Objects.Legacy
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A hit object only used for conversion, not actual gameplay.
|
/// A hit object only used for conversion, not actual gameplay.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ConvertHitObject : HitObject
|
internal abstract class ConvertHitObject : HitObject
|
||||||
{
|
{
|
||||||
public override Judgement CreateJudgement() => new IgnoreJudgement();
|
public override Judgement CreateJudgement() => new IgnoreJudgement();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user