@@ -4,7 +4,7 @@ import { Button, Select } from '@munet/ui';
44import api from "@/client/api" ;
55import { modInfo , updateModInfo } from "@/store/refs" ;
66import { useI18n } from 'vue-i18n' ;
7- import ConfigEntry , { optionsIoKeyMap } from '../../ConfigEntry' ;
7+ import ConfigEntry , { optionsIoKeyMap } from '../../ConfigEntry' ;
88import { ENTRY_GROUP_PADDING , ENTRY_LABEL_CLASS } from '../../constants' ;
99
1010export default defineComponent ( {
@@ -17,13 +17,21 @@ export default defineComponent({
1717 const load = ref ( false )
1818 const { t } = useI18n ( ) ;
1919
20+
21+ const PREFIX = 'GameSystem.AdxHidInput.' ;
22+ const pathsLeft = [
23+ 'Button1' , 'Button2' ,
24+ 'P1Button1' , 'P1Button2' , 'P1Button3' , 'P1Button4' , 'P1DisableButtons' ,
25+ ] . map ( it => PREFIX + it ) ;
26+
27+ const pathsRight = [
28+ 'Button3' , 'Button4' ,
29+ 'P2Button1' , 'P2Button2' , 'P2Button3' , 'P2Button4' , 'P2DisableButtons' ,
30+ ] . map ( it => PREFIX + it ) ;
31+
2032 const knownPaths = [
21- 'GameSystem.AdxHidInput.Button1' ,
22- 'GameSystem.AdxHidInput.Button2' ,
23- 'GameSystem.AdxHidInput.Button3' ,
24- 'GameSystem.AdxHidInput.Button4' ,
33+ ...pathsLeft , ...pathsRight ,
2534 ] ;
26- const options = optionsIoKeyMap ( t ) ;
2735
2836 const del = async ( ) => {
2937 load . value = true
@@ -34,48 +42,24 @@ export default defineComponent({
3442
3543 return ( ) => < div class = { [ "flex flex-col gap-2" , ENTRY_GROUP_PADDING ] } >
3644 { modInfo . value ?. isHidConflictExist ? < div class = "flex gap-2 items-center m-l-35" >
37- < span class = "c-orange" > { t ( 'mod.adxHid.conflictDetected' ) } </ span >
38- < Button variant = "secondary" onClick = { del } ing = { load . value } > { t ( 'mod.adxHid.oneClickDelete' ) } </ Button >
39- </ div >
45+ < span class = "c-orange" > { t ( 'mod.adxHid.conflictDetected' ) } </ span >
46+ < Button variant = "secondary" onClick = { del } ing = { load . value } > { t ( 'mod.adxHid.oneClickDelete' ) } </ Button >
47+ </ div >
4048 : < div class = "flex gap-2 items-center m-l-35" >
4149 < span class = "c-green-6" > { t ( 'mod.adxHid.noConflict' ) } </ span >
4250 </ div > }
4351 < div class = "grid grid-cols-1 min-[500px]:grid-cols-2 gap-y-12px" >
4452 < div class = "flex flex-col gap-2" >
45- < div class = "flex gap-2 items-start" >
46- < div class = { ENTRY_LABEL_CLASS } > { t ( 'mod.adxHid.button1' ) } </ div >
47- < div class = "flex flex-col gap-2 w-full ws-pre-line" >
48- < Select v-model :value = { props . entryStates [ 'GameSystem.AdxHidInput.Button1' ] . value } options = { options } />
49- < div class = "text-sm op-80" > { t ( 'mod.adxHid.button1Desc' ) } </ div >
50- </ div >
51- </ div >
52- < div class = "flex gap-2 items-start" >
53- < div class = { ENTRY_LABEL_CLASS } > { t ( 'mod.adxHid.button2' ) } </ div >
54- < div class = "flex flex-col gap-2 w-full ws-pre-line" >
55- < Select v-model :value = { props . entryStates [ 'GameSystem.AdxHidInput.Button2' ] . value } options = { options } />
56- < div class = "text-sm op-80" > { t ( 'mod.adxHid.button2Desc' ) } </ div >
57- </ div >
58- </ div >
53+ { props . section . entries ?. filter ( it => pathsLeft . includes ( it . path ! ) )
54+ . map ( ( entry ) => < ConfigEntry key = { entry . path ! } entry = { entry } entryState = { props . entryStates [ entry . path ! ] } /> ) }
5955 </ div >
6056 < div class = "flex flex-col gap-2" >
61- < div class = "flex gap-2 items-start" >
62- < div class = { ENTRY_LABEL_CLASS } > { t ( 'mod.adxHid.button3' ) } </ div >
63- < div class = "flex flex-col gap-2 w-full ws-pre-line" >
64- < Select v-model :value = { props . entryStates [ 'GameSystem.AdxHidInput.Button3' ] . value } options = { options } />
65- < div class = "text-sm op-80" > { t ( 'mod.adxHid.button3Desc' ) } </ div >
66- </ div >
67- </ div >
68- < div class = "flex gap-2 items-start" >
69- < div class = { ENTRY_LABEL_CLASS } > { t ( 'mod.adxHid.button4' ) } </ div >
70- < div class = "flex flex-col gap-2 w-full ws-pre-line" >
71- < Select v-model :value = { props . entryStates [ 'GameSystem.AdxHidInput.Button4' ] . value } options = { options } />
72- < div class = "text-sm op-80" > { t ( 'mod.adxHid.button4Desc' ) } </ div >
73- </ div >
74- </ div >
57+ { props . section . entries ?. filter ( it => pathsRight . includes ( it . path ! ) )
58+ . map ( ( entry ) => < ConfigEntry key = { entry . path ! } entry = { entry } entryState = { props . entryStates [ entry . path ! ] } /> ) }
7559 </ div >
7660 </ div >
7761 { props . section . entries ?. filter ( it => ! knownPaths . includes ( it . path ! ) )
78- . map ( ( entry ) => < ConfigEntry key = { entry . path ! } entry = { entry } entryState = { props . entryStates [ entry . path ! ] } /> ) }
62+ . map ( ( entry ) => < ConfigEntry key = { entry . path ! } entry = { entry } entryState = { props . entryStates [ entry . path ! ] } /> ) }
7963 </ div >
8064 } ,
8165} ) ;
0 commit comments