Files
netease-modsdk-wiki/docs/mcdocs/1-ModAPI/接口/控制.md
2025-03-18 14:46:12 +08:00

1654 lines
41 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
sidebarDepth: 1
---
# 控制
# 索引
包括屏幕操作的相关接口
---
| 接口 | <div style="width: 3em"></div> | 描述 |
| --- | --- | --- |
| [AddPickBlacklist](控制.md#addpickblacklist) | <span style="display:inline;color:#7575f9">客户端</span> | 添加使用camera组件例如GetChosen接口、PickFacing接口选取实体时的黑名单即该实体不会被选取到 |
| [ClearPickBlacklist](控制.md#clearpickblacklist) | <span style="display:inline;color:#7575f9">客户端</span> | 清除使用camera组件例如GetChosen接口、PickFacing接口选取实体的黑名单 |
| [GetChosen](控制.md#getchosen) | <span style="display:inline;color:#7575f9">客户端</span> | 获取屏幕点击位置的实体或方块信息通常与GetEntityByCoordEvent配合使用 |
| [GetChosenEntity](控制.md#getchosenentity) | <span style="display:inline;color:#7575f9">客户端</span> | 获取屏幕点击位置的实体id通常与GetEntityByCoordEvent配合使用 |
| [GetHoldTimeThresholdInMs](控制.md#getholdtimethresholdinms) | <span style="display:inline;color:#7575f9">客户端</span> | 获取长按判定时间,即按着屏幕多长时间会触发长按操作 |
| [GetInputVector](控制.md#getinputvector) | <span style="display:inline;color:#7575f9">客户端</span> | 获取方向键(移动轮盘)的输入 |
| [GetMousePosition](控制.md#getmouseposition) | <span style="display:inline;color:#7575f9">客户端</span> | 获取鼠标位置 |
| [GetTouchPos](控制.md#gettouchpos) | <span style="display:inline;color:#7575f9">客户端</span> | 获取点击的屏幕坐标。可以监听TapBeforeClientEvent或TapOrHoldReleaseClientEvent事件调用本API获取点击坐标。 |
| [IsCanAttack](控制.md#iscanattack) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家是否响应攻击 |
| [IsCanChat](控制.md#iscanchat) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家是否响应聊天按钮 |
| [IsCanDrag](控制.md#iscandrag) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家是否响应屏幕拖动 |
| [IsCanInair](控制.md#iscaninair) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家是否响应打上升下降按钮 |
| [IsCanJump](控制.md#iscanjump) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家是否响应跳跃(以及在水中浮起) |
| [IsCanMove](控制.md#iscanmove) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家是否响应移动 |
| [IsCanOpenInv](控制.md#iscanopeninv) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家是否响应打开背包按钮 |
| [IsCanPause](控制.md#iscanpause) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家是否响应暂停按钮 |
| [IsCanPauseScreen](控制.md#iscanpausescreen) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家是否可以打开暂停界面 |
| [IsCanPerspective](控制.md#iscanperspective) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家是否响应切换视角 |
| [IsCanScreenShot](控制.md#iscanscreenshot) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家是否响应截图按钮 |
| [IsCanWalkMode](控制.md#iscanwalkmode) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家是否响应切换行走模式 |
| [IsTouchWithMouse](控制.md#istouchwithmouse) | <span style="display:inline;color:#7575f9">客户端</span> | 获取是否正在使用鼠标点击模拟触屏 |
| [LockInputVector](控制.md#lockinputvector) | <span style="display:inline;color:#7575f9">客户端</span> | 锁定本地玩家方向键(移动轮盘)的输入,可使本地玩家持续向指定方向前行,且不会再受玩家输入影响 |
| [LockVerticalMove](控制.md#lockverticalmove) | <span style="display:inline;color:#7575f9">客户端</span> | 模拟上升或下降,调用后一直上升或下降 |
| [PickFacing](控制.md#pickfacing) | <span style="display:inline;color:#7575f9">客户端</span> | 获取准星选中的实体或者方块 |
| [SetCanAll](控制.md#setcanall) | <span style="display:inline;color:#7575f9">客户端</span> | 同时设置SetCanMoveSetCanJumpSetCanAttackSetCanWalkModeSetCanPerspectiveSetCanPauseSetCanChatSetCanScreenShotSetCanOpenInvSetCanDragSetCanInair |
| [SetCanAttack](控制.md#setcanattack) | <span style="display:inline;color:#7575f9">客户端</span> | 设置是否响应攻击 |
| [SetCanChat](控制.md#setcanchat) | <span style="display:inline;color:#7575f9">客户端</span> | 设置是否响应聊天按钮 |
| [SetCanDrag](控制.md#setcandrag) | <span style="display:inline;color:#7575f9">客户端</span> | 设置是否响应屏幕拖动 |
| [SetCanInair](控制.md#setcaninair) | <span style="display:inline;color:#7575f9">客户端</span> | 设置是否响应上升下降按钮(飞在空中时右下角的三个按钮) |
| [SetCanJump](控制.md#setcanjump) | <span style="display:inline;color:#7575f9">客户端</span> | 设置是否响应跳跃(以及在水中浮起) |
| [SetCanMove](控制.md#setcanmove) | <span style="display:inline;color:#7575f9">客户端</span> | 设置是否响应移动 |
| [SetCanOpenInv](控制.md#setcanopeninv) | <span style="display:inline;color:#7575f9">客户端</span> | 设置是否响应打开背包按钮 |
| [SetCanPause](控制.md#setcanpause) | <span style="display:inline;color:#7575f9">客户端</span> | 设置是否响应暂停按钮 |
| [SetCanPauseScreen](控制.md#setcanpausescreen) | <span style="display:inline;color:#7575f9">客户端</span> | 设置是否可以打开暂停界面 |
| [SetCanPerspective](控制.md#setcanperspective) | <span style="display:inline;color:#7575f9">客户端</span> | 设置是否响应切换视角 |
| [SetCanScreenShot](控制.md#setcanscreenshot) | <span style="display:inline;color:#7575f9">客户端</span> | 设置是否响应截图按钮 |
| [SetCanWalkMode](控制.md#setcanwalkmode) | <span style="display:inline;color:#7575f9">客户端</span> | 设置是否响应切换行走模式 |
| [SetControlMode](控制.md#setcontrolmode) | <span style="display:inline;color:#7575f9">客户端</span> | 设置控制模式 |
| [SetControlModeLock](控制.md#setcontrolmodelock) | <span style="display:inline;color:#7575f9">客户端</span> | 设置控制模式是否可以被改变 |
| [SetDeviceVibrate](控制.md#setdevicevibrate) | <span style="display:inline;color:#7575f9">客户端</span> | 设置设备震动 |
| [SetGyroSensorReportRate](控制.md#setgyrosensorreportrate) | <span style="display:inline;color:#7575f9">客户端</span> | 设置陀螺仪传感器(上报/触发)频率 |
| [SetHoldTimeThreshold](控制.md#setholdtimethreshold) | <span style="display:inline;color:#7575f9">客户端</span> | 设置长按判定时间,即按着屏幕多长时间会触发长按操作 |
| [SetMoveLock](控制.md#setmovelock) | <span style="display:inline;color:#7575f9">客户端</span> | 设置是否锁住移动。实际上为是否响应十字键与遥感的操作。 |
| [SetShowRideUI](控制.md#setshowrideui) | <span style="display:inline;color:#ff5555">服务端</span> | 设置是否显示马匹的UI界面 |
| [SimulateTouchWithMouse](控制.md#simulatetouchwithmouse) | <span style="display:inline;color:#7575f9">客户端</span> | 模拟使用鼠标控制UIPC F11快捷键 |
| [ToggleGyroSensor](控制.md#togglegyrosensor) | <span style="display:inline;color:#7575f9">客户端</span> | 开启或关闭陀螺仪传感器采集 |
| [UnLockVerticalMove](控制.md#unlockverticalmove) | <span style="display:inline;color:#7575f9">客户端</span> | 解除上升或下降状态 |
| [UnlockInputVector](控制.md#unlockinputvector) | <span style="display:inline;color:#7575f9">客户端</span> | 解锁本地玩家方向键(移动轮盘)的输入 |
## AddPickBlacklist
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.gameCompClient.GameComponentClient
- 描述
添加使用camera组件例如GetChosen接口、PickFacing接口选取实体时的黑名单即该实体不会被选取到
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| entityId | str | 实体id |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateGame(levelId)
# 添加黑名单
comp.AddPickBlacklist(entityId)
```
## ClearPickBlacklist
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.gameCompClient.GameComponentClient
- 描述
清除使用camera组件例如GetChosen接口、PickFacing接口选取实体的黑名单
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateGame(levelId)
# 清除黑名单中所有实体
comp.ClearPickBlacklist()
```
## GetChosen
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.cameraCompClient.CameraComponentClient
- 描述
获取屏幕点击位置的实体或方块信息通常与GetEntityByCoordEvent配合使用
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| dict | 选中目标的数据,详见[PickFacing接口](控制.md#pickfacing)的备注 |
- 备注
- 目前只有在第一人称视角才能准确获取
- 示例
```python
import mod.client.extraClientApi as clientApi
# 当玩家点击屏幕时获取点击位置的entityId
class MyClientSystem(ClientSystem):
def __init__(self, namespace, name):
ClientSystem.__init__(self, namespace, name)
self.ListenForEvent('Minecraft', 'Engine', 'GetEntityByCoordEvent', self, self.click)
def click(self, args):
comp = clientApi.GetEngineCompFactory().CreateCamera(levelId)
pickData = comp.GetChosen()
```
## GetChosenEntity
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.cameraCompClient.CameraComponentClient
- 描述
获取屏幕点击位置的实体id通常与GetEntityByCoordEvent配合使用
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| str | 实体id |
- 备注
- 目前只有在第一人称视角才能准确获取
- 示例
```python
# 当玩家点击屏幕时获取点击位置的entityId
import mod.client.extraClientApi as clientApi
class MyClientSystem(ClientSystem):
def __init__(self, namespace, name):
ClientSystem.__init__(self, namespace, name)
self.ListenForEvent('Minecraft', 'Engine', 'GetEntityByCoordEvent', self, self.click)
def click(self, args):
comp = clientApi.GetEngineCompFactory().CreateCamera(levelId)
entityId = comp.GetChosenEntity()
```
## GetHoldTimeThresholdInMs
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
获取长按判定时间,即按着屏幕多长时间会触发长按操作
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| int | 时间单位毫秒。默认为400 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
timeMs = comp.GetHoldTimeThresholdInMs()
```
## GetInputVector
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.actorMotionCompClient.ActorMotionComponentClient
- 描述
获取方向键(移动轮盘)的输入
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| tuple(float,float) | 返回一个单位向量,向量第一项为向左的大小,第二项为向前的大小 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateActorMotion(localPlayerId)
left, up = comp.GetInputVector()
```
## GetMousePosition
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.actorMotionCompClient.ActorMotionComponentClient
- 描述
获取鼠标位置
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| tuple(float,float) | 返回一个tuple第一个元素为x坐标第一个元素为y坐标非PC会返回None |
- 备注
- 仅在PC有效果非PC会返回None。仅在PushScreen时正常获取
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateActorMotion(localPlayerId)
comp.GetMousePosition()
```
## GetTouchPos
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.extraClientApi
- 描述
获取点击的屏幕坐标。可以监听TapBeforeClientEvent或TapOrHoldReleaseClientEvent事件调用本API获取点击坐标。
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| tuple(float,float) | 屏幕坐标 |
- 示例
```python
import mod.client.extraClientApi as clientApi
def GetTouchPosTest():
touchX, touchY = clientApi.GetTouchPos()
```
## IsCanAttack
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
获取玩家是否响应攻击
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否响应攻击 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
comp.IsCanAttack()
```
## IsCanChat
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
获取玩家是否响应聊天按钮
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否响应聊天按钮 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
comp.IsCanChat()
```
## IsCanDrag
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
获取玩家是否响应屏幕拖动
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否响应屏幕拖动 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
comp.IsCanDrag()
```
## IsCanInair
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
获取玩家是否响应打上升下降按钮
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否响应打上升下降按钮 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
comp.IsCanInair()
```
## IsCanJump
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
获取玩家是否响应跳跃(以及在水中浮起)
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否响应跳跃(以及在水中浮起) |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
comp.IsCanJump()
```
## IsCanMove
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
获取玩家是否响应移动
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否响应移动 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
comp.IsCanMove()
```
## IsCanOpenInv
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
获取玩家是否响应打开背包按钮
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否响应打开背包按钮 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
comp.IsCanOpenInv()
```
## IsCanPause
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
获取玩家是否响应暂停按钮
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否响应暂停按钮 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
comp.IsCanPause()
```
## IsCanPauseScreen
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
获取玩家是否可以打开暂停界面
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否可以打开暂停界面 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
comp.IsCanPauseScreen()
```
## IsCanPerspective
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
获取玩家是否响应切换视角
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否响应切换视角 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
comp.IsCanPerspective()
```
## IsCanScreenShot
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
获取玩家是否响应截图按钮
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否响应截图按钮 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
comp.IsCanScreenShot()
```
## IsCanWalkMode
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
获取玩家是否响应切换行走模式
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否响应切换行走模式 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
comp.IsCanWalkMode()
```
## IsTouchWithMouse
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.extraClientApi
- 描述
获取是否正在使用鼠标点击模拟触屏
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否在用鼠标模拟触屏 |
- 备注
- 该接口只适用于PC端
- 示例
```python
import mod.client.extraClientApi as clientApi
clientApi.IsTouchWithMouse()
```
## LockInputVector
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.actorMotionCompClient.ActorMotionComponentClient
- 描述
锁定本地玩家方向键(移动轮盘)的输入,可使本地玩家持续向指定方向前行,且不会再受玩家输入影响
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| inputVector | tuple(float,float) | 输入向量,第一项控制向左的大小,第二项控制向前的大小。传入(0, 0)时玩家将会被强制固定在原地,不允许移动。 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否锁定成功True:成功 False:失败 |
- 备注
- 传入的向量会被转化为单位向量,因此传入(10, 0)与传入(0.1, 0)效果相同
- 示例
```python
import mod.client.extraClientApi as clientApi
# 使玩家向左前方持续移动
localPlayerId = clientApi.GetLocalPlayerId()
rotComp = clientApi.GetEngineCompFactory().CreateRot(localPlayerId)
motionComp = clientApi.GetEngineCompFactory().CreateActorMotion(localPlayerId)
motionComp.LockInputVector((1, 1))
```
## LockVerticalMove
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.actorMotionCompClient.ActorMotionComponentClient
- 描述
模拟上升或下降,调用后一直上升或下降
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| flag | bool | True 上升, False 下降 |
- 返回值
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateActorMotion(localPlayerId)
comp.LockVerticalMove(flag)
```
## PickFacing
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.cameraCompClient.CameraComponentClient
- 描述
获取准星选中的实体或者方块
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| dict | 选中目标的数据,详见备注 |
- 备注
- 选中目标为实体时,返回值为:
```python
{
"type": "Entity",
"entityId": entityId,
"hitPosX" : x, #精准碰撞点的x轴坐标类型为float
"hitPosY" : y, #精准碰撞点的y轴坐标类型为float
"hitPosZ" : z #精准碰撞点的z轴坐标类型为float
}
```
- 选中目标为方块时,返回值为:
```python
{
"type": "Block",
"x": x,
"y": y,
"z": z,
"face": face,
"hitPosX" : x, #精准碰撞点的x轴坐标类型为float
"hitPosY" : y, #精准碰撞点的y轴坐标类型为float
"hitPosZ" : z #精准碰撞点的z轴坐标类型为float
}
```
- 没有选中目标时,返回值为:
```python
{
"type": "None"
}
```
- 备注由于引擎限制准星指向实体时候的hitPosXYZ依旧是实体脚底中心的坐标而不是射线与碰撞箱实际的相交坐标。
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateCamera(levelId)
pickData = comp.PickFacing()
```
## SetCanAll
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
同时设置SetCanMoveSetCanJumpSetCanAttackSetCanWalkModeSetCanPerspectiveSetCanPauseSetCanChatSetCanScreenShotSetCanOpenInvSetCanDragSetCanInair
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| all | bool | True为全部响应 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 备注
- 要在其他属性设置之前设置不然在all之前设置的会被覆盖掉
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
# 全部设置为不响应
comp.SetCanAll(False)
```
## SetCanAttack
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
设置是否响应攻击
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| attack | bool | True为可攻击 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 备注
- 触屏模式下设置SetCanAttack(False)后,将屏蔽点击效果。 <攻击实体放置方块开关门拉动拉杆点击有UI界面的方块(如工作台)> 将失效。注意,不屏蔽点击交互按钮(例如交易、骑乘等按钮),不屏蔽破坏方块。
- PC的键鼠模式下设置SetCanAttack(False)后, 将屏蔽鼠标左键效果。<攻击实体,破坏方块> 将失效。
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
# 不响应攻击
comp.SetCanAttack(False)
```
## SetCanChat
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
设置是否响应聊天按钮
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| chat | bool | True为可打开聊天页面 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
# 不响应聊天按钮
comp.SetCanChat(False)
```
## SetCanDrag
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
设置是否响应屏幕拖动
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| drag | bool | True为可拖动屏幕 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
# 不响应屏幕拖动
comp.SetCanDrag(False)
```
## SetCanInair
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
设置是否响应上升下降按钮(飞在空中时右下角的三个按钮)
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| inair | bool | True为可点击 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
# 不响应空中控制按钮
comp.SetCanInair(False)
```
## SetCanJump
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
设置是否响应跳跃(以及在水中浮起)
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| jump | bool | True为可跳跃 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
# 不响应跳跃
comp.SetCanJump(False)
```
## SetCanMove
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
设置是否响应移动
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| move | bool | True为可移动 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 备注
- 与SetMoveLock的区别调用SetCanMove会清除当前Input Vector例如玩家一直按着前进键调用SetCanMove(False)会立即停下来调用SetMoveLock(True)则不会。
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
# 不响应移动
comp.SetCanMove(False)
```
## SetCanOpenInv
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
设置是否响应打开背包按钮
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| open | bool | True为可打开背包 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
# 不响应打开背包按钮
comp.SetCanOpenInv(False)
```
## SetCanPause
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
设置是否响应暂停按钮
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| pause | bool | True为可打开暂停页面 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
# 不响应暂停按钮
comp.SetCanPause(False)
```
## SetCanPauseScreen
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
设置是否可以打开暂停界面
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| pause | bool | True为可打开暂停页面 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
# 不响应暂停按钮
comp.SetCanPauseScreen(False)
```
## SetCanPerspective
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
设置是否响应切换视角
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| persp | bool | True为可切换 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
# 不响应切换视角
comp.SetCanPerspective(False)
```
## SetCanScreenShot
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
设置是否响应截图按钮
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| shot | bool | True为可截图 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
# 不响应截图按钮
comp.SetCanScreenShot(False)
```
## SetCanWalkMode
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
设置是否响应切换行走模式
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| walkmode | bool | True为可切换 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
# 不响应切换行走模式
comp.SetCanWalkMode(False)
```
## SetControlMode
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
设置控制模式
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| mode | int | 控制模式0:摇杆并点击互动, 1:摇杆并瞄准十字线, 2:方向键并点击互动 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置成功返回true失败返回false |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
comp.SetControlMode(mode)
```
## SetControlModeLock
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
设置控制模式是否可以被改变
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| lock | bool | true则控制模式锁定无法打开对应设置界面false则控制模式可以被改变 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置成功返回true失败返回false |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
comp.SetControlModeLock(lock)
```
## SetDeviceVibrate
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.deviceCompClient.DeviceCompClient
- 描述
设置设备震动
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| milliSeconds | int | 震动时间单位毫秒iOS设备该参数无效无论传入多少均只震动一下替代方案可以通过高频调用实现长震动如每秒调用本接口30次。 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 备注
- 部分设备1分钟内累计震动时间过长会导致设置失败请尽量不要设置过长的震动时间
- 设置震动失败函数返回False的可能原因当前已经处于震动状态、设备不支持震动等
- 即使函数返回值为True也有可能因为未正确判断设备是否支持震动、设备权限上禁止震动等原因未能真正震动
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateDevice(entityId)
comp.SetDeviceVibrate(1000)
```
## SetGyroSensorReportRate
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.extraClientApi
- 描述
设置陀螺仪传感器(上报/触发)频率
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| reportRate | int | 上报/触发频率默认为1hz,范围为1hz - 200hz |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否设置成功 |
- 备注
- 注意: 设置的上报频率只是期望频率,由于硬件的实现,实际上的上报频率会比设置值高
- 该接口只适用于移动端
- 示例
```python
import mod.client.extraClientApi as clientApi
clientApi.SetGyroSensorReportRate(reportRate)
```
## SetHoldTimeThreshold
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
设置长按判定时间,即按着屏幕多长时间会触发长按操作
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| time | int | 时间单位毫秒。默认为400 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
comp.SetHoldTimeThreshold(100)
```
## SetMoveLock
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.operationCompClient.OperationCompClient
- 描述
设置是否锁住移动。实际上为是否响应十字键与遥感的操作。
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| movelock | bool | True为锁住 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 备注
- 与SetCanMove的区别调用SetCanMove会清除当前Input Vector例如玩家一直按着前进键调用SetCanMove(False)会立即停下来调用SetMoveLock(True)则不会。
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateOperation(levelId)
# 锁住移动
comp.SetMoveLock(True)
```
## SetShowRideUI
<span style="display:inline;color:#ff5555">服务端</span>
method in mod.server.component.rideCompServer.RideCompServer
- 描述
设置是否显示马匹的UI界面
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| tamedEntityId | str | 可骑乘生物id |
| isShowUI | bool | 是否显示UI |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置结果 |
- 示例
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateRide(entityId)
comp.SetShowRideUI(entityId,False)
```
## SimulateTouchWithMouse
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.gameCompClient.GameComponentClient
- 描述
模拟使用鼠标控制UIPC F11快捷键
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| touch | bool | True:进入鼠标模式False:退出鼠标模式 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 模拟结果 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateGame(levelId)
comp.SimulateTouchWithMouse(True)
```
## ToggleGyroSensor
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.extraClientApi
- 描述
开启或关闭陀螺仪传感器采集
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| isOpen | bool | True开启False关闭默认False |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否设置成功 |
- 备注
- 注意: 开启后需要重新设置一次上报频率
- 该接口只适用于移动端
- 示例
```python
import mod.client.extraClientApi as clientApi
clientApi.ToggleGyroSensor(False)
# 开启后需要重新设置一次上报频率
clientApi.SetGyroSensorReportRate(10)
```
## UnLockVerticalMove
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.actorMotionCompClient.ActorMotionComponentClient
- 描述
解除上升或下降状态
- 参数
- 返回值
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateActorMotion(localPlayerId)
comp.UnLockVerticalMove()
```
## UnlockInputVector
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.component.actorMotionCompClient.ActorMotionComponentClient
- 描述
解锁本地玩家方向键(移动轮盘)的输入
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否解锁成功True:成功 False:失败 |
- 示例
```python
import mod.client.extraClientApi as clientApi
# 解锁使用LockInputVector锁定的本地玩家方向键移动轮盘输入
comp = clientApi.GetEngineCompFactory().CreateActorMotion(localPlayerId)
motionComp.UnlockInputVector()
```