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.Screens.Testing;
using osu.Framework.Timing;
using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Taiko.Judgements;
using osu.Game.Modes.Taiko.Objects;
@ -17,12 +18,20 @@ internal class TestCaseTaikoPlayfield : TestCase
private TaikoPlayfield playfield;
public TestCaseTaikoPlayfield()
{
Clock = new FramedClock();
}
public override void Reset()
{
base.Reset();
Clock.ProcessFrame();
AddButton("Hit!", addHitJudgement);
AddButton("Miss :(", addMissJudgement);
AddButton("Add bar line", addBarLine);
Add(playfield = new TaikoPlayfield
{
@ -61,6 +70,19 @@ private void addMissJudgement()
});
}
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>
{
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;
namespace osu.Game.Modes.Taiko.Objects
@ -15,11 +18,6 @@ public class BarLine
/// </summary>
public double PreEmpt;
/// <summary>
/// Whether this is a major bar line (affects display).
/// </summary>
public bool IsMajor;
public void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty)
{
PreEmpt = 600 / (timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier) * 1000;

View File

@ -4,7 +4,6 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Modes.Taiko.UI;
using OpenTK;
namespace osu.Game.Modes.Taiko.Objects.Drawable
@ -49,16 +48,16 @@ public DrawableBarLine(BarLine barLine)
Alpha = 0.75f
}
};
LifetimeStart = BarLine.StartTime - BarLine.PreEmpt * 2;
LifetimeEnd = BarLine.StartTime + BarLine.PreEmpt;
}
protected override void 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);
}