#72 epic refactoring

This commit is contained in:
2026-03-21 17:45:27 +02:00
parent da326ddf96
commit 8dd88174af
25 changed files with 665 additions and 672 deletions
+1 -1
View File
@@ -118,7 +118,7 @@ export default {
},
async captureThumbnail() {
this.object.thumb = await this.$refs.assetPreview.gameEngine.captureScreenshot();
this.object.thumb = await this.$refs.assetPreview.captureScreenshot();
await this.save({ thumbOnly: true });
},
+3 -4
View File
@@ -4,7 +4,7 @@
<v-tab value="game">
<v-icon icon="mdi-pencil"></v-icon> {{ id == 'add' ? l.createGame : l.editGame }}
</v-tab>
<v-tab value="gameDesigner" v-if="object.scenario">
<v-tab value="gameDesigner" v-if="this.id != 'add'">
<v-icon icon="mdi-movie-open-outline"></v-icon> {{ l.gameDesigner }}
</v-tab>
</v-tabs>
@@ -13,7 +13,7 @@
<v-form class="pa-4" v-model="valid">
<v-text-field :label="l.name" v-model="object.name" :rules="[rules.required]"></v-text-field>
<v-textarea :label="l.description" v-model="object.description"></v-textarea>
<v-select :label="l.scenario" :items="scenarios" v-model="object.scenario" item-title="name" item-value="id"></v-select>
<v-select :label="l.scenario" :items="scenarios" :disabled="this.id != 'add'" v-model="object.scenario" item-title="name" item-value="id"></v-select>
</v-form>
</v-tabs-window-item>
<v-tabs-window-item value="gameDesigner">
@@ -62,9 +62,8 @@ export default {
async save(params) {
this.loading = true;
try {
console.log('saving', this.object)
this.debug('saving', this.object)
let result = await this.$api.game.save(this.object);
//Object.assign(this.object, result.data.object);
this.object.id = result.data.object.id;
if (this.id == 'add') {
this.$router.replace({ params: { id: this.object.id } });
+3 -35
View File
@@ -1,47 +1,15 @@
<template>
<v-container max-width="1400">
<GamePreview v-model="object" v-if="object"></GamePreview>
<GamePreview :id="$route.params?.id"></GamePreview>
</v-container>
</template>
<script>
export default {
data() {
return {
object: null,
valid: false,
rules: {
required: v => v ? true : this.l.fieldRequired,
requiredFile: v => (v?.length || this.id != 'add') ? true : this.l.fieldRequired
},
loading: false,
panel: [],
scenarios: []
}
},
async mounted(){
if (this.id && this.id != 'add') {
this.object = (await this.$api.game.load(this.id)).data;
//this.$api.user.tm('test', 'test', {data: 'test'})
}
this.scenarios = (await this.$api.scenario.search()).data.data;
},
watch:{
'object.scenario'(v){
if (v){
this.object.thumb = this.scenarios?.find(s=>s.id == v)?.sceneThumb?.[0];
}
}
},
computed: {
id() {
return this.$route.params?.id;
}
},
methods:{
}
}
</script>
<route>