2018-01-05 19:21:19 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-09-18 21:32:49 +08:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
2017-11-28 18:43:26 +08:00
|
|
|
|
using osu.Game.Beatmaps;
|
2017-09-18 21:32:49 +08:00
|
|
|
|
using osu.Game.Rulesets.Catch.UI;
|
|
|
|
|
using osu.Game.Tests.Visual;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Catch.Tests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2017-12-20 20:47:45 +08:00
|
|
|
|
public class TestCaseCatcherArea : OsuTestCase
|
2017-09-18 21:32:49 +08:00
|
|
|
|
{
|
2017-11-28 18:43:26 +08:00
|
|
|
|
private RulesetInfo catchRuleset;
|
2017-12-01 18:58:00 +08:00
|
|
|
|
private TestCatcherArea catcherArea;
|
2017-11-28 18:43:26 +08:00
|
|
|
|
|
2017-09-18 21:32:49 +08:00
|
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
|
|
|
{
|
2017-11-28 17:39:45 +08:00
|
|
|
|
typeof(CatcherArea),
|
2017-09-18 21:32:49 +08:00
|
|
|
|
};
|
|
|
|
|
|
2017-11-28 18:43:26 +08:00
|
|
|
|
public TestCaseCatcherArea()
|
|
|
|
|
{
|
2017-11-28 20:30:03 +08:00
|
|
|
|
AddSliderStep<float>("CircleSize", 0, 8, 5, createCatcher);
|
2017-12-01 18:58:00 +08:00
|
|
|
|
AddToggleStep("Hyperdash", t => catcherArea.ToggleHyperDash(t));
|
2017-11-28 18:43:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-11-28 20:30:03 +08:00
|
|
|
|
private void createCatcher(float size)
|
2017-09-18 21:32:49 +08:00
|
|
|
|
{
|
2017-11-28 18:43:26 +08:00
|
|
|
|
Child = new CatchInputManager(catchRuleset)
|
2017-09-18 21:32:49 +08:00
|
|
|
|
{
|
2017-11-28 18:43:26 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-12-01 18:58:00 +08:00
|
|
|
|
Child = catcherArea = new TestCatcherArea(new BeatmapDifficulty { CircleSize = size })
|
2017-09-18 21:32:49 +08:00
|
|
|
|
{
|
2017-11-28 18:43:26 +08:00
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft
|
2017-09-18 21:32:49 +08:00
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
2017-11-28 18:43:26 +08:00
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(RulesetStore rulesets)
|
|
|
|
|
{
|
|
|
|
|
catchRuleset = rulesets.GetRuleset(2);
|
|
|
|
|
}
|
2017-12-01 18:58:00 +08:00
|
|
|
|
|
|
|
|
|
private class TestCatcherArea : CatcherArea
|
|
|
|
|
{
|
|
|
|
|
public TestCatcherArea(BeatmapDifficulty beatmapDifficulty)
|
|
|
|
|
: base(beatmapDifficulty)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ToggleHyperDash(bool status) => MovableCatcher.HyperDashModifier = status ? 2 : 1;
|
|
|
|
|
}
|
2017-09-18 21:32:49 +08:00
|
|
|
|
}
|
|
|
|
|
}
|