Files
netease-modsdk-wiki/docs/mcdocs/1-ModAPI/接口/游戏设置.md
2025-03-17 13:24:39 +08:00

223 lines
5.6 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> | 描述 |
| --- | --- | --- |
| [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> | 镜头移动时高亮当前视角中心所指的方块 |
| [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 档案"模式 |
## 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)
```
## 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))
```