Snapshot for release 2026.10.31.2 (internal 4a0710c)
This commit is contained in:
parent
76aca938b6
commit
d54613aa63
50 changed files with 5824 additions and 179 deletions
171
Plugins/RynthCore.Plugin.RynthNet/Characters/CharactersLook.cs
Normal file
171
Plugins/RynthCore.Plugin.RynthNet/Characters/CharactersLook.cs
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
// ============================================================================
|
||||
// RynthNet - Characters/CharactersLook.cs
|
||||
// The Characters window's two looks (2026-10-31, the owner: "our networking
|
||||
// tab should be changed to look similar to our Lua script for components. Very
|
||||
// minimalistic."), pure so Tools/RynthNet.Tests compiles it in:
|
||||
//
|
||||
// Minimal the default: one compact line per character, no frame and no
|
||||
// background on an engine with frameless windows (API v90): a
|
||||
// status dot (botting, fighting, idle, dead, stale...), the name
|
||||
// (amber when its health is low, red when critical or dead), three
|
||||
// thin vital bars, and the arrow and distance when there is room.
|
||||
// Full "edit mode": the framed window with every column (the look the
|
||||
// window had before), where it is moved and resized.
|
||||
//
|
||||
// Here: the view names and /rn view, the low-health thresholds, the status
|
||||
// dot, and the minimal line's layout at a width. Kept per character in
|
||||
// RynthNet's settings.json ("view" under the character).
|
||||
// ============================================================================
|
||||
|
||||
using System;
|
||||
|
||||
namespace RynthCore.Plugin.RynthNet.Characters;
|
||||
|
||||
/// <summary>How the Characters window looks.</summary>
|
||||
internal enum CharactersViewMode
|
||||
{
|
||||
/// <summary>One compact line per character, frameless (the default).</summary>
|
||||
Minimal = 0,
|
||||
/// <summary>The framed window with every column.</summary>
|
||||
Full = 1,
|
||||
}
|
||||
|
||||
/// <summary>A character's health, for the minimal line's colour.</summary>
|
||||
internal enum HpWarn { Ok, Low, Critical, Dead, Unknown }
|
||||
|
||||
/// <summary>The minimal line's status dot.</summary>
|
||||
internal enum CharDot { Self, Botting, Fighting, Idle, Dead, Portal, Stale, Off }
|
||||
|
||||
/// <summary>The minimal line at a width (px): the name column, the bars and whether the arrow and distance fit.</summary>
|
||||
internal readonly record struct MinimalLine(float NameWidth, bool Bars, float BarWidth, bool Distance)
|
||||
{
|
||||
/// <summary>How wide the line is drawn (dot, name, bars, distance).</summary>
|
||||
public float Width(float k, float distWidth) =>
|
||||
CharactersLook.DotWidth * k + NameWidth
|
||||
+ (Bars ? CharactersLook.Gap * k + 3 * BarWidth + 2 * CharactersLook.BarGap * k : 0)
|
||||
+ (Distance ? CharactersLook.Gap * k + CharactersLook.ArrowWidth * k + distWidth : 0);
|
||||
}
|
||||
|
||||
/// <summary>What /rn view did.</summary>
|
||||
internal readonly record struct ViewAnswer(bool Ok, CharactersViewMode Next, bool Changed, string Reply);
|
||||
|
||||
internal static class CharactersLook
|
||||
{
|
||||
/// <summary>Health at or below this share is low (amber), at or below <see cref="CriticalHp"/> critical (red).</summary>
|
||||
public const float LowHp = 0.5f, CriticalHp = 0.25f;
|
||||
|
||||
/// <summary>Minimal line metrics (px at 100%).</summary>
|
||||
public const float RowHeight = 16f, DotWidth = 12f, Gap = 6f, BarWidth = 24f, MinBarWidth = 8f, BarGap = 2f,
|
||||
BarHeight = 4f, ArrowWidth = 14f, MinNameWidth = 30f;
|
||||
|
||||
public const string Usage = "usage: /rn view [minimal|full] (alone: the view now)";
|
||||
|
||||
// ── colours ─────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>The health warning for a row: dead (its state, or 0 health), critical, low, fine, or unknown (no vitals).</summary>
|
||||
public static HpWarn Hp(CharacterRow r)
|
||||
{
|
||||
if (r.StateKind == CharStateKind.Dead) return HpWarn.Dead;
|
||||
if (!r.HasVitals) return HpWarn.Unknown;
|
||||
return Hp(r.Hp.Fraction);
|
||||
}
|
||||
|
||||
/// <summary>The warning for a health share (0..1).</summary>
|
||||
public static HpWarn Hp(float fraction)
|
||||
{
|
||||
if (fraction <= 0f) return HpWarn.Dead;
|
||||
if (fraction <= CriticalHp) return HpWarn.Critical;
|
||||
if (fraction <= LowHp) return HpWarn.Low;
|
||||
return HpWarn.Ok;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The status dot: logged out or no status (off), this client, dead, not updating (stale), portal
|
||||
/// space, fighting, botting, else idle. Dead and stale come before what the bot was doing.
|
||||
/// </summary>
|
||||
public static CharDot Dot(CharacterRow r)
|
||||
{
|
||||
if (r.LoggedOut || r.StateKind == CharStateKind.NoStatus) return CharDot.Off;
|
||||
if (r.IsSelf) return CharDot.Self;
|
||||
if (r.StateKind == CharStateKind.Dead) return CharDot.Dead;
|
||||
if (r.Stale) return CharDot.Stale;
|
||||
return r.StateKind switch
|
||||
{
|
||||
CharStateKind.Portal => CharDot.Portal,
|
||||
CharStateKind.Fighting => CharDot.Fighting,
|
||||
CharStateKind.Botting => CharDot.Botting,
|
||||
_ => CharDot.Idle,
|
||||
};
|
||||
}
|
||||
|
||||
// ── layout ──────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// The minimal line in <paramref name="width"/> px, for names up to <paramref name="nameWidth"/> and a
|
||||
/// distance up to <paramref name="distWidth"/> (k: the text size factor). The name and the bars come
|
||||
/// first; the arrow and distance only when everything fits. Narrower, the name gives way down to
|
||||
/// <see cref="MinNameWidth"/>, then the bars shrink to <see cref="MinBarWidth"/>, then go.
|
||||
/// </summary>
|
||||
public static MinimalLine Minimal(float width, float nameWidth, float distWidth, float k = 1f)
|
||||
{
|
||||
if (k <= 0) k = 1f;
|
||||
float dot = DotWidth * k, gap = Gap * k, barGap = BarGap * k;
|
||||
float bars = 3 * BarWidth * k + 2 * barGap;
|
||||
float dist = gap + ArrowWidth * k + distWidth;
|
||||
if (distWidth > 0 && width >= dot + nameWidth + gap + bars + dist)
|
||||
return new MinimalLine(nameWidth, true, BarWidth * k, true);
|
||||
|
||||
float minName = Math.Min(nameWidth, MinNameWidth * k);
|
||||
float name = Math.Clamp(width - dot - gap - bars, minName, nameWidth);
|
||||
if (width >= dot + name + gap + bars)
|
||||
return new MinimalLine(name, true, BarWidth * k, false);
|
||||
|
||||
float bar = (width - dot - minName - gap - 2 * barGap) / 3f;
|
||||
if (bar >= MinBarWidth * k)
|
||||
return new MinimalLine(minName, true, MathF.Floor(bar), false);
|
||||
return new MinimalLine(Math.Max(0, Math.Min(nameWidth, width - dot)), false, 0, false);
|
||||
}
|
||||
|
||||
/// <summary>The height the minimal window asks for: one line per row (at least one, for the status), and a small margin.</summary>
|
||||
public static float MinimalHeight(int rows, float k = 1f) => MathF.Ceiling((Math.Max(1, rows) * RowHeight + 4f) * (k <= 0 ? 1f : k));
|
||||
|
||||
// ── the view ────────────────────────────────────────────────────────
|
||||
|
||||
public static string Name(CharactersViewMode mode) => mode == CharactersViewMode.Full ? "full" : "minimal";
|
||||
|
||||
/// <summary>"minimal" (or "min", "compact", "bare"), "full" (or "edit", "framed"); any case. False for anything else.</summary>
|
||||
public static bool TryParse(string? text, out CharactersViewMode mode)
|
||||
{
|
||||
switch ((text ?? "").Trim().ToLowerInvariant())
|
||||
{
|
||||
case "minimal": case "min": case "compact": case "bare": mode = CharactersViewMode.Minimal; return true;
|
||||
case "full": case "edit": case "framed": mode = CharactersViewMode.Full; return true;
|
||||
default: mode = CharactersViewMode.Minimal; return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The settings file's value: a known name, else the default (minimal).</summary>
|
||||
public static CharactersViewMode FromSetting(string? text) => TryParse(text, out CharactersViewMode m) ? m : CharactersViewMode.Minimal;
|
||||
|
||||
/// <summary>
|
||||
/// /rn view [minimal|full|toggle]: alone says the view now. <paramref name="loggedIn"/>: the view is
|
||||
/// kept per character, so changing it needs one.
|
||||
/// </summary>
|
||||
public static ViewAnswer Command(string? args, CharactersViewMode current, bool loggedIn)
|
||||
{
|
||||
string a = (args ?? "").Trim().ToLowerInvariant();
|
||||
if (a.Length == 0) return new ViewAnswer(true, current, false, Describe(current, "the Characters window is in the "));
|
||||
CharactersViewMode next;
|
||||
if (a == "toggle") next = current == CharactersViewMode.Full ? CharactersViewMode.Minimal : CharactersViewMode.Full;
|
||||
else if (!TryParse(a, out next)) return new ViewAnswer(false, current, false, Usage);
|
||||
if (!loggedIn) return new ViewAnswer(false, current, false, "log in first: the view is kept per character.");
|
||||
bool changed = next != current;
|
||||
return new ViewAnswer(true, next, changed,
|
||||
Describe(next, changed ? "the Characters window now shows the " : "the Characters window is already in the "));
|
||||
}
|
||||
|
||||
/// <summary>"<head>minimal view (one line per character...). /rn view full for every column."</summary>
|
||||
public static string Describe(CharactersViewMode mode, string head) => head + (mode == CharactersViewMode.Full
|
||||
? "full view (every column; move and resize it here). /rn view minimal for the small one."
|
||||
: "minimal view (one line per character, no frame). /rn view full for every column, to move or resize it.");
|
||||
}
|
||||
|
|
@ -5,6 +5,14 @@
|
|||
// remembered place) and RynthNet draws (RynthPluginRenderEmbed with Surface).
|
||||
// Its title is the panel key players' saved places, /rc characters and hotkeys
|
||||
// already use. An engine before v89 ignores "windows". Pure.
|
||||
//
|
||||
// On an engine with frameless windows (v90, HasFramelessWindows) the window
|
||||
// is declared "chrome": "none" with "fitHeight" (2026-10-31): RynthNet draws
|
||||
// both of its looks itself (CharactersLook.cs), the minimal one without any
|
||||
// frame or background, the full one with its own frame and title row (drag,
|
||||
// pop-out, close), and the window is as tall as what it shows. On an older
|
||||
// engine it keeps the engine's frame (Json, as before) and the minimal look
|
||||
// draws inside it.
|
||||
// ============================================================================
|
||||
|
||||
using System.Globalization;
|
||||
|
|
@ -17,9 +25,19 @@ internal static class CharactersManifest
|
|||
public const string Title = "Characters";
|
||||
public const string Surface = "window:characters";
|
||||
|
||||
/// <summary>The manifest JSON (built once).</summary>
|
||||
public static readonly string Json =
|
||||
private static readonly string Head =
|
||||
"{\"version\":1,\"windows\":[{\"id\":\"characters\",\"title\":\"" + Title + "\",\"surface\":\"" + Surface +
|
||||
"\",\"icon\":\"\\u" + ((int)RynthIcons.UsersThree[0]).ToString("X4", CultureInfo.InvariantCulture) +
|
||||
"\",\"width\":420,\"height\":260,\"minWidth\":280,\"minHeight\":140,\"bar\":true,\"edgeToEdge\":true}]}";
|
||||
"\",\"icon\":\"\\u" + ((int)RynthIcons.UsersThree[0]).ToString("X4", CultureInfo.InvariantCulture) + "\",";
|
||||
|
||||
/// <summary>The manifest JSON for an engine without frameless windows: the engine's frame (built once).</summary>
|
||||
public static readonly string Json =
|
||||
Head + "\"width\":420,\"height\":260,\"minWidth\":280,\"minHeight\":140,\"bar\":true,\"edgeToEdge\":true}]}";
|
||||
|
||||
/// <summary>The manifest JSON for an engine with frameless windows (v90): RynthNet draws every frame (built once).</summary>
|
||||
public static readonly string FramelessJson =
|
||||
Head + "\"width\":420,\"height\":120,\"minWidth\":160,\"minHeight\":20,\"bar\":true,\"edgeToEdge\":true," +
|
||||
"\"chrome\":\"none\",\"fitHeight\":true}]}";
|
||||
|
||||
/// <summary>The manifest for this engine: frameless when it has frameless windows.</summary>
|
||||
public static string For(bool framelessWindows) => framelessWindows ? FramelessJson : Json;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,18 @@
|
|||
// it in game; right-click for /rn commands. Looks: Shared/RynthUi (the
|
||||
// player's theme). AC's render thread: it reads the published rows and the
|
||||
// pose, and queues everything it does for the plugin tick.
|
||||
//
|
||||
// Two looks (2026-10-31, CharactersLook.cs; /rn view, kept per character):
|
||||
// minimal the default, in item-counter.lua's style: one line per
|
||||
// character (status dot, name coloured by its health, three thin
|
||||
// vital bars, the arrow and distance when there is room), no frame
|
||||
// or background on an engine with frameless windows (v90). Hover
|
||||
// it for the pencil that brings the full look back.
|
||||
// full every column, as before. On a v90 engine the window is
|
||||
// frameless, so this look paints its own frame and title row:
|
||||
// drag it to move, Ctrl+wheel for the text size, the buttons for
|
||||
// the minimal look, pop-out and close; the corner resizes it.
|
||||
// Both ask for the height they need (the window fits it, "fitHeight").
|
||||
// ============================================================================
|
||||
|
||||
using System;
|
||||
|
|
@ -23,10 +35,12 @@ namespace RynthCore.Plugin.RynthNet.Characters;
|
|||
|
||||
internal sealed class CharactersWindow
|
||||
{
|
||||
private readonly RynthCoreHost _host;
|
||||
private readonly Action<uint> _select;
|
||||
private readonly Action<string, string> _tell;
|
||||
private readonly Action _followMeAll;
|
||||
private readonly Func<(bool Ok, float Heading)> _heading;
|
||||
private readonly Action<CharactersViewMode> _setView;
|
||||
|
||||
// The vitals colours of RynthAi's dashboard (fixed, whatever the theme).
|
||||
private static readonly uint HpCol = Argb(0xFFD93333), StCol = Argb(0xFF40D973), MpCol = Argb(0xFF268CF2),
|
||||
|
|
@ -42,6 +56,8 @@ internal sealed class CharactersWindow
|
|||
"Click a row to select that character in game (when this client can see it). Right-click for commands: " +
|
||||
"follow me, stop following, start or stop the macro. They go through RynthNet, so the other client's " +
|
||||
"remote command setting (/rn remote) decides whether they run.\n\n" +
|
||||
"The arrows-in button (or /rn view minimal) shows one line per character without the frame; " +
|
||||
"hover it for the pencil (or /rn view full) to come back here. Kept per character.\n\n" +
|
||||
"/rc characters opens and closes this window.";
|
||||
|
||||
private float _k = 1f;
|
||||
|
|
@ -53,33 +69,64 @@ internal sealed class CharactersWindow
|
|||
private bool _menuInView, _menuOtherWorld, _menuSelf, _menuLoggedOut;
|
||||
private bool _openMenu;
|
||||
|
||||
public CharactersWindow(Action<uint> select, Action<string, string> tell, Action followMeAll, Func<(bool, float)> heading)
|
||||
public CharactersWindow(RynthCoreHost host, Action<uint> select, Action<string, string> tell, Action followMeAll,
|
||||
Func<(bool, float)> heading, Action<CharactersViewMode> setView)
|
||||
{
|
||||
_host = host;
|
||||
_select = select;
|
||||
_tell = tell;
|
||||
_followMeAll = followMeAll;
|
||||
_heading = heading;
|
||||
_setView = setView;
|
||||
}
|
||||
|
||||
/// <summary>Draws the window body into the current ImGui window. Render thread.</summary>
|
||||
public void Draw(CharactersView view)
|
||||
/// <summary>
|
||||
/// Draws the window body into the current ImGui window in <paramref name="mode"/>'s look.
|
||||
/// <paramref name="frameless"/>: the engine gave the window no frame (v90), so the full look paints
|
||||
/// its own. <paramref name="popped"/>: drawn in its own OS window, so the minimal look keeps a
|
||||
/// background. Returns the height it needs (pixels; 0 = whatever the window is). Render thread.
|
||||
/// </summary>
|
||||
public float Draw(CharactersView view, CharactersViewMode mode, bool frameless, bool popped = false)
|
||||
{
|
||||
_k = Math.Max(0.5f, Font(RynthUiFont.Ui10).FontSize / 10f);
|
||||
if (mode == CharactersViewMode.Full) return DrawFull(view, ownFrame: frameless);
|
||||
if (popped)
|
||||
{
|
||||
Vector2 o = ImGui.GetCursorScreenPos();
|
||||
ImGui.GetWindowDrawList().AddRectFilled(o, o + ImGui.GetContentRegionAvail(), Background, 4);
|
||||
}
|
||||
return DrawMinimal(view, frameless && !popped);
|
||||
}
|
||||
|
||||
// ── Full look ───────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// Every column. <paramref name="ownFrame"/>: paint the frame and a title row (the engine gave none)
|
||||
/// and return the height the rows need; otherwise fill the engine's frame and return 0.
|
||||
/// </summary>
|
||||
private float DrawFull(CharactersView view, bool ownFrame)
|
||||
{
|
||||
Vector2 origin = ImGui.GetCursorScreenPos();
|
||||
Vector2 size = ImGui.GetContentRegionAvail();
|
||||
if (size.X < 40 || size.Y < 30) return;
|
||||
float titleH = ownFrame ? Px(20) : 0f;
|
||||
float rowsH = view.Rows.Length == 0 ? Px(30) : view.Rows.Length * RowH;
|
||||
// Margin, title, the status line, the rows, and room under them for the corner grip.
|
||||
float want = MathF.Ceiling(6 + titleH + Px(24) + rowsH + 6 + Px(12));
|
||||
if (ownFrame) size.Y = Math.Max(size.Y, want); // a frame late: draw at the height asked for
|
||||
if (size.X < 40 || size.Y < 30) return ownFrame ? want : 0f;
|
||||
ImDrawListPtr frame = ImGui.GetWindowDrawList();
|
||||
frame.AddRectFilled(origin, origin + size, Background, 4);
|
||||
using (PushFont(RynthUiFont.Ui10))
|
||||
{
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(4, 4));
|
||||
ImGui.SetCursorScreenPos(origin + new Vector2(6, 6));
|
||||
if (ownFrame) DrawTitle(origin, size.X, titleH);
|
||||
ImGui.SetCursorScreenPos(origin + new Vector2(6, 6 + titleH));
|
||||
ImGui.Indent(6);
|
||||
float w = size.X - 12;
|
||||
DrawTop(view, w);
|
||||
DrawTop(view, w, minimalButton: !ownFrame); // framed by the engine: no title row, so the button sits here
|
||||
|
||||
// The host's resize grip sits over the bottom-right corner: the rows end above it.
|
||||
float bodyH = Math.Max(Px(30), origin.Y + size.Y - 6 - ImGui.GetCursorScreenPos().Y - Px(12));
|
||||
float bodyH = ownFrame ? rowsH : Math.Max(Px(30), origin.Y + size.Y - 6 - ImGui.GetCursorScreenPos().Y - Px(12));
|
||||
ImGui.PushStyleColor(ImGuiCol.ChildBg, Field);
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0, 0));
|
||||
ImGui.BeginChild("##chars_rows", new Vector2(w, bodyH));
|
||||
|
|
@ -93,22 +140,245 @@ internal sealed class CharactersWindow
|
|||
DrawMenu(view);
|
||||
}
|
||||
frame.AddRect(origin, origin + size, Border, 4);
|
||||
return ownFrame ? want : 0f;
|
||||
}
|
||||
|
||||
/// <summary>The full look's own title row (frameless window): drag to move; minimal, pop-out and close.</summary>
|
||||
private void DrawTitle(Vector2 origin, float width, float h)
|
||||
{
|
||||
ImDrawListPtr dl = ImGui.GetWindowDrawList();
|
||||
float bw = Px(20), gap = Px(3);
|
||||
float buttons = 3 * bw + 2 * gap + 6;
|
||||
var top = new Vector2(origin.X, origin.Y + 3);
|
||||
ImGui.SetCursorScreenPos(origin);
|
||||
ImGui.InvisibleButton("##chars_title", new Vector2(Math.Max(10, width - buttons), h + 3));
|
||||
_host.PanelDragWithLastItem();
|
||||
SafeImGui.SetItemTooltip("Drag to move. Ctrl+wheel: text size. The corner resizes it.");
|
||||
ImFontPtr bold = Font(RynthUiFont.UiBold11);
|
||||
DrawCentered(dl, Font(RynthUiFont.Ui11), RynthIcons.UsersThree, new Vector2(origin.X + 6, top.Y), new Vector2(Px(14), h), Accent);
|
||||
dl.AddText(bold, bold.FontSize, new Vector2(origin.X + 6 + Px(18), top.Y + (h - bold.FontSize) * 0.5f), Text, CharactersManifest.Title);
|
||||
|
||||
float bx = origin.X + width - 6 - 3 * bw - 2 * gap;
|
||||
var bsize = new Vector2(bw, h - Px(2));
|
||||
if (IconButton("##chars_minimal", RynthIcons.ArrowsInLineVertical, new Vector2(bx, top.Y), bsize, Text, ButtonFill, font: RynthUiFont.Ui11))
|
||||
_setView(CharactersViewMode.Minimal);
|
||||
ImGui.SetItemTooltip("Minimal: one line per character, no frame (/rn view minimal)");
|
||||
if (IconButton("##chars_popout", RynthIcons.ArrowSquareOut, new Vector2(bx + bw + gap, top.Y), bsize, Text, ButtonFill, font: RynthUiFont.Ui11))
|
||||
_host.SetPanelPopOut(CharactersManifest.Title, RynthPanelPopOut.Toggle);
|
||||
ImGui.SetItemTooltip("Pop out into its own window, or dock it back");
|
||||
if (IconButton("##chars_close", RynthIcons.X, new Vector2(bx + 2 * (bw + gap), top.Y), bsize, Text, ButtonFill, font: RynthUiFont.Ui11))
|
||||
_host.SetPanelOpen(CharactersManifest.Title, RynthPanelOpen.Close);
|
||||
ImGui.SetItemTooltip("Close (/rc characters opens it again)");
|
||||
}
|
||||
|
||||
// ── Minimal look ────────────────────────────────────────────────────
|
||||
|
||||
private static readonly uint Shadow = 0xB0000000;
|
||||
|
||||
/// <summary>
|
||||
/// One line per character: status dot, name (its health's colour), three thin bars, arrow and
|
||||
/// distance when there's room. <paramref name="frameless"/>: no frame or background, the text
|
||||
/// shadowed so it reads over the game. Returns the height it needs.
|
||||
/// </summary>
|
||||
private float DrawMinimal(CharactersView view, bool frameless)
|
||||
{
|
||||
Vector2 origin = ImGui.GetCursorScreenPos();
|
||||
float width = ImGui.GetContentRegionAvail().X;
|
||||
CharacterRow[] rows = view.Rows;
|
||||
float want = CharactersLook.MinimalHeight(rows.Length, _k);
|
||||
if (width < 20) return want;
|
||||
ImDrawListPtr dl = ImGui.GetWindowDrawList();
|
||||
using (PushFont(RynthUiFont.Ui10))
|
||||
{
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
|
||||
float fontH = ImGui.GetFontSize();
|
||||
float rowH = MathF.Max(Px(CharactersLook.RowHeight), MathF.Ceiling(fontH + 3));
|
||||
want = MathF.Max(want, MathF.Ceiling(Math.Max(1, rows.Length) * rowH + 4));
|
||||
var start = new Vector2(origin.X + 2, origin.Y + 2);
|
||||
bool windowHot = ImGui.IsWindowHovered(ImGuiHoveredFlags.ChildWindows | ImGuiHoveredFlags.AllowWhenBlockedByActiveItem);
|
||||
float lineW;
|
||||
|
||||
if (rows.Length == 0)
|
||||
{
|
||||
// Nothing to list: the status, faint (and the pencil on hover).
|
||||
DrawDot(dl, new Vector2(start.X + Px(CharactersLook.DotWidth) * 0.5f, start.Y + rowH * 0.5f), CharDot.Off);
|
||||
string s = view.Status;
|
||||
float tw = Math.Min(ImGui.CalcTextSize(s).X, width - Px(CharactersLook.DotWidth) - Px(30));
|
||||
ShadowClip(dl, s, start.X + Px(CharactersLook.DotWidth), start.Y + (rowH - fontH) * 0.5f, tw, Faded(Text), frameless);
|
||||
lineW = Px(CharactersLook.DotWidth) + Math.Max(0, tw);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Columns from the longest name and distance, so the bars line up.
|
||||
float nameW = 0, distW = 0;
|
||||
foreach (CharacterRow r in rows)
|
||||
{
|
||||
nameW = MathF.Max(nameW, ImGui.CalcTextSize(r.Name).X);
|
||||
if (ShowsDistance(r)) distW = MathF.Max(distW, ImGui.CalcTextSize(r.DistanceText).X);
|
||||
}
|
||||
nameW = MathF.Ceiling(nameW + Px(2));
|
||||
float editRoom = Px(20);
|
||||
MinimalLine line = CharactersLook.Minimal(width - 4 - editRoom, nameW, distW, _k);
|
||||
lineW = line.Width(_k, distW);
|
||||
(bool haveHeading, float heading) = _heading();
|
||||
int hovered = -1;
|
||||
for (int i = 0; i < rows.Length; i++)
|
||||
{
|
||||
CharacterRow r = rows[i];
|
||||
var p = new Vector2(start.X, start.Y + i * rowH);
|
||||
ImGui.SetCursorScreenPos(p);
|
||||
ImGui.PushID(i);
|
||||
bool clicked = ImGui.InvisibleButton("##mrow", new Vector2(Math.Max(1, lineW), rowH),
|
||||
ImGuiButtonFlags.MouseButtonLeft | ImGuiButtonFlags.MouseButtonRight);
|
||||
bool hot = ImGui.IsItemHovered();
|
||||
bool right = clicked && ImGui.IsMouseReleased(ImGuiMouseButton.Right);
|
||||
ImGui.PopID();
|
||||
if (hot) hovered = i;
|
||||
if (clicked && !right && r.InView && r.Id != 0 && !r.IsSelf) _select(r.Id);
|
||||
if (right) OpenMenu(r);
|
||||
DrawMinimalRow(dl, r, p, line, lineW, rowH, fontH, hot, r.Id != 0 && r.Id == view.SelectedId,
|
||||
heading, haveHeading, distW, frameless);
|
||||
}
|
||||
if (hovered >= 0 && rows[hovered].Tooltip.Length > 0 && !ImGui.IsPopupOpen("##chars_menu"))
|
||||
{
|
||||
ImGui.BeginTooltip();
|
||||
ImGui.TextUnformatted(rows[hovered].Tooltip);
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
}
|
||||
|
||||
// The pencil: back to the full look (shown while the mouse is on the window).
|
||||
if (windowHot)
|
||||
{
|
||||
float bs = rowH - 2;
|
||||
var bp = new Vector2(Math.Min(start.X + lineW + Px(4), origin.X + width - bs - 2), start.Y + 1);
|
||||
if (IconButton("##chars_full", RynthIcons.PencilSimple, bp, new Vector2(bs, bs), Text, WithAlpha(Background, 0xE0),
|
||||
font: RynthUiFont.Ui11))
|
||||
_setView(CharactersViewMode.Full);
|
||||
ImGui.SetItemTooltip("Edit: the full window with every column, to move or resize it (/rn view full)");
|
||||
}
|
||||
|
||||
ImGui.SetCursorScreenPos(origin);
|
||||
ImGui.Dummy(new Vector2(Math.Max(1, width), Math.Max(1, want - 1)));
|
||||
ImGui.PopStyleVar();
|
||||
DrawMenu(view);
|
||||
}
|
||||
return want;
|
||||
}
|
||||
|
||||
private static bool ShowsDistance(CharacterRow r) => !r.IsSelf && !r.LoggedOut && r.DistanceText.Length > 0;
|
||||
|
||||
private void DrawMinimalRow(ImDrawListPtr dl, CharacterRow r, Vector2 p, MinimalLine line, float lineW, float rowH, float fontH,
|
||||
bool hot, bool isSel, float heading, bool haveHeading, float distW, bool frameless)
|
||||
{
|
||||
if (hot) dl.AddRectFilled(p, p + new Vector2(lineW, rowH), WithAlpha(Background, 0xB0), 2);
|
||||
if (isSel) dl.AddRect(p, p + new Vector2(lineW, rowH), Accent, 2);
|
||||
float dim = r.IsSelf || r.LoggedOut ? 0.6f : 1f;
|
||||
float x = p.X;
|
||||
float ty = p.Y + (rowH - fontH) * 0.5f;
|
||||
|
||||
DrawDot(dl, new Vector2(x + Px(CharactersLook.DotWidth) * 0.5f, p.Y + rowH * 0.5f), CharactersLook.Dot(r));
|
||||
x += Px(CharactersLook.DotWidth);
|
||||
|
||||
ShadowClip(dl, r.Name, x, ty, line.NameWidth, Fade(NameColor(r), dim), frameless);
|
||||
x += line.NameWidth;
|
||||
|
||||
if (line.Bars)
|
||||
{
|
||||
x += Px(CharactersLook.Gap);
|
||||
float bh = Math.Max(2f, Px(CharactersLook.BarHeight)), by = MathF.Round(p.Y + (rowH - bh) * 0.5f), gap = Px(CharactersLook.BarGap);
|
||||
if (r.HasVitals)
|
||||
{
|
||||
ThinBar(dl, x, by, line.BarWidth, bh, r.Hp.Fraction, Fade(HpCol, dim));
|
||||
ThinBar(dl, x + line.BarWidth + gap, by, line.BarWidth, bh, r.St.Fraction, Fade(StCol, dim));
|
||||
ThinBar(dl, x + 2 * (line.BarWidth + gap), by, line.BarWidth, bh, r.Mp.Fraction, Fade(MpCol, dim));
|
||||
}
|
||||
x += 3 * line.BarWidth + 2 * gap;
|
||||
}
|
||||
|
||||
if (line.Distance && ShowsDistance(r))
|
||||
{
|
||||
x += Px(CharactersLook.Gap);
|
||||
var mid = new Vector2(x + Px(CharactersLook.ArrowWidth) * 0.5f, p.Y + rowH * 0.5f);
|
||||
uint col = Fade(r.Measured ? Text : Faded(Mute), dim);
|
||||
if (r.Measured && haveHeading && !float.IsNaN(r.Bearing))
|
||||
{
|
||||
if (frameless) DrawArrow(dl, mid + new Vector2(1, 1), r.Bearing - heading, Shadow, _k * 0.8f);
|
||||
DrawArrow(dl, mid, r.Bearing - heading, Fade(StateColor(r), dim), _k * 0.8f);
|
||||
}
|
||||
else if (r.Measured)
|
||||
dl.AddCircleFilled(mid, Px(2f), col);
|
||||
x += Px(CharactersLook.ArrowWidth);
|
||||
ShadowClip(dl, r.DistanceText, x, ty, distW + 1, col, frameless);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The name's colour: its health's warning (amber low, red critical or dead), else the text colour.</summary>
|
||||
private static uint NameColor(CharacterRow r) => r.IsSelf ? Text : CharactersLook.Hp(r) switch
|
||||
{
|
||||
HpWarn.Dead or HpWarn.Critical => Red,
|
||||
HpWarn.Low => Highlight,
|
||||
HpWarn.Unknown when r.LoggedOut => Faded(Mute),
|
||||
_ => Text,
|
||||
};
|
||||
|
||||
private void DrawDot(ImDrawListPtr dl, Vector2 c, CharDot dot)
|
||||
{
|
||||
float r = Px(3f);
|
||||
switch (dot)
|
||||
{
|
||||
case CharDot.Off: dl.AddCircle(c, r, Faded(Mute), 12, Px(1.2f)); break;
|
||||
case CharDot.Stale: dl.AddCircle(c, r, Highlight, 12, Px(1.6f)); break;
|
||||
case CharDot.Self: dl.AddCircleFilled(c, r, Mute, 12); break;
|
||||
case CharDot.Dead: dl.AddCircleFilled(c, r, Red, 12); break;
|
||||
case CharDot.Portal: dl.AddCircleFilled(c, r, Purple, 12); break;
|
||||
case CharDot.Fighting: dl.AddCircleFilled(c, r, Highlight, 12); break;
|
||||
case CharDot.Botting: dl.AddCircleFilled(c, r, Green, 12); break;
|
||||
default: dl.AddCircleFilled(c, r, Faded(Mute), 12); break; // idle
|
||||
}
|
||||
}
|
||||
|
||||
private static void ThinBar(ImDrawListPtr dl, float x, float y, float w, float h, float fraction, uint color)
|
||||
{
|
||||
if (w <= 1) return;
|
||||
fraction = float.IsFinite(fraction) ? Math.Clamp(fraction, 0f, 1f) : 0f;
|
||||
dl.AddRectFilled(new Vector2(x, y), new Vector2(x + w, y + h), WithAlpha(BarBg, 0xD0), 1);
|
||||
if (fraction > 0) dl.AddRectFilled(new Vector2(x, y), new Vector2(x + w * fraction, y + h), color, 1);
|
||||
}
|
||||
|
||||
/// <summary>Text clipped to <paramref name="width"/>, with a 1 px shadow when it sits over the game.</summary>
|
||||
private static void ShadowClip(ImDrawListPtr dl, string text, float x, float y, float width, uint color, bool shadow)
|
||||
{
|
||||
if (text.Length == 0 || width <= 0) return;
|
||||
dl.PushClipRect(new Vector2(x, y - 2), new Vector2(x + width + 1, y + 40), true);
|
||||
if (shadow) dl.AddText(new Vector2(x + 1, y + 1), Shadow, text);
|
||||
dl.AddText(new Vector2(x, y), color, text);
|
||||
dl.PopClipRect();
|
||||
}
|
||||
|
||||
// ── Top line ────────────────────────────────────────────────────────
|
||||
|
||||
private void DrawTop(CharactersView view, float w)
|
||||
private void DrawTop(CharactersView view, float w, bool minimalButton)
|
||||
{
|
||||
Vector2 start = ImGui.GetCursorScreenPos();
|
||||
float h = Px(20), iconW = Px(22);
|
||||
int icons = minimalButton ? 3 : 2;
|
||||
float fontH = ImGui.GetFontSize();
|
||||
ImDrawListPtr dl = ImGui.GetWindowDrawList();
|
||||
float textW = Math.Max(10, w - 2 * iconW - Px(8));
|
||||
float textW = Math.Max(10, w - icons * iconW - Px(4) * icons);
|
||||
dl.PushClipRect(start, start + new Vector2(textW, h), true);
|
||||
dl.AddText(new Vector2(start.X, start.Y + (h - fontH) * 0.5f), Mute, view.Status);
|
||||
dl.PopClipRect();
|
||||
|
||||
float bx = start.X + w - 2 * iconW - Px(4);
|
||||
float bx = start.X + w - icons * iconW - Px(4) * (icons - 1);
|
||||
if (minimalButton)
|
||||
{
|
||||
if (IconButton("##chars_minimal", RynthIcons.ArrowsInLineVertical, new Vector2(bx, start.Y), new Vector2(iconW, h), Text, ButtonFill,
|
||||
font: RynthUiFont.Ui11))
|
||||
_setView(CharactersViewMode.Minimal);
|
||||
ImGui.SetItemTooltip("Minimal: one line per character (/rn view minimal)");
|
||||
bx += iconW + Px(4);
|
||||
}
|
||||
bool canFollow = view.MyName.Length > 0;
|
||||
if (IconButton("##chars_followall", RynthIcons.Footprints, new Vector2(bx, start.Y), new Vector2(iconW, h), Text, ButtonFill,
|
||||
enabled: canFollow, font: RynthUiFont.Ui11))
|
||||
|
|
|
|||
|
|
@ -37,8 +37,9 @@ public static unsafe class PluginExports
|
|||
{
|
||||
try
|
||||
{
|
||||
if (Runtime.Plugin == null) return IntPtr.Zero;
|
||||
string json = Characters.CharactersManifest.Json;
|
||||
RynthNetPlugin? plugin = Runtime.Plugin;
|
||||
if (plugin == null) return IntPtr.Zero;
|
||||
string json = Characters.CharactersManifest.For(plugin.FramelessWindows);
|
||||
if (json == _sectionsJson && _sectionsPtr != IntPtr.Zero) return _sectionsPtr;
|
||||
_sectionsJson = json;
|
||||
IntPtr fresh = Marshal.StringToCoTaskMemUTF8(json);
|
||||
|
|
@ -64,9 +65,10 @@ public static unsafe class PluginExports
|
|||
{
|
||||
if (surface == null) return 0;
|
||||
string name = Marshal.PtrToStringUTF8((IntPtr)surface) ?? string.Empty;
|
||||
if (name.EndsWith(":popout", StringComparison.Ordinal)) name = name[..^":popout".Length];
|
||||
bool popped = name.EndsWith(":popout", StringComparison.Ordinal);
|
||||
if (popped) name = name[..^":popout".Length];
|
||||
RynthNetPlugin? plugin = Runtime.Plugin;
|
||||
if (plugin == null || !plugin.RenderEmbed(name, out float wantH)) return 0;
|
||||
if (plugin == null || !plugin.RenderEmbed(name, popped, out float wantH)) return 0;
|
||||
if (wantWidth != null) *wantWidth = width;
|
||||
if (wantHeight != null) *wantHeight = wantH > 0 ? wantH : height;
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,11 @@
|
|||
// second while it is on screen (Characters/CharactersRows.cs). The window's
|
||||
// clicks are queued here and run on the tick: selecting a character, and /rn
|
||||
// tell / followme through the same queue as typed commands.
|
||||
//
|
||||
// Its look (2026-10-31): minimal (the default) or full, per character in
|
||||
// settings.json, switched by the window's own button or /rn view. On an engine
|
||||
// with frameless windows (v90) the window has no engine frame and RynthNet
|
||||
// draws both looks; on an older one the minimal look draws inside the frame.
|
||||
// ============================================================================
|
||||
|
||||
using System;
|
||||
|
|
@ -35,22 +40,67 @@ public sealed partial class RynthNetPlugin
|
|||
private readonly ConcurrentQueue<Action> _uiActions = new();
|
||||
private HostGame? _game;
|
||||
|
||||
/// <summary>The look the window draws now (render thread reads; the tick and /rn view set it).</summary>
|
||||
private volatile int _charsMode = (int)CharactersViewMode.Minimal;
|
||||
|
||||
/// <summary>The engine hosts frameless windows (v90): the manifest asks for one and RynthNet draws every frame.</summary>
|
||||
internal bool FramelessWindows => Host.HasFramelessWindows;
|
||||
|
||||
internal CharactersViewMode CharsLook => (CharactersViewMode)_charsMode;
|
||||
|
||||
/// <summary>RynthPluginRenderEmbed: draws <paramref name="surface"/> (":popout" already off). Render thread.</summary>
|
||||
internal bool RenderEmbed(string surface, out float wantHeight)
|
||||
internal bool RenderEmbed(string surface, bool popped, out float wantHeight)
|
||||
{
|
||||
wantHeight = 0;
|
||||
if (!surface.Equals(CharactersSurface, StringComparison.Ordinal)) return false;
|
||||
System.Threading.Volatile.Write(ref _charsDrawnMs, Environment.TickCount64);
|
||||
AtlasNames.EnsureLoading(Path.Combine(RynthInstallPaths.CoreDir, "NavData", "locations.json"));
|
||||
_charsWindow ??= new CharactersWindow(
|
||||
Host,
|
||||
select: id => _uiActions.Enqueue(() => { if (id != 0) Host.SelectItem(id); }),
|
||||
tell: (name, command) => _localCommands.Enqueue(("/rn tell " + name + ", " + command, false)),
|
||||
followMeAll: () => _localCommands.Enqueue(("/rn followme", false)),
|
||||
heading: CompassHeading);
|
||||
_charsWindow.Draw(_charsView);
|
||||
heading: CompassHeading,
|
||||
setView: mode => _uiActions.Enqueue(() => SetCharactersView(mode, quiet: true)));
|
||||
wantHeight = _charsWindow.Draw(_charsView, CharsLook, FramelessWindows, popped);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets this character's window look and saves it (merged with the other clients' settings). Pump
|
||||
/// thread. Quiet (the window's own button): nothing in chat unless it couldn't be saved.
|
||||
/// </summary>
|
||||
private bool SetCharactersView(CharactersViewMode mode, bool quiet)
|
||||
{
|
||||
if (!_loggedIn)
|
||||
{
|
||||
// Before login there is no character to keep it for: this session only.
|
||||
_charsMode = (int)mode;
|
||||
return true;
|
||||
}
|
||||
string key = CharacterKey;
|
||||
string name = CharactersLook.Name(mode);
|
||||
if (!UpdateSettings(s => s.Character(key).View = name)) return false;
|
||||
_charsMode = (int)mode;
|
||||
if (!quiet) Host.Log("[RynthNet] Characters window: " + name + " view.");
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>/rn view [minimal|full|toggle]. Pump thread.</summary>
|
||||
private void ViewCommand(string args)
|
||||
{
|
||||
ViewAnswer a = CharactersLook.Command(args, CharsLook, _loggedIn);
|
||||
if (!a.Ok) { ChatFail(a.Reply); return; }
|
||||
if (a.Changed && !SetCharactersView(a.Next, quiet: false)) return; // UpdateSettings said why
|
||||
ChatLine(a.Reply);
|
||||
}
|
||||
|
||||
/// <summary>The look saved for the character logged in here (after login and when the file changes). Pump thread.</summary>
|
||||
private void SyncCharactersView()
|
||||
{
|
||||
if (_loggedIn) _charsMode = (int)_settings.ViewFor(CharacterKey);
|
||||
}
|
||||
|
||||
/// <summary>Plugin tick: the window's queued clicks, and its rows while it is on screen.</summary>
|
||||
private void TickCharacters()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -82,6 +82,9 @@ public sealed partial class RynthNetPlugin
|
|||
case "remote":
|
||||
RemoteCommand(args);
|
||||
break;
|
||||
case "view": // the Characters window's look: minimal (the default) or full
|
||||
ViewCommand(args);
|
||||
break;
|
||||
case "allow":
|
||||
ListSetting(p => p.Allow, "allow", args, "remote commands run only if they start with one of these (empty = all)");
|
||||
break;
|
||||
|
|
@ -179,6 +182,7 @@ public sealed partial class RynthNetPlugin
|
|||
ChatLine("/rn followme [tag] - the others /ra follow you; /rn usesel [tag] - they use your selection");
|
||||
ChatLine("/rn status - this client; /rn remote on|off|default - run others' commands on this character");
|
||||
ChatLine("/rn allow|deny|trust [list | add <x> | remove <x> | clear] - what may run here");
|
||||
ChatLine("/rn view [minimal|full] - the Characters window: one line each, or every column (kept per character)");
|
||||
ChatLine("UtilityBelt's /ub bc, /ub bct and /ub netclients work too.");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -230,6 +230,7 @@ public sealed partial class RynthNetPlugin : RynthPluginBase
|
|||
bool wasLoggedIn = _loggedIn;
|
||||
_loggedIn = true;
|
||||
PushIdentity();
|
||||
SyncCharactersView();
|
||||
if (!wasLoggedIn) _nextStatusMs = 0;
|
||||
}
|
||||
|
||||
|
|
@ -293,6 +294,7 @@ public sealed partial class RynthNetPlugin : RynthPluginBase
|
|||
_settings = RynthNetSettings.Load(out string? error);
|
||||
if (error != null) Host.Log("[RynthNet] " + error);
|
||||
PushIdentity();
|
||||
SyncCharactersView(); // the file edited by hand: its view too
|
||||
}
|
||||
|
||||
// ── Network events ──────────────────────────────────────────────────────
|
||||
|
|
|
|||
|
|
@ -15,8 +15,11 @@
|
|||
// "logRemoteCommands": true,
|
||||
// "statusIntervalMs": 1000,
|
||||
// "defaults": { "acceptRemoteCommands": true, "allow": [], "deny": [], "trustedSenders": [] },
|
||||
// "characters": { "World|Name": { "tags": ["healer"], "policy": { ...same as defaults... } } }
|
||||
// "characters": { "World|Name": { "tags": ["healer"], "policy": { ...same as defaults... },
|
||||
// "view": "full" } }
|
||||
// }
|
||||
// "view" is how that character's Characters window looks (minimal, the default
|
||||
// when missing, or full: Characters/CharactersLook.cs, /rn view).
|
||||
// ============================================================================
|
||||
|
||||
using System;
|
||||
|
|
@ -24,6 +27,8 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using CharactersLook = RynthCore.Plugin.RynthNet.Characters.CharactersLook;
|
||||
using CharactersViewMode = RynthCore.Plugin.RynthNet.Characters.CharactersViewMode;
|
||||
|
||||
namespace RynthCore.Plugin.RynthNet;
|
||||
|
||||
|
|
@ -53,6 +58,8 @@ internal sealed class RynthNetCharacter
|
|||
public List<string> Tags = new();
|
||||
/// <summary>This character's own policy; null = the defaults.</summary>
|
||||
public RynthNetPolicy? Policy;
|
||||
/// <summary>The Characters window's look for this character ("minimal" / "full"); null = the default (minimal).</summary>
|
||||
public string? View;
|
||||
}
|
||||
|
||||
internal sealed class RynthNetSettings
|
||||
|
|
@ -79,6 +86,10 @@ internal sealed class RynthNetSettings
|
|||
public IReadOnlyList<string> TagsFor(string key)
|
||||
=> Characters.TryGetValue(key, out RynthNetCharacter? c) ? c.Tags : Array.Empty<string>();
|
||||
|
||||
/// <summary>The Characters window's look for the character (minimal when it has none saved).</summary>
|
||||
public CharactersViewMode ViewFor(string key)
|
||||
=> Characters.TryGetValue(key, out RynthNetCharacter? c) ? CharactersLook.FromSetting(c.View) : CharactersViewMode.Minimal;
|
||||
|
||||
/// <summary>The character's entry, created when missing.</summary>
|
||||
public RynthNetCharacter Character(string key)
|
||||
{
|
||||
|
|
@ -184,6 +195,9 @@ internal sealed class RynthNetSettings
|
|||
var c = new RynthNetCharacter { Tags = Strings(p.Value, "tags") };
|
||||
if (p.Value.TryGetProperty("policy", out JsonElement pol) && pol.ValueKind == JsonValueKind.Object)
|
||||
c.Policy = ParsePolicy(pol);
|
||||
if (p.Value.TryGetProperty("view", out JsonElement view) && view.ValueKind == JsonValueKind.String
|
||||
&& CharactersLook.TryParse(view.GetString(), out CharactersViewMode mode))
|
||||
c.View = CharactersLook.Name(mode);
|
||||
s.Characters[p.Name] = c;
|
||||
}
|
||||
}
|
||||
|
|
@ -211,7 +225,7 @@ internal sealed class RynthNetSettings
|
|||
w.WriteStartObject("characters");
|
||||
foreach (var kv in Characters)
|
||||
{
|
||||
if (kv.Value.Tags.Count == 0 && kv.Value.Policy == null) continue;
|
||||
if (kv.Value.Tags.Count == 0 && kv.Value.Policy == null && kv.Value.View == null) continue;
|
||||
w.WriteStartObject(kv.Key);
|
||||
WriteList(w, "tags", kv.Value.Tags);
|
||||
if (kv.Value.Policy != null)
|
||||
|
|
@ -219,6 +233,7 @@ internal sealed class RynthNetSettings
|
|||
w.WritePropertyName("policy");
|
||||
WritePolicy(w, kv.Value.Policy);
|
||||
}
|
||||
if (kv.Value.View != null) w.WriteString("view", kv.Value.View);
|
||||
w.WriteEndObject();
|
||||
}
|
||||
w.WriteEndObject();
|
||||
|
|
|
|||
Loading…
Reference in a new issue