2019-01-24 16:43:03 +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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2018-03-02 14:34:31 +08:00
|
|
|
|
using NUnit.Framework;
|
2018-01-03 15:32:09 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2020-12-02 15:55:37 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Timing;
|
2020-11-30 11:58:14 +08:00
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
2018-01-03 15:32:09 +08:00
|
|
|
|
using osu.Game.Rulesets.Catch.Objects;
|
2020-02-19 17:01:59 +08:00
|
|
|
|
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-01-03 15:32:09 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Catch.Tests
|
|
|
|
|
{
|
2018-03-02 14:34:31 +08:00
|
|
|
|
[TestFixture]
|
2020-04-07 14:38:29 +08:00
|
|
|
|
public partial class TestSceneFruitObjects : CatchSkinnableTestScene
|
2018-01-03 15:32:09 +08:00
|
|
|
|
{
|
2020-02-17 15:46:58 +08:00
|
|
|
|
protected override void LoadComplete()
|
2018-01-03 15:32:09 +08:00
|
|
|
|
{
|
2020-02-17 15:46:58 +08:00
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
2021-06-02 15:04:53 +08:00
|
|
|
|
AddStep("show pear", () => SetContents(_ => createDrawableFruit(0)));
|
|
|
|
|
AddStep("show grape", () => SetContents(_ => createDrawableFruit(1)));
|
|
|
|
|
AddStep("show pineapple / apple", () => SetContents(_ => createDrawableFruit(2)));
|
|
|
|
|
AddStep("show raspberry / orange", () => SetContents(_ => createDrawableFruit(3)));
|
2020-11-27 11:02:07 +08:00
|
|
|
|
|
2021-06-02 15:04:53 +08:00
|
|
|
|
AddStep("show banana", () => SetContents(_ => createDrawableBanana()));
|
2020-02-21 09:44:48 +08:00
|
|
|
|
|
2021-06-02 15:04:53 +08:00
|
|
|
|
AddStep("show droplet", () => SetContents(_ => createDrawableDroplet()));
|
|
|
|
|
AddStep("show tiny droplet", () => SetContents(_ => createDrawableTinyDroplet()));
|
2020-02-26 18:22:09 +08:00
|
|
|
|
|
2021-06-02 15:04:53 +08:00
|
|
|
|
AddStep("show hyperdash pear", () => SetContents(_ => createDrawableFruit(0, true)));
|
|
|
|
|
AddStep("show hyperdash grape", () => SetContents(_ => createDrawableFruit(1, true)));
|
|
|
|
|
AddStep("show hyperdash pineapple / apple", () => SetContents(_ => createDrawableFruit(2, true)));
|
|
|
|
|
AddStep("show hyperdash raspberry / orange", () => SetContents(_ => createDrawableFruit(3, true)));
|
2020-08-20 22:16:37 +08:00
|
|
|
|
|
2021-06-02 15:04:53 +08:00
|
|
|
|
AddStep("show hyperdash droplet", () => SetContents(_ => createDrawableDroplet(true)));
|
2020-02-21 09:44:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-12-10 13:15:00 +08:00
|
|
|
|
private Drawable createDrawableFruit(int indexInBeatmap, bool hyperDash = false) =>
|
2020-12-02 15:55:37 +08:00
|
|
|
|
new TestDrawableCatchHitObjectSpecimen(new DrawableFruit(new Fruit
|
2020-11-27 11:02:07 +08:00
|
|
|
|
{
|
|
|
|
|
IndexInBeatmap = indexInBeatmap,
|
2021-12-10 13:15:00 +08:00
|
|
|
|
HyperDashBindable = { Value = hyperDash }
|
2020-11-27 11:02:07 +08:00
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
private Drawable createDrawableBanana() =>
|
2020-12-02 15:55:37 +08:00
|
|
|
|
new TestDrawableCatchHitObjectSpecimen(new DrawableBanana(new Banana()));
|
2020-11-17 17:13:32 +08:00
|
|
|
|
|
2021-12-10 13:15:00 +08:00
|
|
|
|
private Drawable createDrawableDroplet(bool hyperDash = false) =>
|
2020-12-02 15:55:37 +08:00
|
|
|
|
new TestDrawableCatchHitObjectSpecimen(new DrawableDroplet(new Droplet
|
2020-11-27 11:02:07 +08:00
|
|
|
|
{
|
2021-12-10 13:15:00 +08:00
|
|
|
|
HyperDashBindable = { Value = hyperDash }
|
2020-11-27 11:02:07 +08:00
|
|
|
|
}));
|
2020-02-21 09:44:48 +08:00
|
|
|
|
|
2020-12-02 15:55:37 +08:00
|
|
|
|
private Drawable createDrawableTinyDroplet() => new TestDrawableCatchHitObjectSpecimen(new DrawableTinyDroplet(new TinyDroplet()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public partial class TestDrawableCatchHitObjectSpecimen : CompositeDrawable
|
|
|
|
|
{
|
|
|
|
|
public readonly ManualClock ManualClock;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2020-12-02 15:55:37 +08:00
|
|
|
|
public TestDrawableCatchHitObjectSpecimen(DrawableCatchHitObject d)
|
2020-11-17 17:13:32 +08:00
|
|
|
|
{
|
2020-12-02 15:55:37 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
Anchor = Anchor.Centre;
|
|
|
|
|
Origin = Anchor.Centre;
|
|
|
|
|
|
|
|
|
|
ManualClock = new ManualClock();
|
|
|
|
|
Clock = new FramedClock(ManualClock);
|
|
|
|
|
|
2020-11-17 22:40:30 +08:00
|
|
|
|
var hitObject = d.HitObject;
|
2020-12-02 15:55:37 +08:00
|
|
|
|
hitObject.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
2020-11-17 22:40:30 +08:00
|
|
|
|
hitObject.Scale = 1.5f;
|
2020-12-02 15:55:37 +08:00
|
|
|
|
hitObject.StartTime = 500;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2020-11-17 22:40:30 +08:00
|
|
|
|
d.Anchor = Anchor.Centre;
|
|
|
|
|
d.HitObjectApplied += _ =>
|
2018-01-03 19:52:01 +08:00
|
|
|
|
{
|
2020-11-17 22:40:30 +08:00
|
|
|
|
d.LifetimeStart = double.NegativeInfinity;
|
|
|
|
|
d.LifetimeEnd = double.PositiveInfinity;
|
2018-01-03 19:52:01 +08:00
|
|
|
|
};
|
2020-12-02 15:55:37 +08:00
|
|
|
|
|
|
|
|
|
InternalChild = d;
|
2020-11-17 17:13:32 +08:00
|
|
|
|
}
|
2018-01-03 15:32:09 +08:00
|
|
|
|
}
|
|
|
|
|
}
|