2020-04-27 21:22:32 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
|
|
|
using osu.Game.Rulesets.Taiko.Objects;
|
|
|
|
using osu.Game.Rulesets.Taiko.UI;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
|
|
|
{
|
|
|
|
[TestFixture]
|
|
|
|
public class TestSceneHitExplosion : TaikoSkinnableTestScene
|
|
|
|
{
|
2020-09-21 00:10:44 +08:00
|
|
|
[Test]
|
|
|
|
public void TestNormalHit()
|
2020-04-27 21:22:32 +08:00
|
|
|
{
|
2020-09-21 00:10:44 +08:00
|
|
|
AddStep("Great", () => SetContents(() => getContentFor(createHit(HitResult.Great))));
|
2020-09-29 16:16:55 +08:00
|
|
|
AddStep("Ok", () => SetContents(() => getContentFor(createHit(HitResult.Ok))));
|
2020-09-21 00:10:44 +08:00
|
|
|
AddStep("Miss", () => SetContents(() => getContentFor(createHit(HitResult.Miss))));
|
2020-04-27 21:22:32 +08:00
|
|
|
}
|
|
|
|
|
2020-09-21 00:10:44 +08:00
|
|
|
[Test]
|
|
|
|
public void TestStrongHit([Values(false, true)] bool hitBoth)
|
2020-04-27 21:22:32 +08:00
|
|
|
{
|
2020-09-21 00:10:44 +08:00
|
|
|
AddStep("Great", () => SetContents(() => getContentFor(createStrongHit(HitResult.Great, hitBoth))));
|
2020-09-29 16:16:55 +08:00
|
|
|
AddStep("Good", () => SetContents(() => getContentFor(createStrongHit(HitResult.Ok, hitBoth))));
|
2020-09-21 00:10:44 +08:00
|
|
|
}
|
2020-04-27 21:22:32 +08:00
|
|
|
|
2020-09-25 18:25:58 +08:00
|
|
|
private Drawable getContentFor(DrawableTestHit hit)
|
2020-09-21 00:10:44 +08:00
|
|
|
{
|
2020-04-27 21:22:32 +08:00
|
|
|
return new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2020-09-26 23:26:26 +08:00
|
|
|
// the hit needs to be added to hierarchy in order for nested objects to be created correctly.
|
|
|
|
// setting zero alpha is supposed to prevent the test from looking broken.
|
|
|
|
hit.With(h => h.Alpha = 0),
|
2020-09-25 18:25:58 +08:00
|
|
|
new HitExplosion(hit, hit.Type)
|
2020-04-27 21:22:32 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-09-25 18:25:58 +08:00
|
|
|
private DrawableTestHit createHit(HitResult type) => new DrawableTestHit(new Hit { StartTime = Time.Current }, type);
|
2020-09-21 00:10:44 +08:00
|
|
|
|
2020-09-25 18:25:58 +08:00
|
|
|
private DrawableTestHit createStrongHit(HitResult type, bool hitBoth) => new DrawableTestStrongHit(Time.Current, type, hitBoth);
|
2020-04-27 21:22:32 +08:00
|
|
|
}
|
|
|
|
}
|