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

5.6 KiB
Raw Blame History

sidebarDepth
sidebarDepth
1

游戏设置

索引

暂停菜单->设置 页面的相关接口


接口
描述
GetToggleOption 客户端 获得某个开关设置值的接口
GetUIProfile 客户端 获取"UI 档案"模式
HighlightBoxSelection 客户端 镜头移动时高亮当前视角中心所指的方块
SetSplitControlCanChange 客户端 设置是否允许使用准星瞄准按钮
SetToggleOption 客户端 修改开关型设置的接口
SetUIProfile 客户端 设置"UI 档案"模式

GetToggleOption

客户端

method in mod.client.component.playerViewCompClient.PlayerViewCompClient

  • 描述

    获得某个开关设置值的接口

  • 参数

    参数名
    数据类型
    说明
    optionId str OptionId枚举
  • 返回值

    数据类型
    说明
    int -1类型不支持0开关关闭 1: 开关打开;
  • 备注

  • 示例

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模式
  • 示例

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为不高亮默认为不高亮
  • 返回值

  • 备注

    • 功能实现上面其实是 设置->视频->轮廓 这一设置的一层代码封装,但不会影响到原本轮廓设置的值,可在开启轮廓选择的情况下,用此接口开关高亮效果,如果在游戏中已经关闭了轮廓选择,则方块只会高亮显示。
    • 重启后设置失效
  • 示例

import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreatePlayerView(levelId)
#设置为高亮
comp.HighlightBoxSelection(True)

SetSplitControlCanChange

客户端

method in mod.client.component.playerViewCompClient.PlayerViewCompClient

  • 描述

    设置是否允许使用准星瞄准按钮

  • 参数

    参数名
    数据类型
    说明
    canChange bool 是否允许
  • 返回值

    数据类型
    说明
    bool 是否设置成功
  • 示例

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枚举
    isOn bool 是否打开开关True为开False为关
  • 返回值

    数据类型
    说明
    bool 是否设置成功
  • 备注

    • INPUT_MODE为控制器模式不支持设置
  • 示例

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 是否设置成功
  • 示例

import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreatePlayerView(levelId)
#设置为Pocket模式
print(comp.SetUIProfile(1))