1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:47:27 +08:00

Revert changes

This commit is contained in:
Susko3 2022-02-21 20:20:24 +01:00
parent 11a11802ed
commit 8d70b85e41
2 changed files with 0 additions and 47 deletions

View File

@ -5,11 +5,7 @@ using System;
using Android.App;
using Android.OS;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Platform;
using osu.Framework.Screens;
using osu.Game;
using osu.Game.Screens.Menu;
using osu.Game.Updater;
using osu.Game.Utils;
using Xamarin.Essentials;
@ -21,8 +17,6 @@ namespace osu.Android
[Cached]
private readonly OsuGameActivity gameActivity;
private readonly BindableBool allowExiting = new BindableBool();
public OsuGameAndroid(OsuGameActivity activity)
: base(null)
{
@ -73,45 +67,16 @@ namespace osu.Android
}
}
public override void SetHost(GameHost host)
{
base.SetHost(host);
host.AllowExitingAndroid.AddSource(allowExiting);
}
protected override void LoadComplete()
{
base.LoadComplete();
LoadComponentAsync(new GameplayScreenRotationLocker(), Add);
}
protected override void ScreenChanged(IScreen current, IScreen newScreen)
{
base.ScreenChanged(current, newScreen);
switch (newScreen)
{
case MainMenu _:
// allow the MainMenu to (dis)allow exiting based on its ButtonSystemState.
allowExiting.Value = true;
break;
default:
allowExiting.Value = false;
break;
}
}
protected override UpdateManager CreateUpdateManager() => new SimpleUpdateManager();
protected override BatteryInfo CreateBatteryInfo() => new AndroidBatteryInfo();
protected override void Dispose(bool isDisposing)
{
Host.AllowExitingAndroid.RemoveSource(allowExiting);
base.Dispose(isDisposing);
}
private class AndroidBatteryInfo : BatteryInfo
{
public override double ChargeLevel => Battery.ChargeLevel;

View File

@ -70,16 +70,12 @@ namespace osu.Game.Screens.Menu
private ParallaxContainer buttonsContainer;
private SongTicker songTicker;
private readonly BindableBool allowExitingAndroid = new BindableBool(true);
[BackgroundDependencyLoader(true)]
private void load(BeatmapListingOverlay beatmapListing, SettingsOverlay settings, OsuConfigManager config, SessionStatics statics)
{
holdDelay = config.GetBindable<float>(OsuSetting.UIHoldActivationDelay);
loginDisplayed = statics.GetBindable<bool>(Static.LoginOverlayDisplayed);
host.AllowExitingAndroid.AddSource(allowExitingAndroid);
if (host.CanExit)
{
AddInternal(exitConfirmOverlay = new ExitConfirmOverlay
@ -138,8 +134,6 @@ namespace osu.Game.Screens.Menu
ApplyToBackground(b => b.FadeColour(OsuColour.Gray(0.8f), 500, Easing.OutSine));
break;
}
allowExitingAndroid.Value = state == ButtonSystemState.Initial;
};
buttons.OnSettings = () => settings?.ToggleVisibility();
@ -303,11 +297,5 @@ namespace osu.Game.Screens.Menu
Schedule(loadSoloSongSelect);
}
protected override void Dispose(bool isDisposing)
{
host.AllowExitingAndroid.RemoveSource(allowExitingAndroid);
base.Dispose(isDisposing);
}
}
}