Merge branch 'master' into osu-link-ipc

This commit is contained in:
Bartłomiej Dach
2022-06-21 07:27:35 +02:00
11 changed files with 227 additions and 43 deletions

View File

@ -21,6 +21,8 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Performance;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input;
using osu.Framework.Input.Handlers;
using osu.Framework.Input.Handlers.Midi;
using osu.Framework.IO.Stores;
using osu.Framework.Logging;
using osu.Framework.Platform;
@ -42,6 +44,8 @@ using osu.Game.Online.Chat;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Spectator;
using osu.Game.Overlays;
using osu.Game.Overlays.Settings;
using osu.Game.Overlays.Settings.Sections;
using osu.Game.Resources;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
@ -468,6 +472,23 @@ namespace osu.Game
protected override Storage CreateStorage(GameHost host, Storage defaultStorage) => new OsuStorage(host, defaultStorage);
/// <summary>
/// Creates an input settings subsection for an <see cref="InputHandler"/>.
/// </summary>
/// <remarks>Should be overriden per-platform to provide settings for platform-specific handlers.</remarks>
public virtual SettingsSubsection CreateSettingsSubsectionFor(InputHandler handler)
{
switch (handler)
{
case MidiHandler _:
return new InputSection.HandlerSection(handler);
// return null for handlers that shouldn't have settings.
default:
return null;
}
}
private void onBeatmapChanged(ValueChangedEvent<WorkingBeatmap> valueChangedEvent)
{
if (IsLoaded && !ThreadSafety.IsUpdateThread)

View File

@ -126,7 +126,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
}, true);
}
private class SensitivitySetting : SettingsSlider<double, SensitivitySlider>
public class SensitivitySetting : SettingsSlider<double, SensitivitySlider>
{
public SensitivitySetting()
{
@ -135,7 +135,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
}
}
private class SensitivitySlider : OsuSliderBar<double>
public class SensitivitySlider : OsuSliderBar<double>
{
public override LocalisableString TooltipText => Current.Disabled ? MouseSettingsStrings.EnableHighPrecisionForSensitivityAdjust : $"{base.TooltipText}x";
}

View File

@ -7,10 +7,6 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Handlers;
using osu.Framework.Input.Handlers.Joystick;
using osu.Framework.Input.Handlers.Midi;
using osu.Framework.Input.Handlers.Mouse;
using osu.Framework.Input.Handlers.Tablet;
using osu.Framework.Localisation;
using osu.Framework.Platform;
using osu.Game.Localisation;
@ -24,9 +20,6 @@ namespace osu.Game.Overlays.Settings.Sections
public override LocalisableString Header => InputSettingsStrings.InputSectionHeader;
[Resolved]
private GameHost host { get; set; }
public override Drawable CreateIcon() => new SpriteIcon
{
Icon = FontAwesome.Solid.Keyboard
@ -38,7 +31,7 @@ namespace osu.Game.Overlays.Settings.Sections
}
[BackgroundDependencyLoader]
private void load()
private void load(GameHost host, OsuGameBase game)
{
Children = new Drawable[]
{
@ -47,45 +40,14 @@ namespace osu.Game.Overlays.Settings.Sections
foreach (var handler in host.AvailableInputHandlers)
{
var handlerSection = createSectionFor(handler);
var handlerSection = game.CreateSettingsSubsectionFor(handler);
if (handlerSection != null)
Add(handlerSection);
}
}
private SettingsSubsection createSectionFor(InputHandler handler)
{
SettingsSubsection section;
switch (handler)
{
// ReSharper disable once SuspiciousTypeConversion.Global (net standard fuckery)
case ITabletHandler th:
section = new TabletSettings(th);
break;
case MouseHandler mh:
section = new MouseSettings(mh);
break;
// whitelist the handlers which should be displayed to avoid any weird cases of users touching settings they shouldn't.
case JoystickHandler jh:
section = new JoystickSettings(jh);
break;
case MidiHandler _:
section = new HandlerSection(handler);
break;
default:
return null;
}
return section;
}
private class HandlerSection : SettingsSubsection
public class HandlerSection : SettingsSubsection
{
private readonly InputHandler handler;

View File

@ -47,6 +47,11 @@ namespace osu.Game.Screens.Edit.Timing
public bool EnableClicking { get; set; } = true;
public MetronomeDisplay()
{
AllowMistimedEventFiring = false;
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{