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-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);
|
|
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
{
|
|
|
|
|
TaikoScoreResult score = RNG.Next(2) == 0 ? TaikoScoreResult.Good : TaikoScoreResult.Great;
|
|
|
|
|
|
|
|
|
|
playfield.OnJudgement(new DrawableTestHit(new TaikoHitObject())
|
|
|
|
|
{
|
2017-03-21 15:33:25 +08:00
|
|
|
|
X = RNG.NextSingle(score == TaikoScoreResult.Good ? -0.1f : -0.05f, score == TaikoScoreResult.Good ? 0.1f : 0.05f),
|
2017-03-21 14:54:57 +08:00
|
|
|
|
Judgement = new TaikoJudgementInfo
|
|
|
|
|
{
|
|
|
|
|
Result = HitResult.Hit,
|
|
|
|
|
Score = score,
|
|
|
|
|
TimeOffset = 0,
|
|
|
|
|
ComboAtHit = 1
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void addMissJudgement()
|
|
|
|
|
{
|
|
|
|
|
playfield.OnJudgement(new DrawableTestHit(new TaikoHitObject())
|
|
|
|
|
{
|
|
|
|
|
Judgement = new TaikoJudgementInfo
|
|
|
|
|
{
|
|
|
|
|
Result = HitResult.Miss,
|
|
|
|
|
TimeOffset = 0,
|
|
|
|
|
ComboAtHit = 0
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private class DrawableTestHit : DrawableHitObject<TaikoHitObject, TaikoJudgementInfo>
|
|
|
|
|
{
|
|
|
|
|
public DrawableTestHit(TaikoHitObject hitObject)
|
|
|
|
|
: base(hitObject)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override TaikoJudgementInfo CreateJudgementInfo() => new TaikoJudgementInfo();
|
|
|
|
|
|
|
|
|
|
protected override void UpdateState(ArmedState state)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
|
{
|
|
|
|
|
// Doesn't move
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-03-21 14:09:54 +08:00
|
|
|
|
}
|
|
|
|
|
}
|