Table of Contents

Interface IKeyCapture

Namespace
BSGameLib.UI
Assembly
BSGameLib.UI.dll

Takes the next key the player presses instead of letting the UI act on it - for a "press a key" prompt when rebinding.

public interface IKeyCapture

Remarks

While a capture is waiting the UI root hands the keyboard to it and nothing else: the focused control gets no keys, Enter does not press the default button, Tab does not move focus and Escape does not back out of the view. Escape cancels the capture rather than being captured, so there is always a way out, and a click anywhere cancels it too.

Properties

IsCapturing

Whether a capture is waiting for a key.

bool IsCapturing { get; }

Property Value

bool

Methods

Begin(Action<CapturedKey>, Action)

Waits for the next key. captured or cancelled is called once, on the game thread, and the capture ends. Beginning a new capture cancels one already waiting.

void Begin(Action<CapturedKey> captured, Action cancelled = null)

Parameters

captured Action<CapturedKey>
cancelled Action

Cancel()

Stops waiting, calling the capture's cancelled callback. Nothing if none is waiting.

void Cancel()