feat: chusanApp.exe patching
This commit is contained in:
@ -3,37 +3,53 @@ import InputNumber from 'primevue/inputnumber';
|
||||
import ToggleSwitch from 'primevue/toggleswitch';
|
||||
import OptionRow from './OptionRow.vue';
|
||||
import { usePrfStore } from '../stores';
|
||||
import { Patch } from '@/types';
|
||||
|
||||
const prf = usePrfStore();
|
||||
|
||||
const toggleUnary = (key: string, val: boolean) => {
|
||||
if (val) {
|
||||
prf.current!.data.patches[key] = 'Enabled';
|
||||
prf.current!.data.patches[key] = 'enabled';
|
||||
} else {
|
||||
delete prf.current!.data.patches[key];
|
||||
}
|
||||
};
|
||||
|
||||
const setNumber = (key: string, val: number) => {
|
||||
if (val) {
|
||||
prf.current!.data.patches[key] = { number: val };
|
||||
} else {
|
||||
delete prf.current!.data.patches[key];
|
||||
}
|
||||
};
|
||||
|
||||
defineProps({
|
||||
id: String,
|
||||
name: String,
|
||||
tooltip: String,
|
||||
type: String,
|
||||
defaultValue: Number,
|
||||
patch: Object as () => Patch,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<OptionRow :title="name" :tooltip="tooltip" :greytext="id">
|
||||
<OptionRow
|
||||
:title="patch?.name"
|
||||
:tooltip="patch?.tooltip"
|
||||
:greytext="patch?.id"
|
||||
>
|
||||
<ToggleSwitch
|
||||
v-if="type === undefined"
|
||||
:model-value="prf.current!.data.patches[id!] !== undefined"
|
||||
@update:model-value="(v: boolean) => toggleUnary(id!, v)"
|
||||
v-if="patch?.type === undefined"
|
||||
:model-value="prf.current!.data.patches[patch!.id!] !== undefined"
|
||||
@update:model-value="(v: boolean) => toggleUnary(patch!.id!, v)"
|
||||
/>
|
||||
<InputNumber
|
||||
v-else
|
||||
v-else-if="patch?.type === 'number'"
|
||||
class="number-input"
|
||||
:placeholder="(defaultValue ?? 0).toString()"
|
||||
:model-value="
|
||||
(prf.current!.data.patches[patch!.id!] as { number: number })
|
||||
?.number
|
||||
"
|
||||
@update:model-value="(v: number) => setNumber(patch!.id!, v)"
|
||||
:min="patch?.min"
|
||||
:max="patch?.max"
|
||||
:placeholder="(patch?.default ?? 0).toString()"
|
||||
/>
|
||||
</OptionRow>
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user