Skip to content

Commit 4ddb9f5

Browse files
committed
feat: 分辨率预设
1 parent a7e7d34 commit 4ddb9f5

2 files changed

Lines changed: 68 additions & 1 deletion

File tree

MaiChartManager/Front/src/views/ModManager/modComments.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ sectionNameEn:
3939
选曲界面: Music Selection
4040
过新过热(实验性): Too New Too Hot (Experimental)
4141

42-
customPanelPosition: {}
42+
customPanelPosition:
43+
GameSystem.Window: top
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { computed, defineComponent, PropType } from 'vue';
2+
import { IEntryState, ISectionState, Section } from "@/client/apiGen";
3+
import { WhateverNaviBar } from '@munet/ui';
4+
5+
const WINDOW_PREFIX = 'GameSystem.Window.';
6+
7+
interface Preset {
8+
name: string;
9+
width: number;
10+
height: number;
11+
}
12+
13+
const presets: Preset[] = [
14+
{ name: '720P 1P', width: 720, height: 1280 },
15+
{ name: '720P 2P', width: 1440, height: 1280 },
16+
{ name: '1080P 1P', width: 1080, height: 1920 },
17+
{ name: '1080P 2P', width: 2160, height: 1920 },
18+
{ name: '2K 1P', width: 1440, height: 2560 },
19+
{ name: '2K 2P', width: 2880, height: 2560 },
20+
{ name: '4K 1P', width: 2160, height: 3840 },
21+
{ name: '4K 2P', width: 4320, height: 3840 },
22+
];
23+
24+
export default defineComponent({
25+
props: {
26+
section: { type: Object as PropType<Section>, required: true },
27+
entryStates: { type: Object as PropType<Record<string, IEntryState>>, required: true },
28+
sectionState: { type: Object as PropType<ISectionState>, required: true },
29+
allSectionStates: { type: Object as PropType<Record<string, ISectionState>> },
30+
},
31+
setup(props) {
32+
const activePreset = computed(() => {
33+
for (const preset of presets) {
34+
const widthEntry = props.entryStates[WINDOW_PREFIX + 'Width'];
35+
const heightEntry = props.entryStates[WINDOW_PREFIX + 'Height'];
36+
if (widthEntry && heightEntry &&
37+
Number(widthEntry.value) === preset.width &&
38+
Number(heightEntry.value) === preset.height) {
39+
return preset.name;
40+
}
41+
}
42+
return null;
43+
});
44+
45+
const applyPreset = (preset: Preset) => {
46+
const widthEntry = props.entryStates[WINDOW_PREFIX + 'Width'];
47+
const heightEntry = props.entryStates[WINDOW_PREFIX + 'Height'];
48+
if (widthEntry) widthEntry.value = preset.width;
49+
if (heightEntry) heightEntry.value = preset.height;
50+
props.sectionState.enabled = true;
51+
};
52+
53+
const naviItems = computed(() => presets.map(preset => ({
54+
name: preset.name,
55+
selected: activePreset.value === preset.name,
56+
onClick: () => applyPreset(preset),
57+
})));
58+
59+
return () => <div class="flex flex-col gap-2">
60+
<div class="pl-40 flex items-center gap-2">
61+
预设:
62+
<WhateverNaviBar items={naviItems.value}/>
63+
</div>
64+
</div>;
65+
},
66+
});

0 commit comments

Comments
 (0)