1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Initial clean up pass on notification logic

This commit is contained in:
Dean Herbert 2021-09-05 12:54:21 +09:00
parent cdd0262ca1
commit 1d23ac0f2d
2 changed files with 8 additions and 4 deletions

View File

@ -6,7 +6,6 @@ using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Framework.Utils;
namespace osu.Game.Graphics.UserInterface
@ -28,7 +27,7 @@ namespace osu.Game.Graphics.UserInterface
}
[BackgroundDependencyLoader]
private void load(AudioManager audio, SessionStatics statics)
private void load(AudioManager audio)
{
sampleHover = audio.Samples.Get($@"UI/{SampleSet.GetDescription()}-hover")
?? audio.Samples.Get($@"UI/{HoverSampleSet.Default.GetDescription()}-hover");

View File

@ -98,14 +98,16 @@ namespace osu.Game.Overlays
private int runningDepth;
private void notificationClosed() => updateCounts();
private readonly Scheduler postScheduler = new Scheduler();
public override bool IsPresent => base.IsPresent || postScheduler.HasPendingTasks;
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(() =>
{
++runningDepth;
@ -129,6 +131,7 @@ namespace osu.Game.Overlays
protected override void Update()
{
base.Update();
if (processingPosts)
postScheduler.Update();
}
@ -151,6 +154,8 @@ namespace osu.Game.Overlays
this.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint);
}
private void notificationClosed() => updateCounts();
private void updateCounts()
{
UnreadCount.Value = sections.Select(c => c.UnreadCount).Sum();