mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +01:00
Add INotification.RespectUiHidden
This commit is contained in:
parent
ecfbcfe194
commit
9724e511e9
7 changed files with 29 additions and 2 deletions
|
|
@ -60,6 +60,9 @@ public interface INotification
|
|||
/// <see cref="HardExpiry"/> is set to <see cref="DateTime.MaxValue"/>.</summary>
|
||||
bool ShowIndeterminateIfNoExpiry { get; set; }
|
||||
|
||||
/// <summary>Gets or sets a value indicating whether to respect the current UI visibility state.</summary>
|
||||
bool RespectUiHidden { get; set; }
|
||||
|
||||
/// <summary>Gets or sets a value indicating whether the notification has been minimized.</summary>
|
||||
bool Minimized { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -90,6 +90,13 @@ internal sealed partial class ActiveNotification : IActiveNotification
|
|||
set => this.underlyingNotification.Title = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool RespectUiHidden
|
||||
{
|
||||
get => this.underlyingNotification.RespectUiHidden;
|
||||
set => this.underlyingNotification.RespectUiHidden = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string? MinimizedText
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Game.Gui;
|
||||
using Dalamud.Interface.GameFonts;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Dalamud.Interface.ManagedFontAtlas;
|
||||
|
|
@ -20,6 +21,9 @@ namespace Dalamud.Interface.ImGuiNotification.Internal;
|
|||
[ServiceManager.EarlyLoadedService]
|
||||
internal class NotificationManager : INotificationManager, IServiceType, IDisposable
|
||||
{
|
||||
[ServiceManager.ServiceDependency]
|
||||
private readonly GameGui gameGui = Service<GameGui>.Get();
|
||||
|
||||
private readonly List<ActiveNotification> notifications = new();
|
||||
private readonly ConcurrentBag<ActiveNotification> pendingNotifications = new();
|
||||
|
||||
|
|
@ -98,6 +102,7 @@ internal class NotificationManager : INotificationManager, IServiceType, IDispos
|
|||
{
|
||||
var viewportSize = ImGuiHelpers.MainViewport.WorkSize;
|
||||
var height = 0f;
|
||||
var uiHidden = this.gameGui.GameUiHidden;
|
||||
|
||||
while (this.pendingNotifications.TryTake(out var newNotification))
|
||||
this.notifications.Add(newNotification);
|
||||
|
|
@ -109,7 +114,11 @@ internal class NotificationManager : INotificationManager, IServiceType, IDispos
|
|||
|
||||
this.notifications.RemoveAll(static x => x.UpdateOrDisposeInternal());
|
||||
foreach (var tn in this.notifications)
|
||||
{
|
||||
if (uiHidden && tn.RespectUiHidden)
|
||||
continue;
|
||||
height += tn.Draw(width, height) + NotificationConstants.ScaledWindowGap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@ public sealed record Notification : INotification
|
|||
/// <inheritdoc/>
|
||||
public bool ShowIndeterminateIfNoExpiry { get; set; } = true;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool RespectUiHidden { get; set; } = true;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Minimized { get; set; } = true;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue