1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Fix shaking test

This commit is contained in:
Dean Herbert 2019-07-29 17:05:13 +09:00
parent c514cbe2b7
commit 466297df55
2 changed files with 14 additions and 13 deletions

View File

@ -55,11 +55,7 @@ namespace osu.Game.Rulesets.Osu.Tests
circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = circleSize });
var drawable = new TestDrawableHitCircle(circle, auto)
{
Anchor = Anchor.Centre,
Depth = depthIndex++
};
var drawable = CreateDrawableHitCircle(circle, auto);
foreach (var mod in Mods.Value.OfType<IApplicableToDrawableHitObjects>())
mod.ApplyToDrawableHitObjects(new[] { drawable });
@ -67,6 +63,12 @@ namespace osu.Game.Rulesets.Osu.Tests
return drawable;
}
protected virtual TestDrawableHitCircle CreateDrawableHitCircle(HitCircle circle, bool auto) => new TestDrawableHitCircle(circle, auto)
{
Anchor = Anchor.Centre,
Depth = depthIndex++
};
private Drawable testStream(float circleSize, bool auto = false)
{
var container = new Container { RelativeSizeAxes = Axes.Both };

View File

@ -1,23 +1,22 @@
// 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.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Osu.Tests
{
public class TestSceneShaking : TestSceneHitCircle
{
public override void Add(Drawable drawable)
protected override TestDrawableHitCircle CreateDrawableHitCircle(HitCircle circle, bool auto)
{
base.Add(drawable);
var drawableHitObject = base.CreateDrawableHitCircle(circle, auto);
if (drawable is TestDrawableHitCircle hitObject)
{
Scheduler.AddDelayed(() => hitObject.TriggerJudgement(),
hitObject.HitObject.StartTime - (hitObject.HitObject.HitWindows.HalfWindowFor(HitResult.Miss) + RNG.Next(0, 300)) - Time.Current);
}
Scheduler.AddDelayed(() => drawableHitObject.TriggerJudgement(),
drawableHitObject.HitObject.StartTime - (drawableHitObject.HitObject.HitWindows.HalfWindowFor(HitResult.Miss) + RNG.Next(0, 300)) - Time.Current);
return drawableHitObject;
}
}
}