Input
Last updated
Was this helpful?
Last updated
Was this helpful?
Input
这个静态类型用来提供输入功能。基本的输入系统并不是基于事件绑定的,而是采用轮询的方式。这部分内容比较直观,一般来说看函数名就知道用法,但也会有几个坑。
There's a number of useful methods that detect keys being pressed down in different ways, all seeming to return a 'bool'. Most common are IsKeyDown
, IsKeyPressed
and IsKeyReleased
You can call them like so: Input.IsKeyDown(InputKey.TheKeyCode)
. See here for a list of all keycodes:
You can also use the extension methods IsDown
/IsPressed
/IsReleased
as such KeyCode.A.IsPressed()
Below, you may find an in-depth documentation of each.
This page assumes an import like so: using TaleWorlds.InputSystem;
This checks to see if the specified [key] is currently being pressed, it returns true as long as the [key] is held down.
Example:
This acts as an intermediary check between IsKeyDown
and IsKeyPressed
Example:
This checks to see if the specified [key] has been pressed, it returns a bool once.
Example:
This checks to see if the specified [key] is not currently being pressed, it returns a bool once.
Example:
I do not believe there is any other method more self-explanatory than this. Returns true while neither Control or Shift are down.
Checks to see if a they specified [key] is currently pressed. Unlike IsDown, it can be used as Input.IsPressed() but not as an extension.
Checks and returns the current state of the specified [key] as a Vector2. I am not aware how this can be used.
Example:
Returns the text currently existing in the user's clipboard as a string.
Checks to see if the mouse is currently active, if so returns true
.
Checks to see if the mouse scroll wheel is currently rotating, if so returns true
.
Returns the horizontal position of the mouse as a float.
Returns the vertical position of the mouse as a float.
As of Bannerlord 1.2.1 the following key codes are available: