From 3d61d87e6cfe1c22e3599507b3ff78bd7f286b80 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Mon, 4 Mar 2024 20:04:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AD=97=E4=BD=93=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/project/plugins.js | 2 +- src/core/main/setting.ts | 28 +++++++++++++++++++++++++--- src/plugin/utils.ts | 3 +++ src/ui/equipbox.vue | 7 +------ src/ui/toolbox.vue | 13 +------------ 5 files changed, 31 insertions(+), 22 deletions(-) diff --git a/public/project/plugins.js b/public/project/plugins.js index 567507d..cfc5abf 100644 --- a/public/project/plugins.js +++ b/public/project/plugins.js @@ -1326,7 +1326,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { filterMap.push( [ ['sample0', 'sample1', 'sample2'], // 楼层列表 - 'brightness(120%)' // 滤镜内容 + 'brightness(80%)' // 滤镜内容 ], [['MT0'], 'contrast(120%)'] ); diff --git a/src/core/main/setting.ts b/src/core/main/setting.ts index 4329176..baf3d1a 100644 --- a/src/core/main/setting.ts +++ b/src/core/main/setting.ts @@ -119,7 +119,7 @@ export class MotaSetting extends EventEmitter { * @param key 要设置的设置的键 * @param value 要设置的值 */ - setValue(key: string, value: boolean | number) { + setValue(key: string, value: boolean | number, noEmit: boolean = false) { const setting = this.getSettingBy(key.split('.')); if (typeof setting.value !== typeof value) { throw new Error( @@ -130,7 +130,7 @@ export class MotaSetting extends EventEmitter { const old = setting.value as boolean | number; setting.value = value; - this.emit('valueChange', key, value, old); + if (!noEmit) this.emit('valueChange', key, value, old); } /** @@ -348,8 +348,22 @@ function handleScreenSetting( o: T ) { if (key === 'fullscreen') { + const fontSize = mainSetting.getValue('screen.fontSize', 16); + const beforeIsMobile = isMobile; // 全屏 - triggerFullscreen(n as boolean); + triggerFullscreen(n as boolean).then(() => { + if (beforeIsMobile) { + mainSetting.setValue( + 'screen.fontSize', + Math.floor((fontSize * 2) / 3) + ); + } else if (isMobile) { + mainSetting.setValue( + 'screen.fontSize', + Math.floor((fontSize * 3) / 2) + ); + } + }); } else if (key === 'heroDetail') { // 勇士显伤 core.drawHero(); @@ -497,3 +511,11 @@ mainSetting .setDescription('audio.soundEnabled', `是否开启音效`) .setDescription('audio.soundVolume', `音效的音量`) .setDescription('ui.mapScale', `楼传小地图的缩放,百分比格式`); + +Mota.requireAll('var').hook.once('mounted', () => { + if (storage.getValue('@@exitFromFullscreen', false)) { + const fontSize = mainSetting.getValue('screen.fontSize', 16); + mainSetting.setValue('screen.fontSize', Math.round((fontSize * 3) / 2)); + } + storage.setValue('@@exitFromFullscreen', !!document.fullscreenElement); +}); diff --git a/src/plugin/utils.ts b/src/plugin/utils.ts index 30498f5..40e1d99 100644 --- a/src/plugin/utils.ts +++ b/src/plugin/utils.ts @@ -10,6 +10,7 @@ import { parseColor } from './webgl/utils'; import { Keyboard, KeyboardEmits } from '@/core/main/custom/keyboard'; import { mainUi } from '@/core/main/init/ui'; import { isAssist } from '@/core/main/custom/hotkey'; +import { mainSetting, settingStorage } from '@/core/main/setting'; type CanParseCss = keyof { [P in keyof CSSStyleDeclaration as CSSStyleDeclaration[P] extends string @@ -284,6 +285,8 @@ export async function triggerFullscreen(full: boolean) { maxGameScale(); }); } + mainSetting.setValue('screen.fullscreen', full, true); + settingStorage.setValue('@@exitFromFullscreen', full); } /** diff --git a/src/ui/equipbox.vue b/src/ui/equipbox.vue index 5de2bd7..d495489 100644 --- a/src/ui/equipbox.vue +++ b/src/ui/equipbox.vue @@ -697,12 +697,7 @@ onUnmounted(() => { } @media screen and (max-width: 600px) { - #equipbox { - padding: 5%; - } - #equipbox-main { - height: 90vh; flex-direction: column-reverse; font-size: 100%; } @@ -717,7 +712,7 @@ onUnmounted(() => { } #equip-list { - flex-basis: 30%; + flex-basis: 45%; #filter #sort-type { font-size: 150%; diff --git a/src/ui/toolbox.vue b/src/ui/toolbox.vue index 5f51813..88e9f05 100644 --- a/src/ui/toolbox.vue +++ b/src/ui/toolbox.vue @@ -387,22 +387,11 @@ onUnmounted(() => { } @media screen and (max-width: 600px) { - #toolbox { - padding: 5%; - } - - #tools { - transform: translateY(-50%); - span { - margin: 0; - } - } - #toolbox-main { flex-direction: column-reverse; height: 90%; font-size: 100%; - margin-top: 20%; + margin-top: 10%; } .item-list {