2019-01-24 08:43:03 +00: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 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Game.Rulesets.Catch.Objects;
|
2020-02-19 09:01:59 +00:00
|
|
|
|
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
|
|
|
|
using osu.Game.Rulesets.Catch.Objects.Drawables.Pieces;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Game.Tests.Visual;
|
2018-11-20 07:51:59 +00:00
|
|
|
|
using osuTK;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Catch.Tests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2020-02-17 07:46:58 +00:00
|
|
|
|
public class TestSceneFruitObjects : SkinnableTestScene
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
|
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
|
|
|
{
|
|
|
|
|
typeof(CatchHitObject),
|
|
|
|
|
typeof(Fruit),
|
2020-02-19 07:33:49 +00:00
|
|
|
|
typeof(FruitPiece),
|
2018-04-13 09:19:50 +00:00
|
|
|
|
typeof(Droplet),
|
2020-02-17 07:46:58 +00:00
|
|
|
|
typeof(Banana),
|
|
|
|
|
typeof(BananaShower),
|
2018-04-13 09:19:50 +00:00
|
|
|
|
typeof(DrawableCatchHitObject),
|
|
|
|
|
typeof(DrawableFruit),
|
|
|
|
|
typeof(DrawableDroplet),
|
2020-02-17 07:46:58 +00:00
|
|
|
|
typeof(DrawableBanana),
|
|
|
|
|
typeof(DrawableBananaShower),
|
2018-04-13 09:19:50 +00:00
|
|
|
|
typeof(Pulp),
|
|
|
|
|
};
|
|
|
|
|
|
2020-02-17 07:46:58 +00:00
|
|
|
|
protected override void LoadComplete()
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
2020-02-17 07:46:58 +00:00
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
|
|
foreach (FruitVisualRepresentation rep in Enum.GetValues(typeof(FruitVisualRepresentation)))
|
|
|
|
|
AddStep($"show {rep}", () => SetContents(() => createDrawable(rep)));
|
2020-02-21 01:44:48 +00:00
|
|
|
|
|
|
|
|
|
AddStep("show droplet", () => SetContents(createDrawableDroplet));
|
|
|
|
|
|
|
|
|
|
AddStep("show tiny droplet", () => SetContents(createDrawableTinyDroplet));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Drawable createDrawableTinyDroplet()
|
|
|
|
|
{
|
|
|
|
|
var droplet = new TinyDroplet
|
|
|
|
|
{
|
|
|
|
|
StartTime = Clock.CurrentTime,
|
|
|
|
|
Scale = 1.5f,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return new DrawableTinyDroplet(droplet)
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
RelativePositionAxes = Axes.None,
|
|
|
|
|
Position = Vector2.Zero,
|
|
|
|
|
Alpha = 1,
|
|
|
|
|
LifetimeStart = double.NegativeInfinity,
|
|
|
|
|
LifetimeEnd = double.PositiveInfinity,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Drawable createDrawableDroplet()
|
|
|
|
|
{
|
|
|
|
|
var droplet = new Droplet
|
|
|
|
|
{
|
|
|
|
|
StartTime = Clock.CurrentTime,
|
|
|
|
|
Scale = 1.5f,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return new DrawableDroplet(droplet)
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
RelativePositionAxes = Axes.None,
|
|
|
|
|
Position = Vector2.Zero,
|
|
|
|
|
Alpha = 1,
|
|
|
|
|
LifetimeStart = double.NegativeInfinity,
|
|
|
|
|
LifetimeEnd = double.PositiveInfinity,
|
|
|
|
|
};
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-02-21 01:44:48 +00:00
|
|
|
|
private Drawable createDrawable(FruitVisualRepresentation rep)
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
2020-02-21 09:09:50 +00:00
|
|
|
|
Fruit fruit = new TestCatchFruit(rep) { Scale = 1.5f };
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
return new DrawableFruit(fruit)
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
2020-02-17 07:46:58 +00:00
|
|
|
|
RelativePositionAxes = Axes.None,
|
2018-04-13 09:19:50 +00:00
|
|
|
|
Position = Vector2.Zero,
|
|
|
|
|
Alpha = 1,
|
|
|
|
|
LifetimeStart = double.NegativeInfinity,
|
|
|
|
|
LifetimeEnd = double.PositiveInfinity,
|
|
|
|
|
};
|
|
|
|
|
}
|
2020-02-17 07:46:58 +00:00
|
|
|
|
|
2020-02-21 09:09:50 +00:00
|
|
|
|
public class TestCatchFruit : Fruit
|
2020-02-17 07:46:58 +00:00
|
|
|
|
{
|
|
|
|
|
public TestCatchFruit(FruitVisualRepresentation rep)
|
|
|
|
|
{
|
|
|
|
|
VisualRepresentation = rep;
|
2020-02-21 09:09:50 +00:00
|
|
|
|
StartTime = 1000000000000;
|
2020-02-17 07:46:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override FruitVisualRepresentation VisualRepresentation { get; }
|
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|