1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-19 02:13:08 +08:00
osu-lazer/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs

105 lines
3.4 KiB
C#
Raw Normal View History

2018-01-09 21:24:12 +08:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
2018-01-04 14:21:33 +08:00
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2018-01-03 15:32:09 +08:00
using System;
using System.Collections.Generic;
2018-01-04 14:34:57 +08:00
using NUnit.Framework;
2018-01-03 15:32:09 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
2018-01-03 19:52:01 +08:00
using osu.Framework.MathUtils;
2018-01-03 15:32:09 +08:00
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Objects.Drawable;
2018-01-03 17:26:54 +08:00
using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces;
2018-01-03 15:32:09 +08:00
using osu.Game.Tests.Visual;
using OpenTK;
2018-01-03 19:52:01 +08:00
using OpenTK.Graphics;
2018-01-03 15:32:09 +08:00
namespace osu.Game.Rulesets.Catch.Tests
{
2018-01-04 14:34:57 +08:00
[Ignore("getting CI working")]
2018-01-03 15:32:09 +08:00
public class TestCaseFruitObjects : OsuTestCase
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(CatchHitObject),
typeof(Fruit),
2018-01-03 17:26:54 +08:00
typeof(Droplet),
2018-01-03 15:32:09 +08:00
typeof(DrawableCatchHitObject),
typeof(DrawableFruit),
2018-01-03 17:26:54 +08:00
typeof(DrawableDroplet),
typeof(Pulp),
2018-01-03 15:32:09 +08:00
};
public TestCaseFruitObjects()
{
Add(new GridContainer
{
RelativeSizeAxes = Axes.Both,
Content = new[]
{
new Drawable[]
{
createDrawable(0),
createDrawable(1),
2018-01-03 17:26:54 +08:00
createDrawable(2),
2018-01-03 15:32:09 +08:00
},
new Drawable[]
{
createDrawable(3),
2018-01-03 17:26:54 +08:00
createDrawable(4),
createDrawable(5),
2018-01-03 15:32:09 +08:00
},
}
});
}
2018-01-03 19:52:01 +08:00
private DrawableFruit createDrawable(int index)
2018-01-03 15:32:09 +08:00
{
2018-01-03 19:52:01 +08:00
var fruit = new Fruit
{
StartTime = 1000000000000,
IndexInBeatmap = index,
Scale = 1.5f,
};
fruit.ComboColour = colourForRrepesentation(fruit.VisualRepresentation);
return new DrawableFruit(fruit)
{
Anchor = Anchor.Centre,
RelativePositionAxes = Axes.Both,
Position = Vector2.Zero,
Alpha = 1,
LifetimeStart = double.NegativeInfinity,
LifetimeEnd = double.PositiveInfinity,
};
}
private Color4 colourForRrepesentation(FruitVisualRepresentation representation)
2018-01-03 15:32:09 +08:00
{
2018-01-03 19:52:01 +08:00
switch (representation)
{
default:
2018-01-04 17:20:23 +08:00
case FruitVisualRepresentation.Pear:
2018-01-03 19:52:01 +08:00
return new Color4(17, 136, 170, 255);
case FruitVisualRepresentation.Grape:
return new Color4(204, 102, 0, 255);
2018-01-04 17:20:23 +08:00
case FruitVisualRepresentation.Raspberry:
2018-01-03 19:52:01 +08:00
return new Color4(121, 9, 13, 255);
case FruitVisualRepresentation.Pineapple:
return new Color4(102, 136, 0, 255);
case FruitVisualRepresentation.Banana:
switch (RNG.Next(0, 3))
{
default:
return new Color4(255, 240, 0, 255);
case 1:
return new Color4(255, 192, 0, 255);
case 2:
return new Color4(214, 221, 28, 255);
}
}
}
2018-01-03 15:32:09 +08:00
}
}