mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:17:26 +08:00
extend TestCaseSlider with new steps
- Hidden, Size and Scale - made Repeats an SliderStep instead
This commit is contained in:
parent
cd237da6d3
commit
8d5f4d4f19
@ -33,15 +33,15 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
{
|
{
|
||||||
base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 }));
|
base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 }));
|
||||||
|
|
||||||
AddStep("Single", () => addSingle());
|
AddStep("Single", () => testSingle());
|
||||||
AddStep("Stream", addStream);
|
AddStep("Stream", testStream);
|
||||||
AddToggleStep("Auto", v => auto = v);
|
AddToggleStep("Auto", v => auto = v);
|
||||||
AddToggleStep("Hidden", v => hidden = v);
|
AddToggleStep("Hidden", v => hidden = v);
|
||||||
AddSliderStep("CircleSize", 0, 10, 0, s => circleSize = s);
|
AddSliderStep("CircleSize", 0, 10, 0, s => circleSize = s);
|
||||||
AddSliderStep("CircleScale", 0.5f, 2, 1, s => circleScale = s);
|
AddSliderStep("CircleScale", 0.5f, 2, 1, s => circleScale = s);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSingle(double timeOffset = 0, Vector2? positionOffset = null)
|
private void testSingle(double timeOffset = 0, Vector2? positionOffset = null)
|
||||||
{
|
{
|
||||||
positionOffset = positionOffset ?? Vector2.Zero;
|
positionOffset = positionOffset ?? Vector2.Zero;
|
||||||
|
|
||||||
@ -70,13 +70,13 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
Add(drawable);
|
Add(drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addStream()
|
private void testStream()
|
||||||
{
|
{
|
||||||
Vector2 pos = Vector2.Zero;
|
Vector2 pos = Vector2.Zero;
|
||||||
|
|
||||||
for (int i = 0; i <= 1000; i += 100)
|
for (int i = 0; i <= 1000; i += 100)
|
||||||
{
|
{
|
||||||
addSingle(i, pos);
|
testSingle(i, pos);
|
||||||
pos += new Vector2(10);
|
pos += new Vector2(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,8 @@ using osu.Game.Rulesets.Osu.Objects;
|
|||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Tests
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
{
|
{
|
||||||
@ -24,26 +26,30 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
|
private bool hidden;
|
||||||
|
private int repeats;
|
||||||
|
private int depthIndex;
|
||||||
|
private int circleSize;
|
||||||
|
private float circleScale;
|
||||||
private double speedMultiplier = 2;
|
private double speedMultiplier = 2;
|
||||||
private double sliderMultiplier = 2;
|
private double sliderMultiplier = 2;
|
||||||
private int depthIndex;
|
|
||||||
|
|
||||||
public TestCaseSlider()
|
public TestCaseSlider()
|
||||||
{
|
{
|
||||||
base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 }));
|
base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 }));
|
||||||
|
|
||||||
AddStep("Single", () => addSingle());
|
AddStep("Single", () => testSingle());
|
||||||
AddStep("Repeated (1)", () => addRepeated(1));
|
AddStep("Stream", testStream);
|
||||||
AddStep("Repeated (2)", () => addRepeated(2));
|
AddStep("Repeated", () => testRepeated(repeats));
|
||||||
AddStep("Repeated (3)", () => addRepeated(3));
|
AddToggleStep("Hidden", v => hidden = v);
|
||||||
AddStep("Repeated (4)", () => addRepeated(4));
|
AddSliderStep("Repeats", 1, 10, 1, s => repeats = s);
|
||||||
AddStep("Stream", addStream);
|
AddSliderStep("CircleSize", 0, 10, 0, s => circleSize = s);
|
||||||
|
AddSliderStep("CircleScale", 0.5f, 2, 1, s => circleScale = s);
|
||||||
AddSliderStep("SpeedMultiplier", 0.01, 10, 2, s => speedMultiplier = s);
|
AddSliderStep("SpeedMultiplier", 0.1, 10, 2, s => speedMultiplier = s);
|
||||||
AddSliderStep("SliderMultiplier", 0.01, 10, 2, s => sliderMultiplier = s);
|
AddSliderStep("SliderMultiplier", 0.1, 10, 2, s => sliderMultiplier = s);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSingle(double timeOffset = 0, Vector2? positionOffset = null)
|
private void testSingle(double timeOffset = 0, Vector2? positionOffset = null)
|
||||||
{
|
{
|
||||||
positionOffset = positionOffset ?? Vector2.Zero;
|
positionOffset = positionOffset ?? Vector2.Zero;
|
||||||
|
|
||||||
@ -59,24 +65,10 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
Distance = 400,
|
Distance = 400,
|
||||||
};
|
};
|
||||||
|
|
||||||
var cpi = new ControlPointInfo();
|
addSlider(slider);
|
||||||
cpi.DifficultyPoints.Add(new DifficultyControlPoint { SpeedMultiplier = speedMultiplier });
|
|
||||||
|
|
||||||
var difficulty = new BeatmapDifficulty
|
|
||||||
{
|
|
||||||
SliderMultiplier = (float)sliderMultiplier,
|
|
||||||
CircleSize = 0
|
|
||||||
};
|
|
||||||
|
|
||||||
slider.ApplyDefaults(cpi, difficulty);
|
|
||||||
Add(new DrawableSlider(slider)
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Depth = depthIndex++
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addRepeated(int repeats)
|
private void testRepeated(int repeats)
|
||||||
{
|
{
|
||||||
// The first run through the slider is considered a repeat
|
// The first run through the slider is considered a repeat
|
||||||
repeats++;
|
repeats++;
|
||||||
@ -99,32 +91,50 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
RepeatSamples = repeatSamples
|
RepeatSamples = repeatSamples
|
||||||
};
|
};
|
||||||
|
|
||||||
|
addSlider(slider);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testStream()
|
||||||
|
{
|
||||||
|
Vector2 pos = Vector2.Zero;
|
||||||
|
|
||||||
|
for (int i = 0; i <= 1000; i += 100)
|
||||||
|
{
|
||||||
|
testSingle(i, pos);
|
||||||
|
pos += new Vector2(10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addSlider(Slider slider)
|
||||||
|
{
|
||||||
var cpi = new ControlPointInfo();
|
var cpi = new ControlPointInfo();
|
||||||
cpi.DifficultyPoints.Add(new DifficultyControlPoint { SpeedMultiplier = speedMultiplier });
|
cpi.DifficultyPoints.Add(new DifficultyControlPoint { SpeedMultiplier = speedMultiplier });
|
||||||
|
|
||||||
var difficulty = new BeatmapDifficulty
|
var difficulty = new BeatmapDifficulty
|
||||||
{
|
{
|
||||||
SliderMultiplier = (float)sliderMultiplier,
|
SliderMultiplier = (float)sliderMultiplier,
|
||||||
CircleSize = 0
|
CircleSize = circleSize
|
||||||
};
|
};
|
||||||
|
|
||||||
slider.ApplyDefaults(cpi, difficulty);
|
slider.ApplyDefaults(cpi, difficulty);
|
||||||
Add(new DrawableSlider(slider)
|
|
||||||
|
var drawable = new DrawableSlider(slider)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
|
Scale = new Vector2(circleScale),
|
||||||
Depth = depthIndex++
|
Depth = depthIndex++
|
||||||
});
|
};
|
||||||
|
|
||||||
|
if (hidden)
|
||||||
|
drawable.ApplyCustomUpdateState += new TestOsuModHidden().CustomSequence;
|
||||||
|
|
||||||
|
Add(drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addStream()
|
private class TestOsuModHidden : OsuModHidden
|
||||||
{
|
{
|
||||||
Vector2 pos = Vector2.Zero;
|
public new void CustomSequence(DrawableHitObject drawable, ArmedState state) => base.CustomSequence(drawable, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i <= 1000; i += 100)
|
|
||||||
{
|
|
||||||
addSingle(i, pos);
|
|
||||||
pos += new Vector2(10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user