2017-03-21 14:09:54 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-03-21 14:54:57 +08:00
|
|
|
|
using osu.Framework.MathUtils;
|
2017-03-21 13:58:34 +08:00
|
|
|
|
using osu.Framework.Screens.Testing;
|
2017-03-21 14:54:57 +08:00
|
|
|
|
using osu.Game.Modes.Objects.Drawables;
|
|
|
|
|
using osu.Game.Modes.Taiko.Judgements;
|
|
|
|
|
using osu.Game.Modes.Taiko.Objects;
|
2017-03-28 15:50:06 +08:00
|
|
|
|
using osu.Game.Modes.Taiko.Objects.Drawable;
|
2017-03-21 14:09:54 +08:00
|
|
|
|
using osu.Game.Modes.Taiko.UI;
|
|
|
|
|
|
|
|
|
|
namespace osu.Desktop.VisualTests.Tests
|
|
|
|
|
{
|
|
|
|
|
internal class TestCaseTaikoPlayfield : TestCase
|
|
|
|
|
{
|
|
|
|
|
public override string Description => "Taiko playfield";
|
|
|
|
|
|
2017-03-21 14:54:57 +08:00
|
|
|
|
private TaikoPlayfield playfield;
|
|
|
|
|
|
2017-03-21 14:09:54 +08:00
|
|
|
|
public override void Reset()
|
|
|
|
|
{
|
|
|
|
|
base.Reset();
|
|
|
|
|
|
2017-03-21 14:54:57 +08:00
|
|
|
|
AddButton("Hit!", addHitJudgement);
|
|
|
|
|
AddButton("Miss :(", addMissJudgement);
|
2017-03-28 15:50:06 +08:00
|
|
|
|
AddButton("DrumRoll", () => addDrumRoll(false));
|
|
|
|
|
AddButton("Strong DrumRoll", () => addDrumRoll(true));
|
2017-03-21 14:54:57 +08:00
|
|
|
|
|
|
|
|
|
Add(playfield = new TaikoPlayfield
|
2017-03-21 14:09:54 +08:00
|
|
|
|
{
|
|
|
|
|
Y = 200
|
|
|
|
|
});
|
|
|
|
|
}
|
2017-03-21 14:54:57 +08:00
|
|
|
|
|
|
|
|
|
private void addHitJudgement()
|
|
|
|
|
{
|
2017-03-22 00:42:40 +08:00
|
|
|
|
TaikoHitResult hitResult = RNG.Next(2) == 0 ? TaikoHitResult.Good : TaikoHitResult.Great;
|
2017-03-21 14:54:57 +08:00
|
|
|
|
|
2017-03-23 15:56:42 +08:00
|
|
|
|
playfield.OnJudgement(new DrawableTestHit(new Hit())
|
2017-03-21 14:54:57 +08:00
|
|
|
|
{
|
2017-03-22 00:42:40 +08:00
|
|
|
|
X = RNG.NextSingle(hitResult == TaikoHitResult.Good ? -0.1f : -0.05f, hitResult == TaikoHitResult.Good ? 0.1f : 0.05f),
|
2017-03-23 18:00:18 +08:00
|
|
|
|
Judgement = new TaikoJudgement
|
2017-03-21 14:54:57 +08:00
|
|
|
|
{
|
|
|
|
|
Result = HitResult.Hit,
|
2017-03-22 00:42:40 +08:00
|
|
|
|
TaikoResult = hitResult,
|
2017-03-21 14:54:57 +08:00
|
|
|
|
TimeOffset = 0,
|
2017-03-21 16:49:22 +08:00
|
|
|
|
ComboAtHit = 1,
|
2017-03-21 16:55:18 +08:00
|
|
|
|
SecondHit = RNG.Next(10) == 0
|
2017-03-21 14:54:57 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void addMissJudgement()
|
|
|
|
|
{
|
2017-03-23 15:56:42 +08:00
|
|
|
|
playfield.OnJudgement(new DrawableTestHit(new Hit())
|
2017-03-21 14:54:57 +08:00
|
|
|
|
{
|
2017-03-23 18:00:18 +08:00
|
|
|
|
Judgement = new TaikoJudgement
|
2017-03-21 14:54:57 +08:00
|
|
|
|
{
|
|
|
|
|
Result = HitResult.Miss,
|
|
|
|
|
TimeOffset = 0,
|
|
|
|
|
ComboAtHit = 0
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-28 15:50:06 +08:00
|
|
|
|
private void addDrumRoll(bool strong)
|
|
|
|
|
{
|
|
|
|
|
var d = new DrumRoll
|
|
|
|
|
{
|
|
|
|
|
StartTime = Time.Current + 1000,
|
|
|
|
|
Distance = 2000,
|
|
|
|
|
PreEmpt = 1000,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (strong)
|
|
|
|
|
playfield.Add(new DrawableStrongDrumRoll(d));
|
|
|
|
|
else
|
|
|
|
|
playfield.Add(new DrawableDrumRoll(d));
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-23 18:00:18 +08:00
|
|
|
|
private class DrawableTestHit : DrawableHitObject<TaikoHitObject, TaikoJudgement>
|
2017-03-21 14:54:57 +08:00
|
|
|
|
{
|
|
|
|
|
public DrawableTestHit(TaikoHitObject hitObject)
|
|
|
|
|
: base(hitObject)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-23 18:00:18 +08:00
|
|
|
|
protected override TaikoJudgement CreateJudgement() => new TaikoJudgement();
|
2017-03-21 14:54:57 +08:00
|
|
|
|
|
|
|
|
|
protected override void UpdateState(ArmedState state)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-03-21 14:09:54 +08:00
|
|
|
|
}
|
|
|
|
|
}
|