Skip to content

Latest commit

 

History

History
563 lines (338 loc) · 22 KB

File metadata and controls

563 lines (338 loc) · 22 KB

KeybindLib

Contents

Bind type

Namespace

KeybindLib

Summary

A binding.

Remarks

Represents the various types of bindings accepted by .

BindDefault(action) method

Summary

Adds this instance as a default binding for the specified PlayerAction.

Parameters
Name Type Description
action InControl.PlayerAction The PlayerAction to bind to.

op_Implicit() method

Summary

Converts a Key to a Bind.

Parameters

This method has no parameters.

op_Implicit() method

Summary

Converts a InputControlType to a Bind.

Parameters

This method has no parameters.

op_Implicit() method

Summary

Converts a Mouse to a Bind.

Parameters

This method has no parameters.

ButtonBind type

Namespace

KeybindLib.Bind

Summary

A InputControlTypeBind.

#ctor() constructor

Summary

Creates a new Bind from a InputControlType.

Parameters

This constructor has no parameters.

BindDefault() method

Summary

Inherit from parent.

Parameters

This method has no parameters.

KeyAction type

Namespace

KeybindLib.Keybind

Summary

A delegate that runs when something interesting happens with a keybind.

Remarks

Event handler.

See Also

KeyActionRegisteredTooEarlyException type

Namespace

KeybindLib.KeybindRegistry

Summary

An exception thrown when a KeyAction is registered before this mod has been PreLoaded.

KeyAction property

Summary

The KeyAction that was registered too early.

KeyBind type

Namespace

KeybindLib.Bind

Summary

A KeyBind.

#ctor() constructor

Summary

Creates a new Bind from a Key.

Parameters

This constructor has no parameters.

BindDefault() method

Summary

Inherit from parent.

Parameters

This method has no parameters.

Keybind type

Namespace

KeybindLib

Summary

A keybind.

See Also

#ctor(name,comesBefore,defaultBinding,defaultBindings,translation,translations,keyPressed,keyReleased,keyDownUpdate) constructor

Summary

Creates a new Keybind.

Parameters
Name Type Description
name System.String The name of this instance.
comesBefore System.String The keybind that this one should come before.
defaultBinding KeybindLib.Bind The default keybind that applies to this instance.
defaultBindings KeybindLib.Bind[] The default keybinds that apply to this instance. Overrides defaultBinding.
translation System.String The english translation for this instance.
translations System.Collections.Generic.Dictionary{MessageDirector.Lang,System.String} The translations that apply to this instance. Overrides translation.
keyPressed KeybindLib.Keybind.KeyAction The KeyAction to run when this key is pressed.
keyReleased KeybindLib.Keybind.KeyAction The KeyAction to run when this key is released.
keyDownUpdate KeybindLib.Keybind.KeyAction The KeyAction to run every frame if this key is down.

BEGINNING_OF_LIST constants

Summary

A special string that can be used as ComesBefore to represent the beginning of the list.

KEYBIND_PREFIX constants

Summary

The expected prefix that every keybind's name should have.

Action property

Summary

This instance's .

Remarks

Only null during PreLoad.

ActionName property

Summary

The name of this keybind's corresponding PlayerAction.

ComesBefore property

Summary

The name of the vanilla keybind that should come after this instance.

Remarks

Indicates where in the list of keybinds this one should go.

See Also

DefaultBindings property

Summary

The default Binds for this instance.

Name property

Summary

This instance's name.

Remarks

Must start with `key.`.

Translations property

Summary

All translations that apply to this instance.

Remarks

If the Translatio API mod is not installed, only EN will apply.

BindAllDefaultsTo(action) method

Summary

Binds all DefaultBindings of this instance to the given PlayerAction.

Parameters
Name Type Description
action InControl.PlayerAction The PlayerAction to bind to.

RegisterTranslations() method

Summary

Registers this instance's Translations, with either the Translation API or SRML.

Parameters

This method has no parameters.

Remarks

Only registers english translations if the Translation API isn't available.

KeybindInvalidException type

Namespace

KeybindLib.KeybindRegistry

Summary

An exception thrown when an invalid Keybind is registered.

Keybind property

Summary

The invalid Keybind in question.

KeybindRegisteredTooLateException type

Namespace

KeybindLib.KeybindRegistry

Summary

An exception thrown when a Keybind is registered after this mod has been PreLoaded.

Keybind property

Summary

The Keybind that was registered too late.

KeybindRegistry type

Namespace

KeybindLib

Summary

Registers Keybinds and keeps track of metadata.

Register(keybind) method

Summary

Registers a Keybind.

Parameters
Name Type Description
keybind KeybindLib.Keybind The Keybind to register.
Exceptions
Name Description
KeybindLib.KeybindRegistry.KeybindInvalidException Thrown when keybind has an invalid Name or ComesBefore.
KeybindLib.KeybindRegistry.KeybindRegisteredTooLateException Thrown when this method is called after PreLoad.
Remarks

Registered keybinds must have a unique Name and a valid ComesBefore.

See Also

Register(keybinds) method

Summary

Inherit from parent.

Summary

Registers a collection of Keybinds.

Parameters
Name Type Description
keybinds System.Collections.Generic.IEnumerable{KeybindLib.Keybind} The Keybinds to register.
See Also

RegisterKeyAction(playerAction,keyAction,keyReleased) method

Summary

Registers a KeyAction for a PlayerAction that doesn't have it's own Keybind.

Parameters
Name Type Description
playerAction InControl.PlayerAction The PlayerAction to register this for.
keyAction KeybindLib.Keybind.KeyAction The KeyAction to run when the key is pressed.
keyReleased System.Boolean If set to true, runs when the key is released instead of when it's pressed.
Exceptions
Name Description
KeybindLib.KeybindRegistry.KeyActionRegisteredTooEarlyException Thrown when this method is called before PreLoad.
Remarks

You cannot register a KeyAction until after the PreLoad step.

Main type

Namespace

KeybindLib

Summary

This mod's entry point.

See Also

PreLoad() method

Summary

Applies all patches. Keybinds must be registered before this is called.

Parameters

This method has no parameters.

Remarks

Add "keybindlib" to your mod's "load_after" list to ensure this is called after your keybinds are registered.

See Also

MethodKeybindExtractor type

Namespace

KeybindLib

Summary

Parses vanilla methods to extract keybind information.

VanillaKeybinds property

Summary

The set of all valid vanilla keybind names.

Remarks

Mutating this object has no effect. Includes .

MouseBind type

Namespace

KeybindLib.Bind

Summary

A MouseBind.

#ctor() constructor

Summary

Creates a new Bind from a Mouse.

Parameters

This constructor has no parameters.

BindDefault() method

Summary

Inherit from parent.

Parameters

This method has no parameters.