1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 08:27:49 +08:00

Use touch detection for input settings

Intentionally not dynamically updating because it would complicate things,
and doesn't bring any benefits to this ephemeral screen.
This commit is contained in:
Susko3 2023-12-04 20:10:12 +01:00
parent f0364f01ea
commit 83e1eea1ad

View File

@ -1,7 +1,6 @@
// 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 osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Configuration;
@ -17,15 +16,16 @@ namespace osu.Game.Screens.Play.PlayerSettings
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
private void load(OsuConfigManager config, SessionStatics sessionStatics)
{
bool touchActive = sessionStatics.Get<bool>(Static.TouchInputActive);
Children = new Drawable[]
{
new PlayerCheckbox
{
// TODO: change to touchscreen detection once https://github.com/ppy/osu/pull/25348 makes it in
LabelText = RuntimeInfo.IsDesktop ? MouseSettingsStrings.DisableClicksDuringGameplay : TouchSettingsStrings.DisableTapsDuringGameplay,
Current = config.GetBindable<bool>(RuntimeInfo.IsDesktop ? OsuSetting.MouseDisableButtons : OsuSetting.TouchDisableGameplayTaps)
LabelText = touchActive ? TouchSettingsStrings.DisableTapsDuringGameplay : MouseSettingsStrings.DisableClicksDuringGameplay,
Current = config.GetBindable<bool>(touchActive ? OsuSetting.TouchDisableGameplayTaps : OsuSetting.MouseDisableButtons)
}
};
}