Update IntegrationSettings to Luna, update Luna.
Some checks are pending
.NET Build / build (push) Waiting to run

This commit is contained in:
Ottermandias 2025-12-20 21:49:06 +01:00
parent 15b952ac22
commit a113bd329d
2 changed files with 16 additions and 15 deletions

2
Luna

@ -1 +1 @@
Subproject commit 4b346670840c3ae0ef33a3f94445ff9c2f55559e Subproject commit 3d5e7105f2671d741416988be95a5dba773adaf5

View file

@ -1,6 +1,6 @@
using Dalamud.Plugin; using Dalamud.Plugin;
using OtterGui.Services; using ImSharp;
using OtterGui.Text; using Luna;
using Penumbra.Api.Enums; using Penumbra.Api.Enums;
namespace Penumbra.UI.Integration; namespace Penumbra.UI.Integration;
@ -9,23 +9,20 @@ public sealed class IntegrationSettingsRegistry : IService, IDisposable
{ {
private readonly IDalamudPluginInterface _pluginInterface; private readonly IDalamudPluginInterface _pluginInterface;
private readonly List<(string InternalName, string Name, Action Draw)> _sections = []; private record struct Section(string InternalName, string Name, Action Draw);
private readonly List<Section> _sections = [];
private bool _disposed = false; private bool _disposed;
public IntegrationSettingsRegistry(IDalamudPluginInterface pluginInterface) public IntegrationSettingsRegistry(IDalamudPluginInterface pluginInterface)
{ {
_pluginInterface = pluginInterface; _pluginInterface = pluginInterface;
_pluginInterface.ActivePluginsChanged += OnActivePluginsChanged; _pluginInterface.ActivePluginsChanged += OnActivePluginsChanged;
} }
public void Dispose() public void Dispose()
{ {
_disposed = true; _disposed = true;
_pluginInterface.ActivePluginsChanged -= OnActivePluginsChanged; _pluginInterface.ActivePluginsChanged -= OnActivePluginsChanged;
_sections.Clear(); _sections.Clear();
} }
@ -33,10 +30,10 @@ public sealed class IntegrationSettingsRegistry : IService, IDisposable
{ {
foreach (var (internalName, name, draw) in _sections) foreach (var (internalName, name, draw) in _sections)
{ {
if (!ImUtf8.CollapsingHeader($"Integration with {name}###IntegrationSettingsHeader.{internalName}")) if (!Im.Tree.Header($"Integration with {name}###ISH.{internalName}"))
continue; continue;
using var id = ImUtf8.PushId($"IntegrationSettings.{internalName}"); using var id = Im.Id.Push($"IS.{internalName}");
try try
{ {
draw(); draw();
@ -57,17 +54,21 @@ public sealed class IntegrationSettingsRegistry : IService, IDisposable
if (plugin is null) if (plugin is null)
return PenumbraApiEc.InvalidArgument; return PenumbraApiEc.InvalidArgument;
var section = (plugin.InternalName, plugin.Name, draw); var section = new Section(plugin.InternalName, plugin.Name, draw);
var index = FindSectionIndex(plugin.InternalName); var index = FindSectionIndex(plugin.InternalName);
if (index >= 0) if (index >= 0)
{ {
if (_sections[index] == section) if (_sections[index] == section)
return PenumbraApiEc.NothingChanged; return PenumbraApiEc.NothingChanged;
_sections[index] = section; _sections[index] = section;
} }
else else
{
_sections.Add(section); _sections.Add(section);
}
_sections.Sort((lhs, rhs) => string.Compare(lhs.Name, rhs.Name, StringComparison.CurrentCultureIgnoreCase)); _sections.Sort((lhs, rhs) => string.Compare(lhs.Name, rhs.Name, StringComparison.CurrentCultureIgnoreCase));
return PenumbraApiEc.Success; return PenumbraApiEc.Success;