mirror of
https://github.com/ppy/osu
synced 2025-02-27 16:11:43 +00:00
Initial clean up pass on notification logic
This commit is contained in:
parent
cdd0262ca1
commit
1d23ac0f2d
@ -6,7 +6,6 @@ using osu.Framework.Audio;
|
|||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Configuration;
|
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
@ -28,7 +27,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, SessionStatics statics)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
sampleHover = audio.Samples.Get($@"UI/{SampleSet.GetDescription()}-hover")
|
sampleHover = audio.Samples.Get($@"UI/{SampleSet.GetDescription()}-hover")
|
||||||
?? audio.Samples.Get($@"UI/{HoverSampleSet.Default.GetDescription()}-hover");
|
?? audio.Samples.Get($@"UI/{HoverSampleSet.Default.GetDescription()}-hover");
|
||||||
|
@ -98,14 +98,16 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private int runningDepth;
|
private int runningDepth;
|
||||||
|
|
||||||
private void notificationClosed() => updateCounts();
|
|
||||||
|
|
||||||
private readonly Scheduler postScheduler = new Scheduler();
|
private readonly Scheduler postScheduler = new Scheduler();
|
||||||
|
|
||||||
public override bool IsPresent => base.IsPresent || postScheduler.HasPendingTasks;
|
public override bool IsPresent => base.IsPresent || postScheduler.HasPendingTasks;
|
||||||
|
|
||||||
private bool processingPosts = true;
|
private bool processingPosts = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Post a new notification for display.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="notification">The notification to display.</param>
|
||||||
public void Post(Notification notification) => postScheduler.Add(() =>
|
public void Post(Notification notification) => postScheduler.Add(() =>
|
||||||
{
|
{
|
||||||
++runningDepth;
|
++runningDepth;
|
||||||
@ -129,6 +131,7 @@ namespace osu.Game.Overlays
|
|||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
if (processingPosts)
|
if (processingPosts)
|
||||||
postScheduler.Update();
|
postScheduler.Update();
|
||||||
}
|
}
|
||||||
@ -151,6 +154,8 @@ namespace osu.Game.Overlays
|
|||||||
this.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint);
|
this.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void notificationClosed() => updateCounts();
|
||||||
|
|
||||||
private void updateCounts()
|
private void updateCounts()
|
||||||
{
|
{
|
||||||
UnreadCount.Value = sections.Select(c => c.UnreadCount).Sum();
|
UnreadCount.Value = sections.Select(c => c.UnreadCount).Sum();
|
||||||
|
Loading…
Reference in New Issue
Block a user