Skip to content

Panel

public sealed class Panel

Namespace Hotline.Api

Fluent builder for a mod’s Hotline panel (returned by Hud.RegisterPanel). Everything is a safe no-op when the Hotline host is absent.

Example

Panel panel = Hud.RegisterPanel("MyMod", "My Mod").Log();
panel.Write("reloaded", LogLevel.Warning);
public string Id { get; }

The panel id (also the default log channel).

public Panel Text(Func<string> provider)

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

public Panel Image(Func<int[]> provider)

An image in this panel (e.g. a QR code). Provider returns { width, height, argb… } or null.

Parameter
providerReturns { width, height, 0xAARRGGBB pixels... }; see Hud.RegisterImage.
public Panel Action(string label, Action run)

A clickable button (replaces a debug hotkey action).

Parameter
labelThe button text, e.g. “Reload”. It also forms the action id, e.g. MyMod:reload.
runRuns on each click or hotline act call.
public Panel Toggle(string label, Func<bool> get, Action<bool> set)

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

Parameter
labelThe control text, e.g. “Verbose”. It also forms the toggle id, e.g. MyMod:verbose.
getReturns the current state.
setApplies the new state.
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).

Parameter
labelThe text before the value. It also forms the slider id, e.g. MyMod:spawn-radius.
minThe lowest value.
maxThe highest value. It must be above min.
getReturns the current value.
setApplies a value that is already clamped and snapped.
stepThe snap size, e.g. 0.05. 0 is continuous. See Hud.RegisterSlider.
unitText shown after the value, e.g. “m”. Null shows none.
public Panel Hotkey(string label, HotlineKey key, Action run)

Types: HotlineKey

Bind a central hotkey to an action owned by this panel.

Parameter
labelNames the binding, e.g. “Reload”. The same label again replaces it.
keyOne of F1 to F12, or HotlineKey.None for a label without a key.
runRuns when the key goes down.
public Panel Log()

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

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

Types: LogLevel

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