mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 16:43:00 +08:00
Revert changes
This commit is contained in:
parent
11a11802ed
commit
8d70b85e41
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user