Files
AetherBags/KamiToolKit/Nodes/Component/LuminaButtonListNode.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
989 B
C#

using System.Linq;
using KamiToolKit.Classes;
using Lumina.Excel;
namespace KamiToolKit.Nodes;
public class LuminaButtonListNode<T> : ButtonListNode<T> where T : struct, IExcelRow<T> {
public delegate string GetLabel(T excelRow);
public delegate bool ShouldShow(T excelRow);
public GetLabel? LabelFunction {
get;
set {
field = value;
ResolveOptions();
}
}
public ShouldShow? FilterFunction {
get;
set {
field = value;
ResolveOptions();
}
}
private void ResolveOptions() {
if (LabelFunction is null) return;
if (FilterFunction is null) return;
Options = DalamudInterface.Instance.DataManager.GetExcelSheet<T>()
.Where(row => FilterFunction(row))
.ToList();
}
protected override string GetLabelForOption(T option)
=> LabelFunction?.Invoke(option) ?? "ERROR: Label Function Not Found";
}