2019-03-01 19:59:39 +09:00
|
|
|
|
// 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.
|
|
|
|
|
|
2022-06-17 16:37:17 +09:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2019-03-01 19:59:39 +09:00
|
|
|
|
using System;
|
|
|
|
|
using Foundation;
|
2022-02-04 18:58:29 +09:00
|
|
|
|
using osu.Framework.Graphics;
|
2022-01-15 14:48:41 +01:00
|
|
|
|
using osu.Framework.Input.Handlers;
|
|
|
|
|
using osu.Framework.iOS.Input;
|
2019-03-01 19:59:39 +09:00
|
|
|
|
using osu.Game;
|
2022-01-15 14:48:41 +01:00
|
|
|
|
using osu.Game.Overlays.Settings;
|
2019-12-20 13:50:57 +09:00
|
|
|
|
using osu.Game.Updater;
|
2021-04-08 19:34:35 -04:00
|
|
|
|
using osu.Game.Utils;
|
|
|
|
|
using Xamarin.Essentials;
|
2019-03-01 19:59:39 +09:00
|
|
|
|
|
|
|
|
|
namespace osu.iOS
|
|
|
|
|
{
|
|
|
|
|
public class OsuGameIOS : OsuGame
|
|
|
|
|
{
|
2019-03-01 23:20:34 +09:00
|
|
|
|
public override Version AssemblyVersion => new Version(NSBundle.MainBundle.InfoDictionary["CFBundleVersion"].ToString());
|
2020-10-06 13:09:42 +09:00
|
|
|
|
|
|
|
|
|
protected override UpdateManager CreateUpdateManager() => new SimpleUpdateManager();
|
2021-04-08 19:34:35 -04:00
|
|
|
|
|
2021-04-12 10:52:12 -04:00
|
|
|
|
protected override BatteryInfo CreateBatteryInfo() => new IOSBatteryInfo();
|
2021-04-09 17:55:41 -04:00
|
|
|
|
|
2022-02-04 16:10:49 +03:00
|
|
|
|
protected override Edges SafeAreaOverrideEdges =>
|
2022-02-04 18:58:29 +09:00
|
|
|
|
// iOS shows a home indicator at the bottom, and adds a safe area to account for this.
|
|
|
|
|
// Because we have the home indicator (mostly) hidden we don't really care about drawing in this region.
|
|
|
|
|
Edges.Bottom;
|
|
|
|
|
|
2022-01-15 14:48:41 +01:00
|
|
|
|
public override SettingsSubsection CreateSettingsSubsectionFor(InputHandler handler)
|
|
|
|
|
{
|
|
|
|
|
switch (handler)
|
|
|
|
|
{
|
|
|
|
|
case IOSMouseHandler _:
|
|
|
|
|
return new IOSMouseSettings();
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return base.CreateSettingsSubsectionFor(handler);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-12 10:52:12 -04:00
|
|
|
|
private class IOSBatteryInfo : BatteryInfo
|
2021-04-08 19:34:35 -04:00
|
|
|
|
{
|
2022-07-30 14:26:19 +02:00
|
|
|
|
public override double? ChargeLevel => Battery.ChargeLevel;
|
2021-04-08 19:34:35 -04:00
|
|
|
|
|
2022-07-30 14:26:19 +02:00
|
|
|
|
public override bool OnBattery => Battery.PowerSource == BatteryPowerSource.Battery;
|
2021-04-08 19:34:35 -04:00
|
|
|
|
}
|
2019-03-01 19:59:39 +09:00
|
|
|
|
}
|
|
|
|
|
}
|