YaInputAPI¶
YaInputAPI manages user input.Functions¶
number YaInputAPI.OnAllTargetKeyDown(function callback<YaEntity, number>)¶
Returnsevent id
Listen for keyboard events for all players
callbackcallback funcentityThe input entitycodeCodeYaInputCode
1 2 3 4 5 | |
number YaInputAPI.OnAllTargetKeyUp(function callback<YaEntity, number>)¶
Returnsevent id
Listen for keyboard events for all players
callbackcallback funcentityThe input entitycodeCodeYaInputCode
1 2 3 4 5 | |
number YaInputAPI.OnKeyDown(YaEntity entity, function callback<YaEntity, number>)¶
Returnsevent id
Listens for keyboard events on an avatar entity or a tool equipped on an avatar entity.
entityThe input entitycallbackcallback funcentityThe input entitycodeCodeYaInputCode
1 2 3 4 5 | |
number YaInputAPI.OnKeyUp(YaEntity entity, function callback<YaEntity, number>)¶
Returnsevent id
Listens for keyboard events on an avatar entity or a tool equipped on an avatar entity.
entityThe input entitycallbackcallback funcYaEntityThe input entityKeycodeYaKeycode
1 2 3 4 5 | |
void YaInputAPI.Move(YaEntity entity, float3 vector, boolean sprint)¶
SERVER ONLY
Set the movement input of the current entity
entityEntity that accepts inputvectorVector 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 spacesprintWhether to sprint
void YaInputAPI.StopMove(YaEntity entity)¶
SERVER ONLY
Stop mobile typing
entityEntity 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
entityEntity 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
entityEntity that accepts input
float2 YaInputAPI.GetLocalLeftJoystickValue()¶
CLIENT ONLY
Returnsa float2 containing the x and y directional input values of the left joystick.
Gets the input value of the left joystick for the local player.
number YaInputAPI.OnMousePress(function callback<number, float2>)¶
CLIENT ONLY
Returnsevent id
Fired when the local character entity press the mouse. This API only works for device with mouse
callbackcallback funccodeCodeYaInputCode screenPositionThe position of mouse in screen position
number YaInputAPI.OnMouseRelease(function callback<number, float2>)¶
CLIENT ONLY
Returnsevent id
Fired when the local character entity release the mouse. This API only works for device with mouse
callbackcallback funccodeCodeYaInputCode screenPositionThe position of mouse in screen position
number YaInputAPI.OnMouseScroll(function callback<number, float2>)¶
CLIENT ONLY
Returnsevent id
callbackcallback funccodeCodeYaInputCode scroll deltaThe mouse scroll delta
number YaInputAPI.OnFingerDown(function callback<number, float2>)¶
CLIENT ONLY
Returnsevent id
Fired when the local character entity use finger press down to the screen. This API only works for device with touch screen
callbackcallback funcfingerIndexThe index of fingerscreenPositionThe position of finger in screen position
number YaInputAPI.OnFingerMove(function callback<number, float2>)¶
CLIENT ONLY
Returnsevent id
Fired when the local character entity use finger move on the screen. This API only works for device with touch screen
callbackcallback funcfingerIndexThe index of fingerscreenPositionThe position of finger in screen position
number YaInputAPI.OnFingerUp(function callback<number, float2>)¶
CLIENT ONLY
Returnsevent id
Fired when the local character entity use finger press up from the screen. This API only works for device with touch screen
callbackcallback funcfingerIndexThe index of fingerscreenPositionThe 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