2023-06-23 00:37:25 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2020-04-11 12:14:34 +08:00
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
|
|
using NUnit.Framework;
|
2022-11-23 00:22:34 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2020-04-11 12:14:34 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
|
|
|
|
using osu.Game.Rulesets.Taiko.Objects;
|
|
|
|
|
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
2022-11-23 00:22:34 +08:00
|
|
|
|
using osu.Game.Screens.Play;
|
|
|
|
|
using osu.Game.Tests.Gameplay;
|
2020-04-11 12:14:34 +08:00
|
|
|
|
|
2020-04-15 15:01:49 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
2020-04-11 12:14:34 +08:00
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public partial class TestSceneDrawableHit : TaikoSkinnableTestScene
|
|
|
|
|
{
|
2022-11-23 00:22:34 +08:00
|
|
|
|
[Cached]
|
|
|
|
|
private GameplayState gameplayState = TestGameplayState.Create(new TaikoRuleset());
|
|
|
|
|
|
2022-10-19 05:47:26 +08:00
|
|
|
|
[Test]
|
2022-11-23 03:28:41 +08:00
|
|
|
|
public void TestHits([Values] bool withKiai)
|
|
|
|
|
{
|
|
|
|
|
AddStep("Create beatmap", () => setUpBeatmap(withKiai));
|
|
|
|
|
addHitSteps();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestHitAnimationSlow()
|
|
|
|
|
{
|
|
|
|
|
AddStep("Create beatmap", () => setUpBeatmap(false));
|
|
|
|
|
|
2022-11-23 03:30:27 +08:00
|
|
|
|
AddStep("Set 50 combo", () => gameplayState.ScoreProcessor.Combo.Value = 50);
|
2022-11-23 03:28:41 +08:00
|
|
|
|
addHitSteps();
|
2022-11-23 03:43:22 +08:00
|
|
|
|
AddStep("Reset combo", () => gameplayState.ScoreProcessor.Combo.Value = 0);
|
2022-11-23 03:28:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestHitAnimationFast()
|
|
|
|
|
{
|
|
|
|
|
AddStep("Create beatmap", () => setUpBeatmap(false));
|
|
|
|
|
|
2022-11-23 03:30:27 +08:00
|
|
|
|
AddStep("Set 150 combo", () => gameplayState.ScoreProcessor.Combo.Value = 150);
|
2022-11-23 03:28:41 +08:00
|
|
|
|
addHitSteps();
|
2022-11-23 03:43:22 +08:00
|
|
|
|
AddStep("Reset combo", () => gameplayState.ScoreProcessor.Combo.Value = 0);
|
2022-11-23 03:28:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void addHitSteps()
|
2020-04-11 12:14:34 +08:00
|
|
|
|
{
|
2021-06-02 15:04:53 +08:00
|
|
|
|
AddStep("Centre hit", () => SetContents(_ => new DrawableHit(createHitAtCurrentTime())
|
2020-04-11 12:14:34 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
}));
|
2020-04-11 13:43:57 +08:00
|
|
|
|
|
2021-06-02 15:04:53 +08:00
|
|
|
|
AddStep("Centre hit (strong)", () => SetContents(_ => new DrawableHit(createHitAtCurrentTime(true))
|
2020-04-11 13:43:57 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
}));
|
|
|
|
|
|
2022-11-02 14:45:23 +08:00
|
|
|
|
AddStep("Rim hit", () => SetContents(_ => new DrawableHit(createHitAtCurrentTime(rim: true))
|
2020-04-11 12:14:34 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
}));
|
2020-04-11 13:43:57 +08:00
|
|
|
|
|
2022-11-02 14:45:23 +08:00
|
|
|
|
AddStep("Rim hit (strong)", () => SetContents(_ => new DrawableHit(createHitAtCurrentTime(true, true))
|
2020-04-11 13:43:57 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
}));
|
2020-04-11 12:14:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-02 14:45:23 +08:00
|
|
|
|
private Hit createHitAtCurrentTime(bool strong = false, bool rim = false)
|
2020-04-11 12:14:34 +08:00
|
|
|
|
{
|
|
|
|
|
var hit = new Hit
|
|
|
|
|
{
|
2022-11-02 14:45:23 +08:00
|
|
|
|
Type = rim ? HitType.Rim : HitType.Centre,
|
2020-04-11 13:43:57 +08:00
|
|
|
|
IsStrong = strong,
|
2020-04-11 12:14:34 +08:00
|
|
|
|
StartTime = Time.Current + 3000,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
hit.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
|
|
|
|
|
|
|
|
|
return hit;
|
|
|
|
|
}
|
2022-11-23 00:22:34 +08:00
|
|
|
|
|
2022-11-23 03:28:41 +08:00
|
|
|
|
private void setUpBeatmap(bool withKiai)
|
2022-11-23 00:22:34 +08:00
|
|
|
|
{
|
|
|
|
|
var controlPointInfo = new ControlPointInfo();
|
|
|
|
|
|
|
|
|
|
controlPointInfo.Add(0, new TimingControlPoint { BeatLength = 500 });
|
|
|
|
|
|
2022-11-23 03:28:41 +08:00
|
|
|
|
if (withKiai)
|
2022-11-23 00:22:34 +08:00
|
|
|
|
controlPointInfo.Add(0, new EffectControlPoint { KiaiMode = true });
|
|
|
|
|
|
|
|
|
|
Beatmap.Value = CreateWorkingBeatmap(new Beatmap
|
|
|
|
|
{
|
|
|
|
|
ControlPointInfo = controlPointInfo
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Beatmap.Value.Track.Start();
|
|
|
|
|
}
|
2020-04-11 12:14:34 +08:00
|
|
|
|
}
|
|
|
|
|
}
|