2022-10-15 19:31:18 +09:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<Preview :config="previewConfig" />
|
|
|
|
<div v-for="c,i in config" :key="i" class="textcell">
|
2023-01-29 04:39:18 +09:00
|
|
|
<button class="textcell-remove" @click="deletionConfirm(i)">×</button>
|
2022-10-15 19:31:18 +09:00
|
|
|
<Cell :value="c" @input="$event => config.splice(i, 1, $event)" :version="version" />
|
|
|
|
</div>
|
2023-01-29 04:39:18 +09:00
|
|
|
<div class="btn-ctn">
|
|
|
|
<button @click="config.push(db.PAS)">{{l('add.PAS')}}</button>
|
|
|
|
<button @click="config.push(db.speed)">{{l('add.speed')}}</button>
|
|
|
|
<button @click="config.push(db.detailed)">{{l('add.detailed')}}</button>
|
|
|
|
<button @click="config.push(db.rect)">{{l('add.rect')}}</button>
|
2022-10-15 19:31:18 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2023-01-29 04:39:18 +09:00
|
|
|
import labels from './labels.json';
|
2022-10-15 19:31:18 +09:00
|
|
|
import { defaultConfig, getConfig, lskey, format2previewText } from './codegen.js';
|
2023-01-29 04:39:18 +09:00
|
|
|
import configDB from './configDB.js';
|
|
|
|
import { makeUpdateConfig, makeGetLabel } from '../utils.js';
|
2022-10-15 19:31:18 +09:00
|
|
|
import Cell from './Cell.vue';
|
|
|
|
|
2023-01-29 04:39:18 +09:00
|
|
|
/** @typedef {'GMSJ01'|'GMSJ0A'|'GMSE01'|'GMSP01'} GameVersion */
|
2022-10-15 19:31:18 +09:00
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
Cell,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
version: {type: String},
|
|
|
|
previewConfig: {type: Object},
|
|
|
|
},
|
2023-01-29 04:39:18 +09:00
|
|
|
computed: {
|
|
|
|
l() {
|
|
|
|
return makeGetLabel(labels, this.$lang);
|
|
|
|
},
|
|
|
|
db() {
|
|
|
|
const version = /**@type{GameVersion}*/(this.version);
|
|
|
|
return Object.fromEntries(Object.entries(configDB).map(([k, v]) => [
|
|
|
|
k,
|
|
|
|
{...v, text: format2previewText(v.fmt, version)},
|
|
|
|
]));
|
|
|
|
},
|
|
|
|
},
|
2022-10-15 19:31:18 +09:00
|
|
|
data() {
|
2023-01-29 04:39:18 +09:00
|
|
|
const version = /**@type{GameVersion}*/(this.version);
|
|
|
|
const config = getConfig(version);
|
2022-10-15 19:31:18 +09:00
|
|
|
const defaultConfigCell = {
|
2023-01-29 04:39:18 +09:00
|
|
|
text: format2previewText(defaultConfig[0].fmt, version),
|
2022-10-15 19:31:18 +09:00
|
|
|
...defaultConfig[0],
|
|
|
|
};
|
|
|
|
return {config, defaultConfigCell};
|
|
|
|
},
|
|
|
|
watch: {
|
2023-01-29 04:39:18 +09:00
|
|
|
config: makeUpdateConfig(lskey, defaultConfig),
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
/** @param {number} i */
|
|
|
|
deletionConfirm(i) {
|
|
|
|
// if (window.confirm(this.l('deletionConfirm'))) {
|
|
|
|
this.config.splice(i, 1);
|
2022-10-15 19:31:18 +09:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.textcell {
|
|
|
|
border: 1px solid black;
|
|
|
|
padding: 4px 8px;
|
|
|
|
margin: 4px 0;
|
|
|
|
}
|
|
|
|
.textcell-remove {
|
|
|
|
padding: 0;
|
|
|
|
background: transparent;
|
|
|
|
border: none;
|
|
|
|
font-size: 1.2rem;
|
|
|
|
color: red;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
2023-01-29 04:39:18 +09:00
|
|
|
.btn-ctn button {
|
|
|
|
display: block;
|
|
|
|
}
|
2022-10-15 19:31:18 +09:00
|
|
|
</style>
|