输入:用按键关闭界面
本页目录
把 J 注册为欢迎界面的关闭键。
使用前准备
无需外部资源。检查 J 是否与其他已启用按键冲突。 管理员需有 shadowui.presentation.admin 权限,目标玩家使用配对的 Forge 1.21.10 客户端在线。
保存位置
保存为服务端 plugins/ShadowUIFramework/profiles/input.json。以下为完整 JSON;涉及资源和 UUID 时,先按上方要求替换。
完整配置
{
"id": "wiki:input",
"schemaVersion": 1,
"revision": 1,
"requires": [
"presentation_profile_v1",
"ui_tree_v1",
"input_bindings_v2"
],
"resources": [],
"domains": {
"gui": {
"id": "welcome",
"width": 320,
"height": 180,
"components": [
{
"id": "title",
"type": "text",
"x": 16,
"y": 20,
"width": 280,
"height": 24,
"text": "Welcome to ShadowUI"
},
{
"id": "close",
"type": "button",
"x": 16,
"y": 65,
"width": 120,
"height": 24,
"text": "Close",
"action": "close"
}
]
},
"input": {
"schemaVersion": 2,
"bindings": [
{
"id": "close",
"displayName": "Close welcome",
"defaultKey": "key.keyboard.j",
"context": "gui",
"events": [
"press"
]
}
]
}
},
"behaviors": [
{
"id": "show",
"on": "ui:interaction",
"steps": [
{
"op": "action",
"name": "ui:close",
"args": {}
}
]
},
{
"id": "keyboard-close",
"on": "input:press",
"steps": [
{
"op": "action",
"name": "ui:close",
"args": {}
}
]
}
]
}
关键字段
defaultKey 是默认键;context: gui 只在打开界面时生效;press 在按下时触发一次,不会按住重复。
加载与使用
/presentation load input.json
/presentation assign 玩家名 wiki:input
/presentation status 玩家名
load 使用文件名,assign 使用配置中的 id。加载不会自动应用给全部玩家。
预期效果
欢迎界面出现后按 J 关闭,也可以点击 Close。
常用调整
在游戏“选项 → 控制 → 按键绑定”的 ShadowUI 表现输入分类改键。玩家改键会独立保存,修改默认键不会覆盖已有选择。 修改后递增 revision,再重新加载和分配。需要撤下当前方案时执行 /presentation clear 玩家名。
常见问题
按键无反应先检查当前是否有 GUI、玩家改键和冲突;改键页面与编辑器内不会执行这类输入。 其他问题按排错指南检查。