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