mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 07:22:55 +08:00
Add test case for bar lines.
This commit is contained in:
parent
e1f8f44b32
commit
9f3def05ef
@ -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 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
|
||||
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 @@ 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>
|
||||
{
|
||||
public DrawableTestHit(TaikoHitObject hitObject)
|
||||
|
@ -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 @@ namespace osu.Game.Modes.Taiko.Objects
|
||||
/// </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;
|
||||
|
@ -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 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user