YaInputAPI¶
YaInputAPI
manages user input.Functions¶
void YaInputAPI.OnAllTargetKeyDown(function callback<YaEntity, number>)¶
Listen for keyboard events for all players
callback
callback funcentity
The input entitycode
CodeYaInputCode
1 2 3 4 5 |
|
void YaInputAPI.OnAllTargetKeyUp(function callback<YaEntity, number>)¶
Listen for keyboard events for all players
callback
callback funcentity
The input entitycode
CodeYaInputCode
1 2 3 4 5 |
|
void YaInputAPI.OnKeyDown(YaEntity entity, function callback<YaEntity, number>)¶
Listens for keyboard events on an avatar entity or a tool equipped on an avatar entity.
entity
The input entitycallback
callback funcentity
The input entitycode
CodeYaInputCode
1 2 3 4 5 |
|
void YaInputAPI.OnKeyUp(YaEntity entity, function callback<YaEntity, number>)¶
Listens for keyboard events on an avatar entity or a tool equipped on an avatar entity.
entity
The input entitycallback
callback funcYaEntity
The input entityKeycode
YaKeycode
1 2 3 4 5 |
|
void YaInputAPI.Move(YaEntity entity, float3 vector, boolean sprint)¶
SERVER ONLY
Set the movement input of the current entity
entity
Entity that accepts inputvector
Vector input vector. The meaning of the actual vector is determined by the entity, usually the character represents the world space, and the vehicle is the local spacesprint
Whether to sprint
void YaInputAPI.StopMove(YaEntity entity)¶
SERVER ONLY
Stop mobile typing
entity
Entity that accepts input
void YaInputAPI.Jump(YaEntity entity)¶
SERVER ONLY
Execute the jump input of the current entity, if there is no jump, it has no effect
entity
Entity that accepts input
void YaInputAPI.Attack(YaEntity entity)¶
SERVER ONLY
Execute the attack input of the current entity, if there is no attack action Ability, it will not be executed
entity
Entity that accepts input
void YaInputAPI.OnMousePress(function callback<number, float2>)¶
CLIENT ONLY
Fired when the local character entity press the mouse. This API only works for device with mouse
callback
callback funccode
CodeYaInputCode screenPosition
The position of mouse in screen position
void YaInputAPI.OnMouseRelease(function callback<number, float2>)¶
CLIENT ONLY
Fired when the local character entity release the mouse. This API only works for device with mouse
callback
callback funccode
CodeYaInputCode screenPosition
The position of mouse in screen position
void YaInputAPI.OnFingerDown(function callback<number, float2>)¶
CLIENT ONLY
Fired when the local character entity use finger press down to the screen. This API only works for device with touch screen
callback
callback funcfingerIndex
The index of fingerscreenPosition
The position of finger in screen position
void YaInputAPI.OnFingerMove(function callback<number, float2>)¶
CLIENT ONLY
Fired when the local character entity use finger move on the screen. This API only works for device with touch screen
callback
callback funcfingerIndex
The index of fingerscreenPosition
The position of finger in screen position
void YaInputAPI.OnFingerUp(function callback<number, float2>)¶
CLIENT ONLY
Fired when the local character entity use finger press up from the screen. This API only works for device with touch screen
callback
callback funcfingerIndex
The index of fingerscreenPosition
The position of finger in screen position
float2 YaInputAPI.GetMousePosition()¶
CLIENT ONLY
ReturnsThe position of cursor position
Get the local character mouse position. This API only works for device with mouse
boolean YaInputAPI.HasMouse()¶
CLIENT ONLY
ReturnsHas cursor
If the device has mouse, it returns true.
boolean YaInputAPI.HasTouchScreen()¶
CLIENT ONLY
ReturnsHas touch screen
If the device has touch screen, it returns true