Update TestSceneFruitObjects to use SkinnableTestScene

This commit is contained in:
Dean Herbert 2020-02-17 16:46:58 +09:00
parent 0325f30e01
commit ea6772ce04
1 changed files with 27 additions and 38 deletions

View File

@ -5,7 +5,6 @@
using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Objects.Drawable;
using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces;
@ -15,68 +14,58 @@
namespace osu.Game.Rulesets.Catch.Tests
{
[TestFixture]
public class TestSceneFruitObjects : OsuTestScene
public class TestSceneFruitObjects : SkinnableTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(CatchHitObject),
typeof(Fruit),
typeof(Droplet),
typeof(Banana),
typeof(BananaShower),
typeof(DrawableCatchHitObject),
typeof(DrawableFruit),
typeof(DrawableDroplet),
typeof(BananaShower),
typeof(DrawableBanana),
typeof(DrawableBananaShower),
typeof(Pulp),
};
public TestSceneFruitObjects()
protected override void LoadComplete()
{
Add(new GridContainer
{
RelativeSizeAxes = Axes.Both,
Content = new[]
{
new Drawable[]
{
createDrawable(0),
createDrawable(1),
createDrawable(2),
},
new Drawable[]
{
createDrawable(3),
createDrawable(4),
createDrawable(5),
},
}
});
base.LoadComplete();
foreach (FruitVisualRepresentation rep in Enum.GetValues(typeof(FruitVisualRepresentation)))
AddStep($"show {rep}", () => SetContents(() => createDrawable(rep)));
}
private DrawableFruit createDrawable(int index)
private DrawableFruit createDrawable(FruitVisualRepresentation rep)
{
Fruit fruit = index == 5
? new Banana
{
StartTime = 1000000000000,
ComboIndex = index,
Scale = 1.5f,
}
: new Fruit
{
StartTime = 1000000000000,
ComboIndex = index,
Scale = 1.5f,
};
Fruit fruit = new TestCatchFruit(rep)
{
StartTime = 1000000000000,
Scale = 1.5f,
};
return new DrawableFruit(fruit)
{
Anchor = Anchor.Centre,
RelativePositionAxes = Axes.Both,
RelativePositionAxes = Axes.None,
Position = Vector2.Zero,
Alpha = 1,
LifetimeStart = double.NegativeInfinity,
LifetimeEnd = double.PositiveInfinity,
};
}
private class TestCatchFruit : Fruit
{
public TestCatchFruit(FruitVisualRepresentation rep)
{
VisualRepresentation = rep;
}
public override FruitVisualRepresentation VisualRepresentation { get; }
}
}
}