Table of Contents

Class HotKeyBase

Namespace
Bannerlord.ButterLib.HotKeys
Assembly
Bannerlord.ButterLib.dll

Base type for all HotKey definitions to derive from.

public abstract class HotKeyBase
Inheritance
HotKeyBase
Inherited Members

Constructors

HotKeyBase(string)

The required constructor which has the bare minimum needed to register a key.

protected HotKeyBase(string uid)

Parameters

uid string

The (unique to your mod) id for your hotkey.

HotKeyBase(string, string, string, InputKey, string)

protected HotKeyBase(string uid, string displayName, string description, InputKey defaultKey, string category)

Parameters

uid string
displayName string
description string
defaultKey InputKey
category string

Properties

Category

The Category in the options menu under which this hotkey will appear. Categories

protected virtual string Category { get; }

Property Value

string

DefaultKey

The default key for your HotKey, if this is not set in your constructor it will default to Invalid

protected virtual InputKey DefaultKey { get; }

Property Value

InputKey

Description

The description text that will appear in the options menu next to your hotkey.

protected virtual string Description { get; }

Property Value

string

DisplayName

The display name for your hotkey that will appear in the options menu.

protected virtual string DisplayName { get; }

Property Value

string

IsEnabled

Tells the input manager whether or not to process input for this key. Setting this infrequently is cheaper than using Predicate but it is less convenient.

public bool IsEnabled { get; set; }

Property Value

bool

Predicate

Provide none, one or many functions which all must evaluate to true in order for the key to process input. This does not need to be set, and can be reset with Predicate = null;

public Func<bool>? Predicate { get; set; }

Property Value

Func<bool>

Uid

The unique (to your mod) Id for this hotkey.

protected string Uid { get; }

Property Value

string

Methods

IsDown()

Called once every frame a key remains down.

protected virtual void IsDown()

IsDownAndReleased()

protected virtual void IsDownAndReleased()

OnPressed()

Called once on the frame a key was pressed.

protected virtual void OnPressed()

OnReleased()

Called once on the frame a key was released.

protected virtual void OnReleased()

Events

IsDownAndReleasedEvent

Called once they key was pressed and released.

public event Action? IsDownAndReleasedEvent

Event Type

Action

IsDownEvent

Called once every frame a key remains down.

public event Action? IsDownEvent

Event Type

Action

OnPressedEvent

Called once on the frame a key was pressed.

public event Action? OnPressedEvent

Event Type

Action

OnReleasedEvent

Called once on the frame a key was released.

public event Action? OnReleasedEvent

Event Type

Action

Operators

implicit operator GameKey(HotKeyBase)

Allows you to supply a HotKeyBase derived class wherever a GameKey might normally be used.

public static implicit operator GameKey(HotKeyBase hotKey)

Parameters

hotKey HotKeyBase

HotKeyBase to convert.

Returns

GameKey

The Bannerlord.ButterLib.HotKeys.HotKeyBase.GameKey stored internally.