mirror of
https://github.com/ppy/osu.git
synced 2024-12-17 11:12:55 +08:00
62 lines
1.8 KiB
C#
62 lines
1.8 KiB
C#
// 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.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using NUnit.Framework;
|
|
using osu.Framework.Allocation;
|
|
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]
|
|
public class TestCaseCatcherArea : OsuTestCase
|
|
{
|
|
private RulesetInfo catchRuleset;
|
|
private TestCatcherArea catcherArea;
|
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
{
|
|
typeof(CatcherArea),
|
|
};
|
|
|
|
public TestCaseCatcherArea()
|
|
{
|
|
AddSliderStep<float>("CircleSize", 0, 8, 5, createCatcher);
|
|
AddToggleStep("Hyperdash", t => catcherArea.ToggleHyperDash(t));
|
|
}
|
|
|
|
private void createCatcher(float size)
|
|
{
|
|
Child = new CatchInputManager(catchRuleset)
|
|
{
|
|
RelativeSizeAxes = Axes.Both,
|
|
Child = catcherArea = new TestCatcherArea(new BeatmapDifficulty { CircleSize = size })
|
|
{
|
|
Anchor = Anchor.CentreLeft,
|
|
Origin = Anchor.TopLeft
|
|
},
|
|
};
|
|
}
|
|
|
|
[BackgroundDependencyLoader]
|
|
private void load(RulesetStore rulesets)
|
|
{
|
|
catchRuleset = rulesets.GetRuleset(2);
|
|
}
|
|
|
|
private class TestCatcherArea : CatcherArea
|
|
{
|
|
public TestCatcherArea(BeatmapDifficulty beatmapDifficulty)
|
|
: base(beatmapDifficulty)
|
|
{
|
|
}
|
|
|
|
public void ToggleHyperDash(bool status) => MovableCatcher.SetHyperDashState(status ? 2 : 1);
|
|
}
|
|
}
|
|
}
|