mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
parent
4f68809ab0
commit
1f0b616e2c
3 changed files with 17 additions and 5 deletions
|
|
@ -134,6 +134,9 @@ internal unsafe class AddonLifecycle : IInternalDisposableService
|
||||||
/// <param name="listener">The listener to unregister.</param>
|
/// <param name="listener">The listener to unregister.</param>
|
||||||
internal void UnregisterListener(AddonLifecycleEventListener listener)
|
internal void UnregisterListener(AddonLifecycleEventListener listener)
|
||||||
{
|
{
|
||||||
|
// Set removed state to true immediately, then lazily remove it from the EventListeners list on next Framework Update.
|
||||||
|
listener.Removed = true;
|
||||||
|
|
||||||
this.framework.RunOnTick(() =>
|
this.framework.RunOnTick(() =>
|
||||||
{
|
{
|
||||||
this.EventListeners.Remove(listener);
|
this.EventListeners.Remove(listener);
|
||||||
|
|
@ -168,6 +171,10 @@ internal unsafe class AddonLifecycle : IInternalDisposableService
|
||||||
if (listener.EventType != eventType)
|
if (listener.EventType != eventType)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// If the listener is pending removal, and is waiting until the next Framework Update, don't invoke listener.
|
||||||
|
if (listener.Removed)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Match on string.empty for listeners that want events for all addons.
|
// Match on string.empty for listeners that want events for all addons.
|
||||||
if (!string.IsNullOrWhiteSpace(listener.AddonName) && !args.IsAddon(listener.AddonName))
|
if (!string.IsNullOrWhiteSpace(listener.AddonName) && !args.IsAddon(listener.AddonName))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,11 @@ internal class AddonLifecycleEventListener
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string AddonName { get; init; }
|
public string AddonName { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether this event has been unregistered.
|
||||||
|
/// </summary>
|
||||||
|
public bool Removed { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the event type this listener is looking for.
|
/// Gets the event type this listener is looking for.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ public sealed unsafe class DtrBarEntry : IDisposable, IDtrBarEntry
|
||||||
private readonly DalamudConfiguration configuration;
|
private readonly DalamudConfiguration configuration;
|
||||||
|
|
||||||
private bool shownBacking = true;
|
private bool shownBacking = true;
|
||||||
private SeString? textBacking = null;
|
private SeString? textBacking;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="DtrBarEntry"/> class.
|
/// Initializes a new instance of the <see cref="DtrBarEntry"/> class.
|
||||||
|
|
@ -153,17 +153,17 @@ public sealed unsafe class DtrBarEntry : IDisposable, IDtrBarEntry
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this entry should be removed.
|
/// Gets a value indicating whether this entry should be removed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal bool ShouldBeRemoved { get; private set; } = false;
|
internal bool ShouldBeRemoved { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether this entry is dirty.
|
/// Gets or sets a value indicating whether this entry is dirty.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal bool Dirty { get; set; } = false;
|
internal bool Dirty { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether this entry has just been added.
|
/// Gets or sets a value indicating whether this entry has just been added.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal bool Added { get; set; } = false;
|
internal bool Added { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public bool TriggerClickAction()
|
public bool TriggerClickAction()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue