From 0c9e0543eefcdcbd22dd8bd2518ce687cfd5004f Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Sat, 3 Feb 2024 17:41:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8D=95=E9=80=89=E6=A1=86=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- idea.md | 4 ++-- src/core/main/init/settings.tsx | 34 +++++++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/idea.md b/idea.md index e8699c5..0aaf547 100644 --- a/idea.md +++ b/idea.md @@ -78,7 +78,7 @@ dam4.png ---- 存档 59 [] 优化开头动画 [x] 玩家可以设置字体大小 [] 完全删除 functions.js -[] 优化插件加载系统 +[x] 优化插件加载系统 [] 优化 Scroll 组件 [] 重写技能控制系统 [x] 自定义快捷键 @@ -114,4 +114,4 @@ dam4.png ---- 存档 59 [] 机关门显示绑定怪物 [] 自定义状态栏,通过申请空间进行布局 [x] 复写 api,rewrite() -[] 对 vnode 进行简单的包装,提供出显示文字、显示图片等 api 以及修改 css 的 api +[x] 对 vnode 进行简单的包装,提供出显示文字、显示图片等 api 以及修改 css 的 api diff --git a/src/core/main/init/settings.tsx b/src/core/main/init/settings.tsx index 820b54d..c961b40 100644 --- a/src/core/main/init/settings.tsx +++ b/src/core/main/init/settings.tsx @@ -1,5 +1,5 @@ import type { SettingComponent, SettingComponentProps } from '../setting'; -import { Button, InputNumber } from 'ant-design-vue'; +import { Button, InputNumber, Radio } from 'ant-design-vue'; import { mainUi } from './ui'; import { gameKey } from './hotkey'; @@ -11,6 +11,7 @@ interface Components { Number: SettingComponent; HotkeySetting: SettingComponent; ToolbarEditor: SettingComponent; + RadioSetting: (items: string[]) => SettingComponent; } export function createSettingComponents() { @@ -19,7 +20,8 @@ export function createSettingComponents() { Boolean: BooleanSetting, Number: NumberSetting, HotkeySetting, - ToolbarEditor + ToolbarEditor, + RadioSetting }; return com; } @@ -105,6 +107,34 @@ function NumberSetting(props: SettingComponentProps) { ); } +function RadioSetting(items: string[]) { + return (props: SettingComponentProps) => { + const { setting, displayer, item } = props; + + const changeValue = (value: number) => { + if (isNaN(value)) return; + setting.setValue(displayer.selectStack.join('.'), value); + displayer.update(); + }; + + return ( +
+ {items.map((v, i) => { + return ( + changeValue(i)} + > + {v} + + ); + })} +
+ ); + }; +} + function showSpecialSetting(id: string, vBind?: any) { const ui = mainUi.get(id); mainUi.showEnd();