1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 13:33:03 +08:00

Add test case for bar lines.

This commit is contained in:
smoogipooo 2017-03-21 21:27:20 +09:00
parent e1f8f44b32
commit 9f3def05ef
3 changed files with 30 additions and 11 deletions

View File

@ -3,6 +3,7 @@
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Framework.Screens.Testing; using osu.Framework.Screens.Testing;
using osu.Framework.Timing;
using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Judgements;
using osu.Game.Modes.Taiko.Objects; using osu.Game.Modes.Taiko.Objects;
@ -17,12 +18,20 @@ namespace osu.Desktop.VisualTests.Tests
private TaikoPlayfield playfield; private TaikoPlayfield playfield;
public TestCaseTaikoPlayfield()
{
Clock = new FramedClock();
}
public override void Reset() public override void Reset()
{ {
base.Reset(); base.Reset();
Clock.ProcessFrame();
AddButton("Hit!", addHitJudgement); AddButton("Hit!", addHitJudgement);
AddButton("Miss :(", addMissJudgement); AddButton("Miss :(", addMissJudgement);
AddButton("Add bar line", addBarLine);
Add(playfield = new TaikoPlayfield Add(playfield = new TaikoPlayfield
{ {
@ -61,6 +70,19 @@ namespace osu.Desktop.VisualTests.Tests
}); });
} }
private void addBarLine()
{
bool isMajor = RNG.Next(8) == 0;
BarLine bl = new BarLine
{
StartTime = Time.Current + 1000,
PreEmpt = 1000
};
playfield.AddBarLine(isMajor ? new DrawableMajorBarLine(bl) : new DrawableBarLine(bl));
}
private class DrawableTestHit : DrawableHitObject<TaikoHitObject, TaikoJudgementInfo> private class DrawableTestHit : DrawableHitObject<TaikoHitObject, TaikoJudgementInfo>
{ {
public DrawableTestHit(TaikoHitObject hitObject) public DrawableTestHit(TaikoHitObject hitObject)

View File

@ -1,4 +1,7 @@
using osu.Game.Beatmaps.Timing; // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Beatmaps.Timing;
using osu.Game.Database; using osu.Game.Database;
namespace osu.Game.Modes.Taiko.Objects namespace osu.Game.Modes.Taiko.Objects
@ -15,11 +18,6 @@ namespace osu.Game.Modes.Taiko.Objects
/// </summary> /// </summary>
public double PreEmpt; public double PreEmpt;
/// <summary>
/// Whether this is a major bar line (affects display).
/// </summary>
public bool IsMajor;
public void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) public void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty)
{ {
PreEmpt = 600 / (timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier) * 1000; PreEmpt = 600 / (timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier) * 1000;

View File

@ -4,7 +4,6 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Modes.Taiko.UI;
using OpenTK; using OpenTK;
namespace osu.Game.Modes.Taiko.Objects.Drawable namespace osu.Game.Modes.Taiko.Objects.Drawable
@ -49,16 +48,16 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
Alpha = 0.75f Alpha = 0.75f
} }
}; };
LifetimeStart = BarLine.StartTime - BarLine.PreEmpt * 2;
LifetimeEnd = BarLine.StartTime + BarLine.PreEmpt;
} }
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
Delay(BarLine.StartTime); LifetimeStart = BarLine.StartTime - BarLine.PreEmpt * 2;
LifetimeEnd = BarLine.StartTime + BarLine.PreEmpt;
Delay(BarLine.StartTime - Time.Current);
FadeOut(100 * BarLine.PreEmpt / 1000); FadeOut(100 * BarLine.PreEmpt / 1000);
} }