---
sidebarDepth: 1
---
# 游戏设置
# 索引
暂停菜单->设置 页面的相关接口
---
| 接口 |
| 描述 |
| --- | --- | --- |
| [GetControllerLayout](游戏设置.md#getcontrollerlayout) | 客户端 | 获取玩家控制器绑定映射 |
| [GetSliderOption](游戏设置.md#getslideroption) | 客户端 | 获得某个滑动条设置选项的值 |
| [GetToggleOption](游戏设置.md#gettoggleoption) | 客户端 | 获得某个开关设置值的接口 |
| [GetUIProfile](游戏设置.md#getuiprofile) | 客户端 | 获取"UI 档案"模式 |
| [HighlightBoxSelection](游戏设置.md#highlightboxselection) | 客户端 | 镜头移动时高亮当前视角中心所指的方块 |
| [SetSliderOption](游戏设置.md#setslideroption) | 客户端 | 设置某个滑动条设置选项的值 |
| [SetSplitControlCanChange](游戏设置.md#setsplitcontrolcanchange) | 客户端 | 设置是否允许使用准星瞄准按钮 |
| [SetToggleOption](游戏设置.md#settoggleoption) | 客户端 | 修改开关型设置的接口 |
| [SetUIProfile](游戏设置.md#setuiprofile) | 客户端 | 设置"UI 档案"模式 |
## GetControllerLayout
客户端
method in mod.client.component.playerViewCompClient.PlayerViewCompClient
- 描述
获取玩家控制器绑定映射
- 参数
| 参数名 | 数据类型
| 说明 |
| :--- | :--- | :--- |
| layoutType | int | 选择获取的控制器映射类型,0为键盘鼠标,1为游戏手柄 |
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| dict | 按键映射字典,操作名:按键枚举值,详见[GamepadKeyType枚举](../枚举值/GamepadKeyType.md)和[KeyBoardType枚举](../枚举值/KeyBoardType.md) |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreatePlayerView(levelId)
comp.GetControllerLayout(1) #获取手柄的绑定映射
```
## GetSliderOption
客户端
method in mod.client.component.playerViewCompClient.PlayerViewCompClient
- 描述
获得某个滑动条设置选项的值
- 参数
| 参数名 | 数据类型
| 说明 |
| :--- | :--- | :--- |
| optionId | str | [SliderOptionId枚举](../枚举值/SliderOptionId.md) |
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| float | -1:类型不支持;返回值范围详见[SliderOptionId枚举](../枚举值/SliderOptionId.md) |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreatePlayerView(levelId)
print(comp.GetSliderOption(clientApi.GetMinecraftEnum().SliderOptionId.MOUSE_SENSITIVITY))
```
## GetToggleOption
客户端
method in mod.client.component.playerViewCompClient.PlayerViewCompClient
- 描述
获得某个开关设置值的接口
- 参数
| 参数名 | 数据类型
| 说明 |
| :--- | :--- | :--- |
| optionId | str | [OptionId枚举](../枚举值/OptionId.md) |
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| int | -1:类型不支持;0:开关关闭; 1: 开关打开; |
- 备注
- 选择INPUT_MODE时,返回值为 [InputMode枚举](../枚举值/InputMode.md)
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreatePlayerView(levelId)
print(comp.GetToggleOption(clientApi.GetMinecraftEnum().OptionId.HIDE_PAPERDOLL))
```
## GetUIProfile
客户端
method in mod.client.component.playerViewCompClient.PlayerViewCompClient
- 描述
获取"UI 档案"模式
- 参数
无
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| int | 0表示经典模式,1表示Pocket模式 |
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreatePlayerView(levelId)
profile = comp.GetUIProfile()
```
## HighlightBoxSelection
客户端
method in mod.client.component.playerViewCompClient.PlayerViewCompClient
- 描述
镜头移动时高亮当前视角中心所指的方块
- 参数
| 参数名 | 数据类型
| 说明 |
| :--- | :--- | :--- |
| isHighlight | bool | 是否高亮,True为高亮,False为不高亮,默认为不高亮 |
- 返回值
无
- 备注
- 功能实现上面其实是 设置->视频->轮廓 这一设置的一层代码封装,但不会影响到原本轮廓设置的值,可在开启轮廓选择的情况下,用此接口开关高亮效果,如果在游戏中已经关闭了轮廓选择,则方块只会高亮显示。
- 重启后设置失效
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreatePlayerView(levelId)
#设置为高亮
comp.HighlightBoxSelection(True)
```
## SetSliderOption
客户端
method in mod.client.component.playerViewCompClient.PlayerViewCompClient
- 描述
设置某个滑动条设置选项的值
- 参数
| 参数名 | 数据类型
| 说明 |
| :--- | :--- | :--- |
| optionId | str | [SliderOptionId枚举](../枚举值/SliderOptionId.md) |
| value | float | 值范围详见[SliderOptionId枚举](../枚举值/SliderOptionId.md) |
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 是否设置成功 |
- 备注
- 该设置全局生效,在一个存档中修改此项设置后,进入另一个存档后该设置也会保留生效
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreatePlayerView(levelId)
print(comp.SetSliderOption(clientApi.GetMinecraftEnum().SliderOptionId.MOUSE_SENSITIVITY, 0.5))
```
## SetSplitControlCanChange
客户端
method in mod.client.component.playerViewCompClient.PlayerViewCompClient
- 描述
设置是否允许使用准星瞄准按钮
- 参数
| 参数名 | 数据类型
| 说明 |
| :--- | :--- | :--- |
| canChange | bool | 是否允许 |
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 是否设置成功 |
- 备注
- 该设置全局生效,在一个存档中修改此项设置后,进入另一个存档后该设置也会保留生效
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreatePlayerView(levelId)
print(comp.SetSplitControlCanChange(True))
```
## SetToggleOption
客户端
method in mod.client.component.playerViewCompClient.PlayerViewCompClient
- 描述
修改开关型设置的接口
- 参数
| 参数名 | 数据类型
| 说明 |
| :--- | :--- | :--- |
| optionId | str | [OptionId枚举](../枚举值/OptionId.md) |
| isOn | bool | 是否打开开关,True为开,False为关 |
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 是否设置成功 |
- 备注
- INPUT_MODE为控制器模式,不支持设置
- “花俏的树叶”开关修改后,已渲染的树叶并不会立刻变化,需要对应区块变化或者周围方块变化时,树叶方块才会有变化
- “渲染云”开关开启后,需要在“美丽的天空”开关也开启的情况下,天空中才会渲染出云层。
- 该设置全局生效,在一个存档中修改此项设置后,进入另一个存档后该设置也会保留生效
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreatePlayerView(levelId)
#设置隐藏纸娃娃选项为打开
print(comp.SetToggleOption(clientApi.GetMinecraftEnum().OptionId.HIDE_PAPERDOLL, True))
```
## SetUIProfile
客户端
method in mod.client.component.playerViewCompClient.PlayerViewCompClient
- 描述
设置"UI 档案"模式
- 参数
| 参数名 | 数据类型
| 说明 |
| :--- | :--- | :--- |
| profileType | int | 0表示经典模式,1表示Pocket模式 |
- 返回值
| 数据类型
| 说明 |
| :--- | :--- |
| bool | 是否设置成功 |
- 备注
- 该设置全局生效,在一个存档中修改此项设置后,进入另一个存档后该设置也会保留生效
- 示例
```python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreatePlayerView(levelId)
#设置为Pocket模式
print(comp.SetUIProfile(1))
```