feat: 怪物手册缩放

This commit is contained in:
unanmed 2024-04-19 22:40:47 +08:00
parent faf7b9b654
commit 9463891af2
2 changed files with 17 additions and 2 deletions

View File

@ -487,6 +487,8 @@ mainSetting
.setDisplayFunc('mapScale', value => `${value}%`)
.register('toolbarScale', '工具栏缩放', 100, COM.Number, [10, 500, 10])
.setDisplayFunc('toolbarScale', value => `${value}%`)
.register('bookScale', '怪物手册缩放', 100, COM.Number, [10, 500, 10])
.setDisplayFunc('bookScale', value => `${value}%`)
)
.register(
'debug',
@ -524,6 +526,7 @@ loading.once('coreInit', () => {
'ui.toolbarScale',
isMobile ? 50 : Math.floor(window.innerWidth / 1700 * 10) * 10
),
'ui.bookScale': storage.getValue('ui.bookScale', isMobile ? 100 : 80),
'debug.frame': !!storage.getValue('debug.frame', false),
});
});
@ -550,6 +553,8 @@ mainSetting
.setDescription('audio.soundEnabled', `是否开启音效`)
.setDescription('audio.soundVolume', `音效的音量`)
.setDescription('ui.mapScale', `楼传小地图的缩放,百分比格式`)
.setDescription('ui.toolbarScale', `自定义工具栏的缩放比例`)
.setDescription('ui.bookScale', `怪物手册界面中每个怪物框体的高度缩放,最小值限定为 20% 屏幕高度`)
.setDescription('screen.fontSizeStatus', `修改状态栏的字体大小`)
.setDescription('screen.blur', '打开任意ui界面时是否有背景虚化效果移动端打开后可能会有掉帧或者发热现象。关闭ui后生效');

View File

@ -50,6 +50,8 @@ import { getDetailedEnemy } from '../plugin/ui/fixed';
import { GameUi } from '@/core/main/custom/ui';
import { gameKey } from '@/core/main/init/hotkey';
import { mainUi } from '@/core/main/init/ui';
import { mainSetting } from '@/core/main/setting';
import { isMobile } from '@/plugin/use';
const props = defineProps<{
num: number;
@ -70,6 +72,14 @@ const drag = ref(false);
const detail = ref(false);
const selected = ref(0);
const settingScale = mainSetting.getValue('ui.bookScale', 100) / 100;
const scale = isMobile
? Math.max(settingScale * 15, 20)
: Math.max(
(window.innerWidth / window.innerHeight) * 15 * settingScale,
20
);
/**
* 选择怪物展示详细信息
* @param enemy 选择的怪物
@ -216,7 +226,7 @@ onUnmounted(() => {
.enemy {
display: flex;
flex-direction: column;
height: 20vh;
height: v-bind('scale + "vh"');
width: 100%;
padding: 0 1% 0 1%;
}
@ -232,7 +242,7 @@ onUnmounted(() => {
}
.enemy {
height: 15vh;
height: v-bind('scale * 2 / 3 + "vh"');
}
}
</style>