2019-01-24 16:43:03 +08: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 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2020-02-17 15:37:24 +08:00
|
|
|
|
using System.Linq;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using osu.Framework.Allocation;
|
2020-02-17 15:37:24 +08:00
|
|
|
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Rulesets.Catch.UI;
|
|
|
|
|
using osu.Game.Tests.Visual;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Catch.Tests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2020-02-17 15:37:24 +08:00
|
|
|
|
public class TestSceneCatcherArea : SkinnableTestScene
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
private RulesetInfo catchRuleset;
|
|
|
|
|
|
|
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
|
|
|
{
|
|
|
|
|
typeof(CatcherArea),
|
|
|
|
|
};
|
|
|
|
|
|
2019-05-15 03:37:25 +08:00
|
|
|
|
public TestSceneCatcherArea()
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
AddSliderStep<float>("CircleSize", 0, 8, 5, createCatcher);
|
2020-02-17 15:37:24 +08:00
|
|
|
|
AddToggleStep("Hyperdash", t =>
|
|
|
|
|
CreatedDrawables.OfType<CatchInputManager>().Select(i => i.Child)
|
|
|
|
|
.OfType<TestCatcherArea>().ForEach(c => c.ToggleHyperDash(t)));
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void createCatcher(float size)
|
|
|
|
|
{
|
2020-02-17 15:37:24 +08:00
|
|
|
|
SetContents(() => new CatchInputManager(catchRuleset)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2020-02-17 15:37:24 +08:00
|
|
|
|
Child = new TestCatcherArea(new BeatmapDifficulty { CircleSize = size })
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
2018-06-03 14:42:27 +08:00
|
|
|
|
Origin = Anchor.TopLeft
|
2018-04-13 17:19:50 +08:00
|
|
|
|
},
|
2020-02-17 15:37:24 +08:00
|
|
|
|
});
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(RulesetStore rulesets)
|
|
|
|
|
{
|
|
|
|
|
catchRuleset = rulesets.GetRuleset(2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private class TestCatcherArea : CatcherArea
|
|
|
|
|
{
|
|
|
|
|
public TestCatcherArea(BeatmapDifficulty beatmapDifficulty)
|
|
|
|
|
: base(beatmapDifficulty)
|
|
|
|
|
{
|
|
|
|
|
}
|
2018-06-03 14:31:51 +08:00
|
|
|
|
|
2018-07-05 10:32:09 +08:00
|
|
|
|
public void ToggleHyperDash(bool status) => MovableCatcher.SetHyperDashState(status ? 2 : 1);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|