From ca6777365095d1e41b44ad23d983b45246c81b99 Mon Sep 17 00:00:00 2001 From: goynov Date: Mon, 9 Feb 2026 21:48:47 +0200 Subject: [PATCH] #58 --- src/components/GameDesigner/GameDesigner.vue | 6 ++++++ src/components/GamePlay/GamePlay.vue | 1 + src/mixins/GameEnvironmentMixin.js | 10 ++++------ src/mixins/GlobalMixin.js | 5 +++++ src/pages/manage/preview/[[id]].vue | 4 ++-- src/pages/playground/game/[[id]].vue | 4 ++-- 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/components/GameDesigner/GameDesigner.vue b/src/components/GameDesigner/GameDesigner.vue index 1140245..547edae 100644 --- a/src/components/GameDesigner/GameDesigner.vue +++ b/src/components/GameDesigner/GameDesigner.vue @@ -85,6 +85,12 @@ export default { } }, + watch:{ + async 'object.scenario'(n){ + await this.loadScenario() + }, + }, + methods:{ } diff --git a/src/components/GamePlay/GamePlay.vue b/src/components/GamePlay/GamePlay.vue index 5a32dda..8f4c7ef 100644 --- a/src/components/GamePlay/GamePlay.vue +++ b/src/components/GamePlay/GamePlay.vue @@ -27,6 +27,7 @@ export default { }, watch:{ scenario(n){ + this.debug('Scenario changed', n); if (n){ this.scenesList = [this.scenes?.[0]]; } diff --git a/src/mixins/GameEnvironmentMixin.js b/src/mixins/GameEnvironmentMixin.js index 147957c..6eaf8d2 100644 --- a/src/mixins/GameEnvironmentMixin.js +++ b/src/mixins/GameEnvironmentMixin.js @@ -73,9 +73,6 @@ export default { mode(n){ engine.transformControls.setMode(n) }, - async 'object.scenario'(n){ - await this.loadScenario() - }, currentObject(n){ if (this.env == 'GameDesigner'){ engine.transformControls.attach(n.__o); @@ -124,6 +121,7 @@ export default { * @param target Target scene definition from Game Module */ async loadEnvironment(scene, target){ + this.debug('loading environment'); engine.tm?.setGame(this.object?.id); //await engine.loadPanorama(`/asset/default/43.webp`); let intro; @@ -160,7 +158,7 @@ export default { if (this.env != 'GameDesigner'){ env.scene.traverse(o=>{ if (o.name.startsWith('land') || o.name == 'Sphere'){ - console.log('Fixing ground. TODO!!!') + this.debug('Fixing ground. TODO!!!') engine.physics.add(o, 'fixed', true, undefined, 'mesh', { root: env.scene}) } }) @@ -217,7 +215,7 @@ export default { }); if (finished == expectToFinish){ //GO TO NEXT LEVEL - console.log('LEVEL FINISHED') + this.debug('LEVEL FINISHED') } engine.tm?.setGameObject(null); }); @@ -301,7 +299,7 @@ export default { }, resize(){ let r = this.$refs.target; - console.log('resizing!!', r.clientWidth, r.clientHeight, r) + this.debug('resizing!!', r.clientWidth, r.clientHeight, r) engine.resize(r.clientWidth, r.clientHeight); //this.zoom = Math.min(r.clientWidth / this.viewBox.w, r.clientHeight / this.viewBox.h); }, diff --git a/src/mixins/GlobalMixin.js b/src/mixins/GlobalMixin.js index f3b54cb..78f9aa8 100644 --- a/src/mixins/GlobalMixin.js +++ b/src/mixins/GlobalMixin.js @@ -51,6 +51,11 @@ export default { this.store.snackbar.color = color; this.store.snackbar.timeout = timeout; this.store.snackbar.show = true; + }, + debug(...args){ + if (this.store?.prefs?.debug){ + console.log(...args); + } } } } \ No newline at end of file diff --git a/src/pages/manage/preview/[[id]].vue b/src/pages/manage/preview/[[id]].vue index 608427b..5fa458e 100644 --- a/src/pages/manage/preview/[[id]].vue +++ b/src/pages/manage/preview/[[id]].vue @@ -1,6 +1,6 @@ @@ -9,7 +9,7 @@ export default { data() { return { - object: {}, + object: null, valid: false, rules: { required: v => v ? true : this.l.fieldRequired, diff --git a/src/pages/playground/game/[[id]].vue b/src/pages/playground/game/[[id]].vue index d3a35c8..5873966 100644 --- a/src/pages/playground/game/[[id]].vue +++ b/src/pages/playground/game/[[id]].vue @@ -1,6 +1,6 @@ @@ -9,7 +9,7 @@ export default { data() { return { - object: {}, + object: null, valid: false, rules: { required: v => v ? true : this.l.fieldRequired,