mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
Ensure notifications don't appear during UserTriggered mode
Closes #2640.
This commit is contained in:
@ -366,8 +366,6 @@ namespace osu.Game
|
|||||||
|
|
||||||
settings.StateChanged += _ => updateScreenOffset();
|
settings.StateChanged += _ => updateScreenOffset();
|
||||||
notifications.StateChanged += _ => updateScreenOffset();
|
notifications.StateChanged += _ => updateScreenOffset();
|
||||||
|
|
||||||
AllowOverlays.ValueChanged += state => notifications.Enabled.Value = state == OverlayActivation.All;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CloseAllOverlays()
|
public void CloseAllOverlays()
|
||||||
|
@ -22,11 +22,6 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
public const float TRANSITION_LENGTH = 600;
|
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;
|
private FlowContainer<NotificationSection> sections;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -34,27 +29,6 @@ namespace osu.Game.Overlays
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Func<float> GetToolbarHeight;
|
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]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
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 totalCount => sections.Select(c => c.DisplayedCount).Sum();
|
||||||
private int unreadCount => sections.Select(c => c.UnreadCount).Sum();
|
private int unreadCount => sections.Select(c => c.UnreadCount).Sum();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user