From 8d70b85e41c8bba1aa2c056554c66a59d0002f56 Mon Sep 17 00:00:00 2001 From: Susko3 <16479013+Susko3@users.noreply.github.com> Date: Mon, 21 Feb 2022 20:20:24 +0100 Subject: [PATCH] Revert changes --- osu.Android/OsuGameAndroid.cs | 35 ------------------------------- osu.Game/Screens/Menu/MainMenu.cs | 12 ----------- 2 files changed, 47 deletions(-) diff --git a/osu.Android/OsuGameAndroid.cs b/osu.Android/OsuGameAndroid.cs index 914a6f7502..050bf2b787 100644 --- a/osu.Android/OsuGameAndroid.cs +++ b/osu.Android/OsuGameAndroid.cs @@ -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; diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 2391903861..8b1bab52b3 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -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(OsuSetting.UIHoldActivationDelay); loginDisplayed = statics.GetBindable(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); - } } }