fix: 数字设置

This commit is contained in:
unanmed 2024-02-04 17:16:36 +08:00
parent d7ee49dd23
commit 1d7d177cae
2 changed files with 5 additions and 3 deletions

View File

@ -60,6 +60,9 @@ function NumberSetting(props: SettingComponentProps) {
const { setting, displayer, item } = props;
const changeValue = (value: number) => {
if (typeof value !== 'number') return;
if (value < (item.step?.[0] ?? 0) || value > (item.step?.[1] ?? 100)) {
return;
}
setting.setValue(displayer.selectStack.join('.'), value);
displayer.update();
};

View File

@ -312,8 +312,6 @@ export class SettingDisplayer extends EventEmitter<SettingDisplayerEvent> {
}
}
// todo: 优化存储方式
export const mainSetting = new MotaSetting();
// 添加不参与全局存储的设置
MotaSetting.noStorage.push('action.autoSkill', 'screen.fullscreen');
@ -516,4 +514,5 @@ mainSetting
.setDescription('audio.bgmEnabled', `是否开启背景音乐`)
.setDescription('audio.bgmVolume', `背景音乐的音量`)
.setDescription('audio.soundEnabled', `是否开启音效`)
.setDescription('audio.soundVolume', `音效的音量`);
.setDescription('audio.soundVolume', `音效的音量`)
.setDescription('ui.mapScale', `楼传小地图的缩放,百分比格式`);