mirror of
https://github.com/ppy/osu.git
synced 2024-09-22 02:07:34 +08:00
Ensure notifications don't appear during UserTriggered mode
Closes #2640.
This commit is contained in:
parent
d1fd09ed47
commit
9e25e02696
@ -366,8 +366,6 @@ namespace osu.Game
|
||||
|
||||
settings.StateChanged += _ => updateScreenOffset();
|
||||
notifications.StateChanged += _ => updateScreenOffset();
|
||||
|
||||
AllowOverlays.ValueChanged += state => notifications.Enabled.Value = state == OverlayActivation.All;
|
||||
}
|
||||
|
||||
public void CloseAllOverlays()
|
||||
|
@ -22,11 +22,6 @@ namespace osu.Game.Overlays
|
||||
|
||||
public const float TRANSITION_LENGTH = 600;
|
||||
|
||||
/// <summary>
|
||||
/// Whether posted notifications should be processed.
|
||||
/// </summary>
|
||||
public readonly BindableBool Enabled = new BindableBool(true);
|
||||
|
||||
private FlowContainer<NotificationSection> sections;
|
||||
|
||||
/// <summary>
|
||||
@ -34,27 +29,6 @@ namespace osu.Game.Overlays
|
||||
/// </summary>
|
||||
public Func<float> 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()
|
||||
{
|
||||
@ -103,6 +77,29 @@ namespace osu.Game.Overlays
|
||||
};
|
||||
}
|
||||
|
||||
private ScheduledDelegate notificationsEnabler;
|
||||
private void updateProcessingMode()
|
||||
{
|
||||
bool enabled = OverlayActivationMode == OverlayActivation.All || State == Visibility.Visible;
|
||||
|
||||
notificationsEnabler?.Cancel();
|
||||
|
||||
if (enabled)
|
||||
// we want a slight delay before toggling notifications on to avoid the user becoming overwhelmed.
|
||||
notificationsEnabler = Scheduler.AddDelayed(() => processingPosts = true, State == Visibility.Visible ? 0 : 1000);
|
||||
else
|
||||
processingPosts = false;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
StateChanged += _ => updateProcessingMode();
|
||||
OverlayActivationMode.ValueChanged += _ => updateProcessingMode();
|
||||
OverlayActivationMode.TriggerChange();
|
||||
}
|
||||
|
||||
private int totalCount => sections.Select(c => c.DisplayedCount).Sum();
|
||||
private int unreadCount => sections.Select(c => c.UnreadCount).Sum();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user