1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-16 01:42:58 +08:00

Merge pull request #14023 from peppy/add-high-precision-macos-note

Add warning about using high precision mouse on non-windows platforms
This commit is contained in:
Dan Balasescu 2021-07-26 18:07:38 +09:00 committed by GitHub
commit 3a81d5e8ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 4 deletions

View File

@ -54,6 +54,11 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString CursorSensitivity => new TranslatableString(getKey(@"cursor_sensitivity"), @"Cursor sensitivity");
/// <summary>
/// "This setting has known issues on your platform. If you encounter problems, it is recommended to adjust sensitivity externally and keep this disabled for now."
/// </summary>
public static LocalisableString HighPrecisionPlatformWarning => new TranslatableString(getKey(@"high_precision_platform_warning"), @"This setting has known issues on your platform. If you encounter problems, it is recommended to adjust sensitivity externally and keep this disabled for now.");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

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 osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Configuration;
@ -28,6 +29,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input
private SettingsEnumDropdown<OsuConfineMouseMode> confineMouseModeSetting;
private Bindable<bool> relativeMode;
private SettingsCheckbox highPrecisionMouse;
public MouseSettings(MouseHandler mouseHandler)
{
this.mouseHandler = mouseHandler;
@ -45,7 +48,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
Children = new Drawable[]
{
new SettingsCheckbox
highPrecisionMouse = new SettingsCheckbox
{
LabelText = MouseSettingsStrings.HighPrecisionMouse,
TooltipText = MouseSettingsStrings.HighPrecisionMouseTooltip,
@ -107,6 +110,17 @@ namespace osu.Game.Overlays.Settings.Sections.Input
confineMouseModeSetting.TooltipText = string.Empty;
}
}, true);
highPrecisionMouse.Current.BindValueChanged(highPrecision =>
{
if (RuntimeInfo.OS != RuntimeInfo.Platform.Windows)
{
if (highPrecision.NewValue)
highPrecisionMouse.WarningText = MouseSettingsStrings.HighPrecisionPlatformWarning;
else
highPrecisionMouse.WarningText = null;
}
}, true);
}
private class SensitivitySetting : SettingsSlider<double, SensitivitySlider>

View File

@ -61,12 +61,17 @@ namespace osu.Game.Overlays.Settings
/// Text to be displayed at the bottom of this <see cref="SettingsItem{T}"/>.
/// Generally used to recommend the user change their setting as the current one is considered sub-optimal.
/// </summary>
public string WarningText
public LocalisableString? WarningText
{
set
{
bool hasValue = string.IsNullOrWhiteSpace(value.ToString());
if (warningText == null)
{
if (!hasValue)
return;
// construct lazily for cases where the label is not needed (may be provided by the Control).
FlowContent.Add(warningText = new OsuTextFlowContainer
{
@ -77,8 +82,8 @@ namespace osu.Game.Overlays.Settings
});
}
warningText.Alpha = string.IsNullOrWhiteSpace(value) ? 0 : 1;
warningText.Text = value;
warningText.Alpha = hasValue ? 0 : 1;
warningText.Text = value.ToString(); // TODO: Remove ToString() call after TextFlowContainer supports localisation (see https://github.com/ppy/osu-framework/issues/4636).
}
}