mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +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;
|
||||
|
||||
|
|
|
|||
|
|
@ -923,7 +923,7 @@ internal class InterfaceManager : IDisposable, IServiceType
|
|||
if (this.IsDispatchingEvents)
|
||||
{
|
||||
this.Draw?.Invoke();
|
||||
Service<NotificationManager>.Get().Draw();
|
||||
Service<NotificationManager>.GetNullable()?.Draw();
|
||||
}
|
||||
|
||||
ImGuiManagedAsserts.ReportProblems("Dalamud Core", snap);
|
||||
|
|
|
|||
|
|
@ -127,6 +127,8 @@ internal class ImGuiWidget : IDataWindowWidget
|
|||
NotificationTemplate.ProgressModeTitles,
|
||||
NotificationTemplate.ProgressModeTitles.Length);
|
||||
|
||||
ImGui.Checkbox("Respect UI Hidden", ref this.notificationTemplate.RespectUiHidden);
|
||||
|
||||
ImGui.Checkbox("Minimized", ref this.notificationTemplate.Minimized);
|
||||
|
||||
ImGui.Checkbox("Show Indeterminate If No Expiry", ref this.notificationTemplate.ShowIndeterminateIfNoExpiry);
|
||||
|
|
@ -160,6 +162,7 @@ internal class ImGuiWidget : IDataWindowWidget
|
|||
: null,
|
||||
Type = type,
|
||||
ShowIndeterminateIfNoExpiry = this.notificationTemplate.ShowIndeterminateIfNoExpiry,
|
||||
RespectUiHidden = this.notificationTemplate.RespectUiHidden,
|
||||
Minimized = this.notificationTemplate.Minimized,
|
||||
UserDismissable = this.notificationTemplate.UserDismissable,
|
||||
InitialDuration =
|
||||
|
|
@ -388,6 +391,7 @@ internal class ImGuiWidget : IDataWindowWidget
|
|||
public int InitialDurationInt;
|
||||
public int HoverExtendDurationInt;
|
||||
public bool ShowIndeterminateIfNoExpiry;
|
||||
public bool RespectUiHidden;
|
||||
public bool Minimized;
|
||||
public bool UserDismissable;
|
||||
public bool ActionBar;
|
||||
|
|
@ -413,6 +417,7 @@ internal class ImGuiWidget : IDataWindowWidget
|
|||
this.UserDismissable = true;
|
||||
this.ActionBar = true;
|
||||
this.ProgressMode = 0;
|
||||
this.RespectUiHidden = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 722a2c512238ac4b5324e3d343b316d8c8633a02
|
||||
Subproject commit ac2ced26fc98153c65f5b8f0eaf0f464258ff683
|
||||
Loading…
Add table
Add a link
Reference in a new issue