ServerPack: card-actions hook for a server's own buttons
Adds partial void ServerCardActions(), drawn at the top of the server card under RynthCore's verdict (render thread). ServerPackUi takes an optional cardActions delegate; the plugin passes DrawCardActions (a delegate cannot bind an unimplemented partial, CS0762). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e52923ba5c
commit
52b0b00860
3 changed files with 53 additions and 3 deletions
|
|
@ -33,6 +33,8 @@
|
|||
// plugins that apply a server rule without knowing the server.
|
||||
// ServerCommandVerbs(list) its own "/rserver <verb>" words, handled in ServerChatCommand.
|
||||
// RunOnTick(action) work for the next tick (a page's button, on the render thread).
|
||||
// ServerCardActions() the server's own buttons at the top of its card, under RynthCore's verdict
|
||||
// (render thread: ImGui calls only; queue work with RunOnTick).
|
||||
// Send(command) a chat command as if typed (pump thread, logged in only);
|
||||
// LogTagged(text) the engine log, "[RynthConquest] ..."; ChatLine(text) the chat window.
|
||||
// Resources\quests.<id>.csv (no code) the server's own quest list: embedded by ServerPlugin.props and
|
||||
|
|
@ -102,7 +104,7 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
|
|||
var verbs = new List<string>();
|
||||
ServerCommandVerbs(verbs);
|
||||
foreach (string v in verbs) if (!string.IsNullOrWhiteSpace(v)) _serverVerbs.Add(v.Trim());
|
||||
_ui = new ServerPackUi(_model, RynthPluginInfo.Name + " " + Marshal.PtrToStringAnsi(VersionPointer), () => _world, _pages);
|
||||
_ui = new ServerPackUi(_model, RynthPluginInfo.Name + " " + Marshal.PtrToStringAnsi(VersionPointer), () => _world, _pages, DrawCardActions);
|
||||
}
|
||||
|
||||
internal ServerPackInfo Info => _model.Info;
|
||||
|
|
@ -147,6 +149,10 @@ 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>
|
||||
/// Drawn at the top of the server card, under RynthCore's verdict; render thread; queue work with RunOnTick.
|
||||
/// </summary>
|
||||
partial void ServerCardActions();
|
||||
/// <summary>
|
||||
/// An incoming chat line (pump thread, logged in only): set <paramref name="eat"/> to keep it out of
|
||||
/// the chat window (it comes in true when an earlier plugin already ate it).
|
||||
/// </summary>
|
||||
|
|
@ -165,6 +171,9 @@ public sealed partial class ServerPackPlugin : RynthPluginBase
|
|||
/// <summary>The live numbers of the profile ("values"). Any thread.</summary>
|
||||
internal ServerProfileValues ProfileValues => _profileValues;
|
||||
|
||||
// A delegate cannot bind an unimplemented partial method (CS0762), so the card gets this wrapper.
|
||||
private void DrawCardActions() => ServerCardActions();
|
||||
|
||||
/// <summary>The pages this plugin draws.</summary>
|
||||
internal IReadOnlyList<ServerPage> Pages => _pages;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue