diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs
index 9e13003c3f..c46b0e3d12 100644
--- a/osu.Desktop/Overlays/VersionManager.cs
+++ b/osu.Desktop/Overlays/VersionManager.cs
@@ -110,7 +110,7 @@ namespace osu.Desktop.Overlays
// only show a notification if we've previously saved a version to the config file (ie. not the first run).
if (!string.IsNullOrEmpty(lastVersion))
- Scheduler.AddDelayed(() => notificationOverlay.Post(new UpdateCompleteNotification(version)), 5000);
+ notificationOverlay.Post(new UpdateCompleteNotification(version));
}
}
diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs
index 67f6e6f4e2..391a9ee19a 100644
--- a/osu.Game/OsuGame.cs
+++ b/osu.Game/OsuGame.cs
@@ -64,6 +64,8 @@ namespace osu.Game
public float ToolbarOffset => Toolbar.Position.Y + Toolbar.DrawHeight;
+ public readonly BindableBool ShowOverlays = new BindableBool();
+
private OsuScreen screenStack;
private VolumeControl volume;
@@ -287,6 +289,21 @@ namespace osu.Game
settings.StateChanged += stateChanged;
notifications.StateChanged += stateChanged;
+ notifications.Enabled.BindTo(ShowOverlays);
+
+ ShowOverlays.ValueChanged += visible =>
+ {
+ //central game screen change logic.
+ if (!visible)
+ {
+ hideAllOverlays();
+ musicController.State = Visibility.Hidden;
+ Toolbar.State = Visibility.Hidden;
+ }
+ else
+ Toolbar.State = Visibility.Visible;
+ };
+
Cursor.State = Visibility.Hidden;
}
@@ -357,6 +374,8 @@ namespace osu.Game
notifications.State = Visibility.Hidden;
}
+ private ScheduledDelegate notificationsEnabler;
+
private void screenChanged(Screen newScreen)
{
currentScreen = newScreen as OsuScreen;
@@ -367,16 +386,6 @@ namespace osu.Game
return;
}
- //central game screen change logic.
- if (!currentScreen.ShowOverlays)
- {
- hideAllOverlays();
- musicController.State = Visibility.Hidden;
- Toolbar.State = Visibility.Hidden;
- }
- else
- Toolbar.State = Visibility.Visible;
-
ScreenChanged?.Invoke(newScreen);
}
diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs
index a4b5486596..75e2ad0bdc 100644
--- a/osu.Game/Overlays/NotificationOverlay.cs
+++ b/osu.Game/Overlays/NotificationOverlay.cs
@@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
-using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -11,6 +10,9 @@ using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Containers;
using System;
+using osu.Framework.Allocation;
+using osu.Framework.Configuration;
+using osu.Framework.Threading;
namespace osu.Game.Overlays
{
@@ -20,6 +22,11 @@ namespace osu.Game.Overlays
public const float TRANSITION_LENGTH = 600;
+ ///
+ /// Whether posted notifications should be processed.
+ ///
+ public readonly BindableBool Enabled = new BindableBool(true);
+
private FlowContainer sections;
///
@@ -27,6 +34,27 @@ namespace osu.Game.Overlays
///
public Func GetToolbarHeight;
+ public NotificationOverlay()
+ {
+ ScheduledDelegate notificationsEnabler = null;
+ Enabled.ValueChanged += v =>
+ {
+ if (!IsLoaded)
+ {
+ processingPosts = v;
+ return;
+ }
+
+ notificationsEnabler?.Cancel();
+
+ if (v)
+ // we want a slight delay before toggling notifications on to avoid the user becoming overwhelmed.
+ notificationsEnabler = Scheduler.AddDelayed(() => processingPosts = true, 1000);
+ else
+ processingPosts = false;
+ };
+ }
+
[BackgroundDependencyLoader]
private void load()
{
@@ -84,9 +112,13 @@ namespace osu.Game.Overlays
State = Visibility.Hidden;
}
+ private readonly Scheduler postScheduler = new Scheduler();
+
+ private bool processingPosts = true;
+
public void Post(Notification notification)
{
- Schedule(() =>
+ postScheduler.Add(() =>
{
State = Visibility.Visible;
@@ -104,6 +136,13 @@ namespace osu.Game.Overlays
});
}
+ protected override void Update()
+ {
+ base.Update();
+ if (processingPosts)
+ postScheduler.Update();
+ }
+
protected override void PopIn()
{
base.PopIn();
diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs
index 19d00f3477..76f51d1c33 100644
--- a/osu.Game/Screens/Edit/Editor.cs
+++ b/osu.Game/Screens/Edit/Editor.cs
@@ -24,7 +24,7 @@ namespace osu.Game.Screens.Edit
{
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");
- public override bool ShowOverlays => false;
+ public override bool ShowOverlaysOnEnter => false;
private readonly Box bottomBackground;
private readonly Container screenContainer;
diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs
index ec2e8e0cb1..c96194f63d 100644
--- a/osu.Game/Screens/Loader.cs
+++ b/osu.Game/Screens/Loader.cs
@@ -17,7 +17,7 @@ namespace osu.Game.Screens
{
private bool showDisclaimer;
- public override bool ShowOverlays => false;
+ public override bool ShowOverlaysOnEnter => false;
public Loader()
{
diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs
index ce7856c5a9..c82d90d16c 100644
--- a/osu.Game/Screens/Menu/ButtonSystem.cs
+++ b/osu.Game/Screens/Menu/ButtonSystem.cs
@@ -11,12 +11,12 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Game.Graphics;
-using osu.Game.Overlays.Toolbar;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Input;
using osu.Framework.Audio.Sample;
using osu.Framework.Audio;
+using osu.Framework.Configuration;
using osu.Framework.Threading;
namespace osu.Game.Screens.Menu
@@ -25,6 +25,8 @@ namespace osu.Game.Screens.Menu
{
public event Action StateChanged;
+ private readonly BindableBool showOverlays = new BindableBool();
+
public Action OnEdit;
public Action OnExit;
public Action OnDirect;
@@ -34,8 +36,6 @@ namespace osu.Game.Screens.Menu
public Action OnChart;
public Action OnTest;
- private Toolbar toolbar;
-
private readonly FlowContainerWithOrigin buttonFlow;
//todo: make these non-internal somehow.
@@ -131,9 +131,9 @@ namespace osu.Game.Screens.Menu
}
[BackgroundDependencyLoader(true)]
- private void load(AudioManager audio, OsuGame game = null)
+ private void load(AudioManager audio, OsuGame game)
{
- toolbar = game?.Toolbar;
+ if (game != null) showOverlays.BindTo(game.ShowOverlays);
sampleBack = audio.Sample.Get(@"Menu/button-back-select");
}
@@ -300,7 +300,7 @@ namespace osu.Game.Screens.Menu
logoDelayedAction = Scheduler.AddDelayed(() =>
{
- toolbar?.Hide();
+ showOverlays.Value = false;
logo.ClearTransforms(targetMember: nameof(Position));
logo.RelativePositionAxes = Axes.Both;
@@ -329,7 +329,7 @@ namespace osu.Game.Screens.Menu
logoTracking = true;
logo.Impact();
- toolbar?.Show();
+ showOverlays.Value = true;
}, 200);
break;
default:
diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs
index 532ee71b72..d0ad613640 100644
--- a/osu.Game/Screens/Menu/Disclaimer.cs
+++ b/osu.Game/Screens/Menu/Disclaimer.cs
@@ -18,7 +18,7 @@ namespace osu.Game.Screens.Menu
private readonly SpriteIcon icon;
private Color4 iconColour;
- public override bool ShowOverlays => false;
+ public override bool ShowOverlaysOnEnter => false;
public override bool HasLocalCursorDisplayed => true;
diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs
index d7beb34a2f..a6a1afa320 100644
--- a/osu.Game/Screens/Menu/Intro.cs
+++ b/osu.Game/Screens/Menu/Intro.cs
@@ -33,7 +33,7 @@ namespace osu.Game.Screens.Menu
public override bool HasLocalCursorDisplayed => true;
- public override bool ShowOverlays => false;
+ public override bool ShowOverlaysOnEnter => false;
protected override BackgroundScreen CreateBackground() => new BackgroundScreenEmpty();
diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs
index 90f68ba9f1..fac0ec1422 100644
--- a/osu.Game/Screens/Menu/MainMenu.cs
+++ b/osu.Game/Screens/Menu/MainMenu.cs
@@ -24,7 +24,7 @@ namespace osu.Game.Screens.Menu
{
private readonly ButtonSystem buttons;
- public override bool ShowOverlays => buttons.State != MenuState.Initial;
+ public override bool ShowOverlaysOnEnter => buttons.State != MenuState.Initial;
private readonly BackgroundScreenDefault background;
private Screen songSelect;
diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs
index 4a27c7f1ea..0013d1a882 100644
--- a/osu.Game/Screens/OsuScreen.cs
+++ b/osu.Game/Screens/OsuScreen.cs
@@ -28,7 +28,12 @@ namespace osu.Game.Screens
///
protected virtual BackgroundScreen CreateBackground() => null;
- public virtual bool ShowOverlays => true;
+ protected BindableBool ShowOverlays = new BindableBool();
+
+ ///
+ /// Whether overlays should be shown when this screen is entered or resumed.
+ ///
+ public virtual bool ShowOverlaysOnEnter => true;
protected new OsuGameBase Game => base.Game as OsuGameBase;
@@ -70,7 +75,10 @@ namespace osu.Game.Screens
}
if (osuGame != null)
+ {
Ruleset.BindTo(osuGame.Ruleset);
+ ShowOverlays.BindTo(osuGame.ShowOverlays);
+ }
sampleExit = audio.Sample.Get(@"UI/screen-back");
}
@@ -94,6 +102,8 @@ namespace osu.Game.Screens
base.OnResuming(last);
logo.AppendAnimatingAction(() => LogoArriving(logo, true), true);
sampleExit?.Play();
+
+ ShowOverlays.Value = ShowOverlaysOnEnter;
}
protected override void OnSuspending(Screen next)
@@ -139,6 +149,8 @@ namespace osu.Game.Screens
logo.AppendAnimatingAction(() => LogoArriving(logo, false), true);
base.OnEntering(last);
+
+ ShowOverlays.Value = ShowOverlaysOnEnter;
}
protected override bool OnExiting(Screen next)
diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs
index 340fc39d52..d5cd89c386 100644
--- a/osu.Game/Screens/Play/Player.cs
+++ b/osu.Game/Screens/Play/Player.cs
@@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play
{
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
- public override bool ShowOverlays => false;
+ public override bool ShowOverlaysOnEnter => false;
public override bool HasLocalCursorDisplayed => !pauseContainer.IsPaused && !HasFailed && RulesetContainer.ProvidingUserCursor;
diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs
index de67bef004..c2a8f13207 100644
--- a/osu.Game/Screens/Play/PlayerLoader.cs
+++ b/osu.Game/Screens/Play/PlayerLoader.cs
@@ -23,7 +23,7 @@ namespace osu.Game.Screens.Play
private BeatmapMetadataDisplay info;
private bool showOverlays = true;
- public override bool ShowOverlays => showOverlays;
+ public override bool ShowOverlaysOnEnter => showOverlays;
public override bool AllowBeatmapRulesetChange => false;
diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs
index 3e7ab56c99..fbf24eb609 100644
--- a/osu.Game/Screens/Tournament/Drawings.cs
+++ b/osu.Game/Screens/Tournament/Drawings.cs
@@ -29,7 +29,7 @@ namespace osu.Game.Screens.Tournament
{
private const string results_filename = "drawings_results.txt";
- public override bool ShowOverlays => false;
+ public override bool ShowOverlaysOnEnter => false;
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault();