mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 18:32:55 +08:00
Fix unread count potentially missing notifications in a transforming state
This commit is contained in:
parent
0558dae917
commit
7c72c6b43f
@ -222,16 +222,16 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateCounts()
|
|
||||||
{
|
|
||||||
unreadCount.Value = sections.Select(c => c.UnreadCount).Sum() + toastTray.UnreadCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void markAllRead()
|
private void markAllRead()
|
||||||
{
|
{
|
||||||
sections.Children.ForEach(s => s.MarkAllRead());
|
sections.Children.ForEach(s => s.MarkAllRead());
|
||||||
toastTray.MarkAllRead();
|
toastTray.MarkAllRead();
|
||||||
updateCounts();
|
updateCounts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateCounts()
|
||||||
|
{
|
||||||
|
unreadCount.Value = sections.Select(c => c.UnreadCount).Sum() + toastTray.UnreadCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ using System.Diagnostics;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Colour;
|
using osu.Framework.Graphics.Colour;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -32,7 +33,8 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
public Action<Notification>? ForwardNotificationToPermanentStore { get; set; }
|
public Action<Notification>? ForwardNotificationToPermanentStore { get; set; }
|
||||||
|
|
||||||
public int UnreadCount => toastFlow.Count(n => !n.WasClosed && !n.Read);
|
public int UnreadCount => toastFlow.Count(n => !n.WasClosed && !n.Read)
|
||||||
|
+ InternalChildren.OfType<Notification>().Count(n => !n.WasClosed && !n.Read);
|
||||||
|
|
||||||
private int runningDepth;
|
private int runningDepth;
|
||||||
|
|
||||||
@ -64,7 +66,7 @@ namespace osu.Game.Overlays
|
|||||||
postEffectDrawable.AutoSizeAxes = Axes.None;
|
postEffectDrawable.AutoSizeAxes = Axes.None;
|
||||||
postEffectDrawable.RelativeSizeAxes = Axes.X;
|
postEffectDrawable.RelativeSizeAxes = Axes.X;
|
||||||
})),
|
})),
|
||||||
toastFlow = new FillFlowContainer<Notification>
|
toastFlow = new AlwaysUpdateFillFlowContainer<Notification>
|
||||||
{
|
{
|
||||||
LayoutDuration = 150,
|
LayoutDuration = 150,
|
||||||
LayoutEasing = Easing.OutQuart,
|
LayoutEasing = Easing.OutQuart,
|
||||||
@ -84,10 +86,8 @@ namespace osu.Game.Overlays
|
|||||||
public void FlushAllToasts()
|
public void FlushAllToasts()
|
||||||
{
|
{
|
||||||
foreach (var notification in toastFlow.ToArray())
|
foreach (var notification in toastFlow.ToArray())
|
||||||
{
|
|
||||||
forwardNotification(notification);
|
forwardNotification(notification);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void Post(Notification notification)
|
public void Post(Notification notification)
|
||||||
{
|
{
|
||||||
@ -125,6 +125,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
Debug.Assert(notification.Parent == toastFlow);
|
Debug.Assert(notification.Parent == toastFlow);
|
||||||
|
|
||||||
|
// Temporarily remove from flow so we can animate the position off to the right.
|
||||||
toastFlow.Remove(notification);
|
toastFlow.Remove(notification);
|
||||||
AddInternal(notification);
|
AddInternal(notification);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user