diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModTouchDevice.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModTouchDevice.cs index cd51ccd75134..fdb1cac3e518 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModTouchDevice.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModTouchDevice.cs @@ -51,7 +51,6 @@ public override void SetUpSteps() public void TestUserAlreadyHasTouchDeviceActive() { loadPlayer(); - // it is presumed that a previous screen (i.e. song select) will set this up AddStep("set up touchscreen user", () => { currentPlayer.Score.ScoreInfo.Mods = currentPlayer.Score.ScoreInfo.Mods.Append(new OsuModTouchDevice()).ToArray(); @@ -69,6 +68,14 @@ public void TestUserAlreadyHasTouchDeviceActive() AddAssert("touch device mod activated", () => currentPlayer.Score.ScoreInfo.Mods, () => Has.One.InstanceOf()); } + [Test] + public void TestTouchActivePriorToPlayerLoad() + { + AddStep("set touch input active", () => statics.SetValue(Static.TouchInputActive, true)); + loadPlayer(); + AddUntilStep("touch device mod activated", () => currentPlayer.Score.ScoreInfo.Mods, () => Has.One.InstanceOf()); + } + [Test] public void TestTouchDuringBreak() { diff --git a/osu.Game/Screens/Play/PlayerTouchInputDetector.cs b/osu.Game/Screens/Play/PlayerTouchInputDetector.cs index 69c3cd0dedb7..12fb748e7d13 100644 --- a/osu.Game/Screens/Play/PlayerTouchInputDetector.cs +++ b/osu.Game/Screens/Play/PlayerTouchInputDetector.cs @@ -20,12 +20,16 @@ public partial class PlayerTouchInputDetector : Component private GameplayState gameplayState { get; set; } = null!; private IBindable touchActive = new BindableBool(); + private IBindable isBreakTime = null!; [BackgroundDependencyLoader] private void load(SessionStatics statics) { touchActive = statics.GetBindable(Static.TouchInputActive); touchActive.BindValueChanged(_ => updateState()); + + isBreakTime = player.IsBreakTime.GetBoundCopy(); + isBreakTime.BindValueChanged(_ => updateState(), true); } private void updateState() @@ -39,7 +43,7 @@ private void updateState() if (gameplayState.Score.ScoreInfo.Mods.OfType().Any()) return; - if (player.IsBreakTime.Value) + if (isBreakTime.Value) return; var touchDeviceMod = gameplayState.Ruleset.GetTouchDeviceMod();