Skip to content

Panel

public sealed class Panel

Namespace Snitch.Api

Fluent builder for a mod’s Snitch panel (returned by RegisterPanel). Counters/state added here get an id of ”.” so they group under the panel automatically. Everything is a safe no-op when the Snitch host is absent.

public string Id { get; }

The panel id (also the default log channel).

public Panel Counter(string name, Func<double> read, string unit = null)

A numeric gauge shown in this panel. Registered as ”.”.

public Panel State(Func<StateSnapshot> snapshot)

A state distribution shown in this panel (uses the panel id).

public Panel State(string name, Func<StateSnapshot> snapshot)

A named state distribution shown in this panel. Registered as ”.”.

public Panel Text(Func<string> provider)

A free-text, multi-line readout in this panel.

public Panel Action(string label, Action run)

A clickable button (replaces a debug hotkey action).

public Panel Toggle(string label, Func<bool> get, Action<bool> set)

An on/off control (replaces a debug toggle hotkey).

public Panel Slider(
string label,
double min,
double max,
Func<double> get,
Action<double> set,
double step = 0d,
string unit = null)

A draggable value (replaces typing a number into a console to find it). The host clamps to the range and snaps to step before your setter sees it.

public Panel Log()

Show this panel’s own log channel inside the panel.

public void Write(string message, LogLevel level = LogLevel.Info)

Send a log line to this panel’s channel (and the combined timeline).