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
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Game.Rulesets.Catch.Objects;
|
2020-02-19 17:01:59 +08:00
|
|
|
|
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
2020-11-17 17:13:32 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Catch.Tests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2020-04-07 14:38:29 +08:00
|
|
|
|
public class TestSceneFruitObjects : CatchSkinnableTestScene
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2020-02-17 15:46:58 +08:00
|
|
|
|
protected override void LoadComplete()
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2020-02-17 15:46:58 +08:00
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
|
|
foreach (FruitVisualRepresentation rep in Enum.GetValues(typeof(FruitVisualRepresentation)))
|
|
|
|
|
AddStep($"show {rep}", () => SetContents(() => createDrawable(rep)));
|
2020-02-21 09:44:48 +08:00
|
|
|
|
|
2020-08-20 22:16:37 +08:00
|
|
|
|
AddStep("show droplet", () => SetContents(() => createDrawableDroplet()));
|
2020-02-21 09:44:48 +08:00
|
|
|
|
AddStep("show tiny droplet", () => SetContents(createDrawableTinyDroplet));
|
2020-02-26 18:22:09 +08:00
|
|
|
|
|
|
|
|
|
foreach (FruitVisualRepresentation rep in Enum.GetValues(typeof(FruitVisualRepresentation)))
|
|
|
|
|
AddStep($"show hyperdash {rep}", () => SetContents(() => createDrawable(rep, true)));
|
2020-08-20 22:16:37 +08:00
|
|
|
|
|
|
|
|
|
AddStep("show hyperdash droplet", () => SetContents(() => createDrawableDroplet(true)));
|
2020-02-21 09:44:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Drawable createDrawableTinyDroplet()
|
|
|
|
|
{
|
2020-08-20 22:15:30 +08:00
|
|
|
|
var droplet = new TestCatchTinyDroplet
|
2020-02-21 09:44:48 +08:00
|
|
|
|
{
|
|
|
|
|
Scale = 1.5f,
|
|
|
|
|
};
|
|
|
|
|
|
2020-11-17 17:13:32 +08:00
|
|
|
|
return new TestDrawableTinyDroplet(droplet)
|
2020-02-21 09:44:48 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
RelativePositionAxes = Axes.None,
|
|
|
|
|
Position = Vector2.Zero,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-17 17:13:32 +08:00
|
|
|
|
private class TestDrawableTinyDroplet : DrawableTinyDroplet
|
|
|
|
|
{
|
|
|
|
|
public TestDrawableTinyDroplet(TinyDroplet tinyDroplet)
|
|
|
|
|
: base(tinyDroplet)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnApply(HitObject hitObject)
|
|
|
|
|
{
|
|
|
|
|
base.OnApply(hitObject);
|
|
|
|
|
LifetimeStart = double.NegativeInfinity;
|
|
|
|
|
LifetimeEnd = double.PositiveInfinity;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-20 22:16:37 +08:00
|
|
|
|
private Drawable createDrawableDroplet(bool hyperdash = false)
|
2020-02-21 09:44:48 +08:00
|
|
|
|
{
|
2020-08-20 22:15:30 +08:00
|
|
|
|
var droplet = new TestCatchDroplet
|
2020-02-21 09:44:48 +08:00
|
|
|
|
{
|
|
|
|
|
Scale = 1.5f,
|
2020-08-20 22:16:37 +08:00
|
|
|
|
HyperDashTarget = hyperdash ? new Banana() : null
|
2020-02-21 09:44:48 +08:00
|
|
|
|
};
|
|
|
|
|
|
2020-11-17 17:13:32 +08:00
|
|
|
|
return new TestDrawableDroplet(droplet)
|
2020-02-21 09:44:48 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
RelativePositionAxes = Axes.None,
|
|
|
|
|
Position = Vector2.Zero,
|
|
|
|
|
};
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-11-17 17:13:32 +08:00
|
|
|
|
private class TestDrawableDroplet : DrawableDroplet
|
|
|
|
|
{
|
|
|
|
|
public TestDrawableDroplet(Droplet droplet)
|
|
|
|
|
: base(droplet)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnApply(HitObject hitObject)
|
|
|
|
|
{
|
|
|
|
|
base.OnApply(hitObject);
|
|
|
|
|
LifetimeStart = double.NegativeInfinity;
|
|
|
|
|
LifetimeEnd = double.PositiveInfinity;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-26 18:22:09 +08:00
|
|
|
|
private Drawable createDrawable(FruitVisualRepresentation rep, bool hyperdash = false)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2020-02-26 18:22:09 +08:00
|
|
|
|
Fruit fruit = new TestCatchFruit(rep)
|
|
|
|
|
{
|
|
|
|
|
Scale = 1.5f,
|
|
|
|
|
HyperDashTarget = hyperdash ? new Banana() : null
|
|
|
|
|
};
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2020-11-17 17:13:32 +08:00
|
|
|
|
return new TestDrawableFruit(fruit)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
2020-02-17 15:46:58 +08:00
|
|
|
|
RelativePositionAxes = Axes.None,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Position = Vector2.Zero,
|
|
|
|
|
};
|
|
|
|
|
}
|
2020-02-17 15:46:58 +08:00
|
|
|
|
|
2020-11-17 17:13:32 +08:00
|
|
|
|
private class TestDrawableFruit : DrawableFruit
|
|
|
|
|
{
|
|
|
|
|
public TestDrawableFruit(Fruit fruit)
|
|
|
|
|
: base(fruit)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnApply(HitObject hitObject)
|
|
|
|
|
{
|
|
|
|
|
base.OnApply(hitObject);
|
|
|
|
|
LifetimeStart = double.NegativeInfinity;
|
|
|
|
|
LifetimeEnd = double.PositiveInfinity;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-21 17:09:50 +08:00
|
|
|
|
public class TestCatchFruit : Fruit
|
2020-02-17 15:46:58 +08:00
|
|
|
|
{
|
|
|
|
|
public TestCatchFruit(FruitVisualRepresentation rep)
|
|
|
|
|
{
|
|
|
|
|
VisualRepresentation = rep;
|
2020-02-21 17:09:50 +08:00
|
|
|
|
StartTime = 1000000000000;
|
2020-02-17 15:46:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override FruitVisualRepresentation VisualRepresentation { get; }
|
|
|
|
|
}
|
2020-08-20 22:15:30 +08:00
|
|
|
|
|
|
|
|
|
public class TestCatchDroplet : Droplet
|
|
|
|
|
{
|
|
|
|
|
public TestCatchDroplet()
|
|
|
|
|
{
|
|
|
|
|
StartTime = 1000000000000;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class TestCatchTinyDroplet : TinyDroplet
|
|
|
|
|
{
|
|
|
|
|
public TestCatchTinyDroplet()
|
|
|
|
|
{
|
|
|
|
|
StartTime = 1000000000000;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|