mirror of
https://github.com/osukey/osukey.git
synced 2025-06-25 13:18:03 +09:00
Merge pull request #20426 from NullifiedJosh/catch-hide-in-relax
Hide osu!catch touch input controls when relax mod is enabled
This commit is contained in:
commit
9cf8f2fef3
@ -1,10 +1,15 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Rulesets.Catch.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Catch.Mods;
|
||||||
using osu.Game.Rulesets.Catch.UI;
|
using osu.Game.Rulesets.Catch.UI;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Tests
|
namespace osu.Game.Rulesets.Catch.Tests
|
||||||
@ -12,11 +17,11 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneCatchTouchInput : OsuTestScene
|
public class TestSceneCatchTouchInput : OsuTestScene
|
||||||
{
|
{
|
||||||
private CatchTouchInputMapper catchTouchInputMapper = null!;
|
[Test]
|
||||||
|
public void TestBasic()
|
||||||
[SetUpSteps]
|
|
||||||
public void SetUpSteps()
|
|
||||||
{
|
{
|
||||||
|
CatchTouchInputMapper catchTouchInputMapper = null!;
|
||||||
|
|
||||||
AddStep("create input overlay", () =>
|
AddStep("create input overlay", () =>
|
||||||
{
|
{
|
||||||
Child = new CatchInputManager(new CatchRuleset().RulesetInfo)
|
Child = new CatchInputManager(new CatchRuleset().RulesetInfo)
|
||||||
@ -32,12 +37,30 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AddStep("show overlay", () => catchTouchInputMapper.Show());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestBasic()
|
public void TestWithoutRelax()
|
||||||
{
|
{
|
||||||
AddStep("show overlay", () => catchTouchInputMapper.Show());
|
AddStep("create drawable ruleset without relax mod", () =>
|
||||||
|
{
|
||||||
|
Child = new DrawableCatchRuleset(new CatchRuleset(), new CatchBeatmap(), new List<Mod>());
|
||||||
|
});
|
||||||
|
AddUntilStep("wait for load", () => Child.IsLoaded);
|
||||||
|
AddAssert("check touch input is shown", () => this.ChildrenOfType<CatchTouchInputMapper>().Any());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestWithRelax()
|
||||||
|
{
|
||||||
|
AddStep("create drawable ruleset with relax mod", () =>
|
||||||
|
{
|
||||||
|
Child = new DrawableCatchRuleset(new CatchRuleset(), new CatchBeatmap(), new List<Mod> { new CatchModRelax() });
|
||||||
|
});
|
||||||
|
AddUntilStep("wait for load", () => Child.IsLoaded);
|
||||||
|
AddAssert("check touch input is not shown", () => !this.ChildrenOfType<CatchTouchInputMapper>().Any());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
@ -36,6 +37,8 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
|
// With relax mod, input maps directly to x position and left/right buttons are not used.
|
||||||
|
if (!Mods.Any(m => m is ModRelax))
|
||||||
KeyBindingInputManager.Add(new CatchTouchInputMapper());
|
KeyBindingInputManager.Add(new CatchTouchInputMapper());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user