mirror of
https://github.com/ppy/osu
synced 2025-02-07 13:51:59 +00:00
Merge pull request #26575 from bdach/touch-device-multiplayer
Fix touch device not always activating when it should
This commit is contained in:
commit
15a5fd7e4c
@ -51,7 +51,6 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
|
||||
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 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
|
||||
AddAssert("touch device mod activated", () => currentPlayer.Score.ScoreInfo.Mods, () => Has.One.InstanceOf<OsuModTouchDevice>());
|
||||
}
|
||||
|
||||
[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<OsuModTouchDevice>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTouchDuringBreak()
|
||||
{
|
||||
|
@ -20,12 +20,16 @@ namespace osu.Game.Screens.Play
|
||||
private GameplayState gameplayState { get; set; } = null!;
|
||||
|
||||
private IBindable<bool> touchActive = new BindableBool();
|
||||
private IBindable<bool> isBreakTime = null!;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(SessionStatics statics)
|
||||
{
|
||||
touchActive = statics.GetBindable<bool>(Static.TouchInputActive);
|
||||
touchActive.BindValueChanged(_ => updateState());
|
||||
|
||||
isBreakTime = player.IsBreakTime.GetBoundCopy();
|
||||
isBreakTime.BindValueChanged(_ => updateState(), true);
|
||||
}
|
||||
|
||||
private void updateState()
|
||||
@ -39,7 +43,7 @@ namespace osu.Game.Screens.Play
|
||||
if (gameplayState.Score.ScoreInfo.Mods.OfType<ModTouchDevice>().Any())
|
||||
return;
|
||||
|
||||
if (player.IsBreakTime.Value)
|
||||
if (isBreakTime.Value)
|
||||
return;
|
||||
|
||||
var touchDeviceMod = gameplayState.Ruleset.GetTouchDeviceMod();
|
||||
|
Loading…
Reference in New Issue
Block a user