KaleidoscopePlugin Docs Help

Screen - 屏幕

表单

//添加表单到屏幕 单人似乎不显示 请进入服务器 var form = { "type": "form", "title": "菜单标题", "content": "菜单内容", "buttons": [ { "text": "菜单按钮0" }, { "text": "菜单按钮1", "image": { "type": "path", "data": "textures/ui/anvil_icon.png" } }, { "text": "菜单按钮2", "image": { "type": "url", "data": "https://xxx.png" } } ] }; var form_str = JSON.stringify(form); Helper.addForm(114514,form_str); var custom_form = { "type": "custom_form", "title": "菜单标题", "content": [ { "type": "label", "text": "普通文本" }, { "type": "input", "text": "输入框", "default": "默认文字", "placeholder": "提示文字" }, { "type": "toggle", "text": "开关按钮", "default": false }, { "type": "dropdown", "text": "多选", "options": ["选项1", "选项2", "选项3"] }, { "type": "slider", "text": "进度条", "min": 1, "max": 10, "step": 1, "default": 2 }, { "type": "step_slider", "text": "滑动选择", "steps": ["选项1", "选项2", "选项3"], "default": 1 } ] }; var custom_form_str = JSON.stringify(custom_form); Helper.addForm(114515,custom_form_str); function onFormRet(id,ret) { if (id == 114514) { print('当前选择是的第' + ret + '个选项'); } else if (id == 114515) { print('选择完成,返回' + ret); } }
Last modified: 15 三月 2025