Do not attempt to turn on Touch Device in song select with autoplay active

This commit is contained in:
Bartłomiej Dach 2023-11-02 22:20:17 +01:00
parent d25b54c06d
commit 8784dd42c0
No known key found for this signature in database
3 changed files with 13 additions and 2 deletions

View File

@ -24,7 +24,7 @@ public abstract class ModAutoplay : Mod, ICreateReplayData
public sealed override bool ValidForMultiplayer => false;
public sealed override bool ValidForMultiplayerAsFreeMod => false;
public override Type[] IncompatibleMods => new[] { typeof(ModCinema), typeof(ModRelax), typeof(ModAdaptiveSpeed) };
public override Type[] IncompatibleMods => new[] { typeof(ModCinema), typeof(ModRelax), typeof(ModAdaptiveSpeed), typeof(ModTouchDevice) };
public override bool HasImplementation => GetType().GenericTypeArguments.Length == 0;

View File

@ -1,6 +1,7 @@
// 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 osu.Framework.Localisation;
namespace osu.Game.Rulesets.Mods
@ -13,5 +14,6 @@ public class ModTouchDevice : Mod, IApplicableMod
public sealed override double ScoreMultiplier => 1;
public sealed override ModType Type => ModType.System;
public sealed override bool AlwaysValidForSubmission => true;
public sealed override Type[] IncompatibleMods => new[] { typeof(ICreateReplayData) };
}
}

View File

@ -9,6 +9,7 @@
using osu.Game.Configuration;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Utils;
namespace osu.Game.Screens.Select
{
@ -52,7 +53,15 @@ private void updateState()
bool touchDeviceModEnabled = mods.Value.Any(mod => mod is ModTouchDevice);
if (touchActive.Value && !touchDeviceModEnabled)
mods.Value = mods.Value.Append(touchDeviceMod).ToArray();
{
var candidateMods = mods.Value.Append(touchDeviceMod).ToArray();
if (!ModUtils.CheckCompatibleSet(candidateMods, out _))
return;
mods.Value = candidateMods;
}
if (!touchActive.Value && touchDeviceModEnabled)
mods.Value = mods.Value.Where(mod => mod is not ModTouchDevice).ToArray();
}