ServerPack: optional bar menu on the server's window (ServerBarMenu hook)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daniel Wallace 2026-11-07 20:07:53 -08:00
commit 4afb8f3ac3
3 changed files with 83 additions and 2 deletions

View file

@ -77,6 +77,8 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
private readonly List<ServerPage> _pages;
// The server's own windows (ServerWindows), validated the same way.
private readonly List<ServerWindow> _windows;
// The server window's bar-icon dropdown (ServerBarMenu), for the sections manifest.
private readonly List<ServerBarMenuItem> _barMenu = new();
private readonly List<string> _pageNotes = new();
private readonly ServerPackSettings _settings = new(ServerPackSettings.DefaultPath(RynthPluginInfo.Name));
private readonly ServerProfileValues _profileValues = new();
@ -109,6 +111,7 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
foreach (string v in verbs) if (!string.IsNullOrWhiteSpace(v)) _serverVerbs.Add(v.Trim());
ServerUsageLines(_usageLines.Add);
_ui = new ServerPackUi(_model, RynthPluginInfo.Name + " " + Marshal.PtrToStringAnsi(VersionPointer), () => _world, _pages, DrawCardActions);
ServerBarMenu(_barMenu);
}
internal ServerPackInfo Info => _model.Info;
@ -158,6 +161,11 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
/// <summary>Every frame while logged in (render thread, AC's main thread; the engine's ImGui context current).</summary>
partial void ServerRender();
/// <summary>
/// Items for a hover dropdown on the server window's bar icon (RynthCore API 94; an older engine
/// ignores it). Called once, from the constructor (no Host yet).
/// </summary>
partial void ServerBarMenu(List<ServerBarMenuItem> items);
/// <summary>
/// Drawn at the top of the server card, under RynthCore's verdict; render thread; queue work with RunOnTick.
/// </summary>
partial void ServerCardActions();
@ -301,7 +309,7 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
/// </summary>
internal string? BuildSectionsJson()
=> _sectionsJson ??= ServerPackModel.BuildSectionsJson(Info, RynthPluginInfo.Name, _pages, _windows,
frameless: _windows.Count > 0 && Host.HasFramelessWindows);
frameless: _windows.Count > 0 && Host.HasFramelessWindows, barMenu: _barMenu);
/// <summary>
/// RynthPluginRenderEmbed "window:&lt;id&gt;": one of the server's own windows (ServerWindows), into the