1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 04:32:57 +08:00

Add iOS mouse settings

Functionality is currently limited to some OsuSettings, but will expand in
the future when high precision mouse is added.
This commit is contained in:
Susko3 2022-01-15 14:48:41 +01:00
parent 037e56f13e
commit d4af8498af
3 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,36 @@
// 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.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Configuration;
using osu.Game.Localisation;
using osu.Game.Overlays.Settings;
namespace osu.iOS
{
public class IOSMouseSettings : SettingsSubsection
{
protected override LocalisableString Header => MouseSettingsStrings.Mouse;
[BackgroundDependencyLoader]
private void load(OsuConfigManager osuConfig)
{
Children = new Drawable[]
{
new SettingsCheckbox
{
LabelText = MouseSettingsStrings.DisableMouseWheelVolumeAdjust,
TooltipText = MouseSettingsStrings.DisableMouseWheelVolumeAdjustTooltip,
Current = osuConfig.GetBindable<bool>(OsuSetting.MouseDisableWheel),
},
new SettingsCheckbox
{
LabelText = MouseSettingsStrings.DisableMouseButtons,
Current = osuConfig.GetBindable<bool>(OsuSetting.MouseDisableButtons),
},
};
}
}
}

View File

@ -3,7 +3,10 @@
using System;
using Foundation;
using osu.Framework.Input.Handlers;
using osu.Framework.iOS.Input;
using osu.Game;
using osu.Game.Overlays.Settings;
using osu.Game.Updater;
using osu.Game.Utils;
using Xamarin.Essentials;
@ -18,6 +21,18 @@ namespace osu.iOS
protected override BatteryInfo CreateBatteryInfo() => new IOSBatteryInfo();
public override SettingsSubsection CreateSettingsSubsectionFor(InputHandler handler)
{
switch (handler)
{
case IOSMouseHandler _:
return new IOSMouseSettings();
default:
return base.CreateSettingsSubsectionFor(handler);
}
}
private class IOSBatteryInfo : BatteryInfo
{
public override double ChargeLevel => Battery.ChargeLevel;

View File

@ -23,6 +23,7 @@
<ItemGroup>
<Compile Include="Application.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="IOSMouseSettings.cs" />
<Compile Include="OsuGameIOS.cs" />
</ItemGroup>
<ItemGroup>