fix: 状态栏字体

This commit is contained in:
unanmed 2024-03-04 20:17:49 +08:00
parent 5217da3357
commit 622e11454c
5 changed files with 17 additions and 3 deletions

View File

@ -9,4 +9,5 @@ public/_server/**/*.js
script/**/*.js script/**/*.js
public/editor.html public/editor.html
keyCodes.ts keyCodes.ts
*.md *.md
setting.ts

View File

@ -7,6 +7,7 @@ import { bgm } from '../audio/bgm';
import { SoundEffect } from '../audio/sound'; import { SoundEffect } from '../audio/sound';
import settingsText from '@/data/settings.json'; import settingsText from '@/data/settings.json';
import { isMobile } from '@/plugin/use'; import { isMobile } from '@/plugin/use';
import { fontSize } from '@/plugin/ui/statusBar';
export interface SettingComponentProps { export interface SettingComponentProps {
item: MotaSettingItem; item: MotaSettingItem;
@ -380,6 +381,8 @@ function handleScreenSetting<T extends number | boolean>(
} else if (key === 'fontSize') { } else if (key === 'fontSize') {
// 字体大小 // 字体大小
root.style.fontSize = `${n}px`; root.style.fontSize = `${n}px`;
} else if (key === 'fontSizeStatus') {
fontSize.value = n as number;
} }
} }
@ -423,6 +426,7 @@ mainSetting
.register('transition', '界面动画', false, COM.Boolean) .register('transition', '界面动画', false, COM.Boolean)
.register('antiAlias', '抗锯齿', false, COM.Boolean) .register('antiAlias', '抗锯齿', false, COM.Boolean)
.register('fontSize', '字体大小', 16, COM.Number, [8, 28, 1]) .register('fontSize', '字体大小', 16, COM.Number, [8, 28, 1])
.register('fontSizeStatus', '状态栏字体', 100, COM.Number, [20, 300, 10])
.register('smoothView', '平滑镜头', true, COM.Boolean) .register('smoothView', '平滑镜头', true, COM.Boolean)
.register('criticalGem', '临界显示方式', false, COM.Boolean) .register('criticalGem', '临界显示方式', false, COM.Boolean)
.setDisplayFunc('criticalGem', value => (value ? '宝石数' : '攻击')) .setDisplayFunc('criticalGem', value => (value ? '宝石数' : '攻击'))
@ -473,6 +477,7 @@ loading.once('coreInit', () => {
'screen.transition': !!storage.getValue('screen.transition', false), 'screen.transition': !!storage.getValue('screen.transition', false),
'screen.antiAlias': !!storage.getValue('screen.antiAlias', false), 'screen.antiAlias': !!storage.getValue('screen.antiAlias', false),
'screen.fontSize': storage.getValue('screen.fontSize', 16), 'screen.fontSize': storage.getValue('screen.fontSize', 16),
'screen.fontSizeStatus': storage.getValue('screen.fontSizeStatus', 100),
'screen.smoothView': !!storage.getValue('screen.smoothView', true), 'screen.smoothView': !!storage.getValue('screen.smoothView', true),
'screen.criticalGem': !!storage.getValue('screen.criticalGem', false), 'screen.criticalGem': !!storage.getValue('screen.criticalGem', false),
'action.fixed': !!storage.getValue('action.fixed', true), 'action.fixed': !!storage.getValue('action.fixed', true),
@ -510,7 +515,8 @@ mainSetting
.setDescription('audio.bgmVolume', `背景音乐的音量`) .setDescription('audio.bgmVolume', `背景音乐的音量`)
.setDescription('audio.soundEnabled', `是否开启音效`) .setDescription('audio.soundEnabled', `是否开启音效`)
.setDescription('audio.soundVolume', `音效的音量`) .setDescription('audio.soundVolume', `音效的音量`)
.setDescription('ui.mapScale', `楼传小地图的缩放,百分比格式`); .setDescription('ui.mapScale', `楼传小地图的缩放,百分比格式`)
.setDescription('screen.fontSizeStatus', `修改状态栏的字体大小`);
Mota.requireAll('var').hook.once('mounted', () => { Mota.requireAll('var').hook.once('mounted', () => {
if (storage.getValue('@@exitFromFullscreen', false)) { if (storage.getValue('@@exitFromFullscreen', false)) {

View File

@ -1,3 +1,4 @@
import { ref } from 'vue'; import { ref } from 'vue';
export const status = ref(false); export const status = ref(false);
export const fontSize = ref(100);

View File

@ -287,6 +287,7 @@ export async function triggerFullscreen(full: boolean) {
} }
mainSetting.setValue('screen.fullscreen', full, true); mainSetting.setValue('screen.fullscreen', full, true);
settingStorage.setValue('@@exitFromFullscreen', full); settingStorage.setValue('@@exitFromFullscreen', full);
settingStorage.write();
} }
/** /**

View File

@ -183,6 +183,9 @@ import Box from '../components/box.vue';
import Scroll from '../components/scroll.vue'; import Scroll from '../components/scroll.vue';
import { status } from '../plugin/ui/statusBar'; import { status } from '../plugin/ui/statusBar';
import { isMobile } from '../plugin/use'; import { isMobile } from '../plugin/use';
import { fontSize } from '../plugin/ui/statusBar';
let main: HTMLDivElement;
const items = core.flags.statusBarItems; const items = core.flags.statusBarItems;
const icons = core.statusBar.icons; const icons = core.statusBar.icons;
@ -196,6 +199,7 @@ const format = core.formatBigNumber;
watch(width, n => (updateStatus.value = !updateStatus.value)); watch(width, n => (updateStatus.value = !updateStatus.value));
watch(height, n => (updateStatus.value = !updateStatus.value)); watch(height, n => (updateStatus.value = !updateStatus.value));
watch(fontSize, n => (main.style.fontSize = `${n}%`));
const hero = shallowReactive<Partial<HeroStatus>>({}); const hero = shallowReactive<Partial<HeroStatus>>({});
const keys = shallowReactive<number[]>([]); const keys = shallowReactive<number[]>([]);
@ -251,6 +255,7 @@ function update() {
onMounted(() => { onMounted(() => {
update(); update();
main = document.getElementById('status-main') as HTMLDivElement;
}); });
</script> </script>
@ -260,7 +265,7 @@ onMounted(() => {
width: 100%; width: 100%;
height: 100%; height: 100%;
padding: 1vh 0; padding: 1vh 0;
font-size: 100%; font-size: v-bind(fontSize);
} }
.status-item { .status-item {