Skip to content

Class KeybindOverlay

Definition

Namespace: StardewUI.Widgets.Keybinding
Assembly: StardewUI.dll

Overlay control for editing a keybinding, or list of bindings.

public class KeybindOverlay : StardewUI.Overlays.FullScreenOverlay

Inheritance
ObjectFullScreenOverlay ⇦ KeybindOverlay

Members

Constructors

Name Description
KeybindOverlay(ISpriteMap<SButton>) Overlay control for editing a keybinding, or list of bindings.

Properties

Name Description
AddButtonText Text to display on the button used to add a new binding.
CapturingInput Whether the overlay wants to capture all keyboard and gamepad inputs, i.e. prevent them from being dispatched to the parent menu.
(Inherited from FullScreenOverlay)
DeleteButtonTooltip Tooltip to display for the delete (trash can) button beside each existing binding.
DimmingAmount Amount to dim whatever is underneath the overlay.
(Inherited from FullScreenOverlay)
HorizontalAlignment Horizontal alignment of the overlay relative to the Parent edge.
(Inherited from FullScreenOverlay)
HorizontalParentAlignment Specifies which edge of the Parent (or screen, if no parent is specified) will be used to align the overlay edge denoted by its HorizontalAlignment.
(Inherited from FullScreenOverlay)
KeybindList The current keybinds to display in the list.
KeybindType Specifies what kind of keybind is being edited.
Parent The parent of this overlay, used for positioning. If not specified, then the overlay will be positioned relative to the entire UI viewport.
(Inherited from FullScreenOverlay)
ParentOffset Additional pixel offset to apply to the overlay's position, after alignments.
(Inherited from FullScreenOverlay)
VerticalAlignment Vertical alignment of the overlay relative to the Parent edge.
(Inherited from FullScreenOverlay)
VerticalParentAlignment Specifies which edge of the Parent (or screen, if no parent is specified) will be used to align the overlay edge denoted by its VerticalAlignment.
(Inherited from FullScreenOverlay)
View The view to be displayed/interacted with as an overlay.
(Inherited from FullScreenOverlay)

Methods

Name Description
CreateView() Creates the content view that will be displayed as an overlay.
(Overrides FullScreenOverlay.CreateView())
OnClose() Runs when the overlay is removed from the active stack.
(Inherited from FullScreenOverlay)
RequireView<TChild>(Func<TChild>) Ensures that the overlay view is created before attempting to access a child view.
(Inherited from FullScreenOverlay)
StartCapturing() Starts capturing a new keybind.
Update(TimeSpan) Runs on every game update tick.
(Overrides FullScreenOverlay.Update(TimeSpan))

Events

Name Description
Close Event raised when the overlay is closed - i.e. removed from the current context stack.
(Inherited from FullScreenOverlay)

Details

Constructors

KeybindOverlay(ISpriteMap<SButton>)

Overlay control for editing a keybinding, or list of bindings.

public KeybindOverlay(StardewUI.Graphics.ISpriteMap<StardewModdingAPI.SButton> spriteMap);
Parameters

spriteMap   ISpriteMap
Map of bindable buttons to sprite representations.


Properties

AddButtonText

Text to display on the button used to add a new binding.

public string AddButtonText { get; set; }
Property Value

string

Remarks

If not specified, the button will use a generic "+" image instead.


DeleteButtonTooltip

Tooltip to display for the delete (trash can) button beside each existing binding.

public string DeleteButtonTooltip { get; set; }
Property Value

string

Remarks

If not specified, the delete buttons will have no tooltips.


KeybindList

The current keybinds to display in the list.

public StardewModdingAPI.Utilities.KeybindList KeybindList { get; set; }
Property Value

KeybindList


KeybindType

Specifies what kind of keybind is being edited.

public StardewUI.Widgets.Keybinding.KeybindType KeybindType { get; set; }
Property Value

KeybindType

Remarks

This determines the behavior of the capturing as well as what happens after capture:

  • MultipleKeybinds displays the list of existing keybinds (if any), adds the captured keybind when all buttons/keys are released, and allows adding more;
  • SingleKeybind does not display the list or separator, and when all buttons/keys are released, updates its KeybindList to have that single keybind and closes the overlay.
  • SingleButton is similar to SingleKeybind but records the keybind and closes the overlay as soon as a single button is pressed.

Typically when using single-bind or single-button modes, the caller should StartCapturing() upon creation of the overlay in order to minimize redundant clicks.


Methods

CreateView()

Creates the content view that will be displayed as an overlay.

protected override StardewUI.IView CreateView();
Returns

IView


StartCapturing()

Starts capturing a new keybind.

public void StartCapturing();
Remarks

This makes the capture area start flashing and hides the "Add" button; any buttons pressed in the capturing state are recorded and combined into a single keybind after the capture ends, when all buttons are released.


Update(TimeSpan)

Runs on every game update tick.

public override void Update(System.TimeSpan elapsed);
Parameters

elapsed   TimeSpan
The amount of real time elapsed since the last tick.