Files
AetherBags/KamiToolKit/Controllers/AddonEventController.cs
T
KnackAtNite 8db4ce6094
Debug Build and Test / Build against Latest Dalamud (push) Has been cancelled
Debug Build and Test / Build against Staging Dalamud (push) Has been cancelled
Initial commit: AetherBags + KamiToolKit for FC Gitea
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 14:46:31 -05:00

41 lines
1.5 KiB
C#

using System;
using FFXIVClientStructs.FFXIV.Client.UI;
namespace KamiToolKit.Controllers;
public abstract unsafe class AddonEventController<T> where T : unmanaged {
protected AddonEventController() {
if (typeof(T) == typeof(AddonNamePlate)) {
throw new NotSupportedException("Attaching to NamePlate is not supported. Use OverlayController.");
}
}
public delegate void AddonControllerEvent(T* addon);
public event AddonControllerEvent? OnAttach {
add => OnInnerAttach += value;
remove => throw new Exception("Do not remove events, on dispose addon state will be managed properly.");
}
public event AddonControllerEvent? OnDetach {
add => OnInnerDetach += value;
remove => throw new Exception("Do not remove events, on dispose addon state will be managed properly.");
}
public event AddonControllerEvent? OnRefresh {
add => OnInnerRefresh += value;
remove => throw new Exception("Do not remove events, on dispose addon state will be managed properly.");
}
public event AddonControllerEvent? OnUpdate {
add => OnInnerUpdate += value;
remove => throw new Exception("Do not remove events, on dispose addon state will be managed properly.");
}
protected AddonControllerEvent? OnInnerAttach;
protected AddonControllerEvent? OnInnerDetach;
protected AddonControllerEvent? OnInnerRefresh;
protected AddonControllerEvent? OnInnerUpdate;
}