mirror of https://github.com/ppy/osu
Added tests for new Taiko touch control schemes
This commit is contained in:
parent
d2247f704d
commit
32d1d5a34a
|
@ -3,7 +3,7 @@
|
|||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Rulesets.Taiko.Configuration;
|
||||
using osu.Game.Rulesets.Taiko.UI;
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
|
@ -14,35 +14,37 @@ public partial class TestSceneDrumTouchInputArea : OsuTestScene
|
|||
{
|
||||
private DrumTouchInputArea drumTouchInputArea = null!;
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
private void createDrum(TaikoTouchControlScheme _forcedControlScheme)
|
||||
{
|
||||
AddStep("create drum", () =>
|
||||
Child = new TaikoInputManager(new TaikoRuleset().RulesetInfo)
|
||||
{
|
||||
Child = new TaikoInputManager(new TaikoRuleset().RulesetInfo)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new InputDrum
|
||||
{
|
||||
new InputDrum
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Height = 0.2f,
|
||||
},
|
||||
drumTouchInputArea = new DrumTouchInputArea
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
},
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Height = 0.2f,
|
||||
},
|
||||
};
|
||||
});
|
||||
drumTouchInputArea = new DrumTouchInputArea
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
ForceControlScheme = _forcedControlScheme
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDrum()
|
||||
{
|
||||
AddStep("create drum (kddk)", () => createDrum(TaikoTouchControlScheme.KDDK));
|
||||
AddStep("show drum", () => drumTouchInputArea.Show());
|
||||
AddStep("create drum (ddkk)", () => createDrum(TaikoTouchControlScheme.DDKK));
|
||||
AddStep("show drum", () => drumTouchInputArea.Show());
|
||||
AddStep("create drum (kkdd)", () => createDrum(TaikoTouchControlScheme.KKDD));
|
||||
AddStep("show drum", () => drumTouchInputArea.Show());
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||
/// </summary>
|
||||
public partial class DrumTouchInputArea : VisibilityContainer
|
||||
{
|
||||
public TaikoTouchControlScheme? ForceControlScheme { get; set; }
|
||||
// visibility state affects our child. we always want to handle input.
|
||||
public override bool PropagatePositionalInputSubTree => true;
|
||||
public override bool PropagateNonPositionalInputSubTree => true;
|
||||
|
@ -55,7 +56,10 @@ private void load(TaikoInputManager taikoInputManager, TaikoRulesetConfigManager
|
|||
|
||||
const float centre_region = 0.80f;
|
||||
|
||||
config.BindWith(TaikoRulesetSetting.TouchControlScheme, configTouchControlScheme);
|
||||
if (ForceControlScheme == null)
|
||||
config.BindWith(TaikoRulesetSetting.TouchControlScheme, configTouchControlScheme);
|
||||
else
|
||||
configTouchControlScheme.Value = (TaikoTouchControlScheme)ForceControlScheme;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue