From c69070fdc894dccd3159d7e0a6d677294c7dc285 Mon Sep 17 00:00:00 2001 From: goynov Date: Mon, 13 Apr 2026 08:43:30 +0300 Subject: [PATCH] maxPoints --- .../CharacterObject/CharacterObject.vue | 3 ++- .../GenericObject/GenericObject.js | 3 +++ .../ImageObject/ImageObject.js | 2 ++ .../InteractiveObjects/InteractiveObject.js | 1 + .../InteractiveObjects/Particles/Particles.vue | 3 ++- .../SceneSwitcher/SceneSwitcher.vue | 3 ++- .../InteractiveObjects/Teleporter/Teleporter.vue | 3 ++- .../InteractiveObjects/TextObject/TextObject.vue | 3 ++- src/components/SceneDesigner/GameObject.vue | 16 ++++++++++++++-- src/lib/MeshUtils.js | 3 +-- 10 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/components/InteractiveObjects/CharacterObject/CharacterObject.vue b/src/components/InteractiveObjects/CharacterObject/CharacterObject.vue index 90a7bc2..6d9b326 100644 --- a/src/components/InteractiveObjects/CharacterObject/CharacterObject.vue +++ b/src/components/InteractiveObjects/CharacterObject/CharacterObject.vue @@ -30,6 +30,7 @@ export default { this.modelValue.title = e.name this.modelValue.exclude = true } - } + }, + __noPoints: true } \ No newline at end of file diff --git a/src/components/InteractiveObjects/GenericObject/GenericObject.js b/src/components/InteractiveObjects/GenericObject/GenericObject.js index e905e35..085a35a 100644 --- a/src/components/InteractiveObjects/GenericObject/GenericObject.js +++ b/src/components/InteractiveObjects/GenericObject/GenericObject.js @@ -5,6 +5,9 @@ class GenericObject extends EventManager{ #actions = []; constructor(engine, data){ super(); + if (!data.description || data.exclude){ + this.maxPoints = 0; + } return new Promise(async(resolve, reject)=>{ this.source = await engine.load(data.$go.asset.name); this.object = engine.meshUtils.bottomOrigin(this.source.scene) diff --git a/src/components/InteractiveObjects/ImageObject/ImageObject.js b/src/components/InteractiveObjects/ImageObject/ImageObject.js index 7d970a5..c4f2a2b 100644 --- a/src/components/InteractiveObjects/ImageObject/ImageObject.js +++ b/src/components/InteractiveObjects/ImageObject/ImageObject.js @@ -44,6 +44,8 @@ class ImageObject extends EventManager{ textScrolledCallback: ()=>{ this.dispatchEvent({type:'finish'}); } }) }) + }else{ + this.maxPoints = 0 } resolve(this) diff --git a/src/components/InteractiveObjects/InteractiveObject.js b/src/components/InteractiveObjects/InteractiveObject.js index 994b3d7..8b3cada 100644 --- a/src/components/InteractiveObjects/InteractiveObject.js +++ b/src/components/InteractiveObjects/InteractiveObject.js @@ -77,6 +77,7 @@ class InteractiveObject extends EventManager{ engine.tm?.setGameObject(obj.id); }) } + ['minPoints', 'maxPoints'].filter(p=>this.io[p] !== undefined).forEach(p=> this[p] = this.io[p] ) break; } if (obj.shouldBeLocked){ diff --git a/src/components/InteractiveObjects/Particles/Particles.vue b/src/components/InteractiveObjects/Particles/Particles.vue index 335c9c9..ecebae0 100644 --- a/src/components/InteractiveObjects/Particles/Particles.vue +++ b/src/components/InteractiveObjects/Particles/Particles.vue @@ -43,6 +43,7 @@ export default { this.modelValue.h = 50; this.modelValue.exclude = true; } - } + }, + __noPoints: true } \ No newline at end of file diff --git a/src/components/InteractiveObjects/SceneSwitcher/SceneSwitcher.vue b/src/components/InteractiveObjects/SceneSwitcher/SceneSwitcher.vue index ef76ef6..c6c1e37 100644 --- a/src/components/InteractiveObjects/SceneSwitcher/SceneSwitcher.vue +++ b/src/components/InteractiveObjects/SceneSwitcher/SceneSwitcher.vue @@ -46,7 +46,8 @@ export default { return data.__root.scenes.find(s=>s.data.id == data.switchScene).data.environment; } }) - } + }, + __noPoints: true } \ No newline at end of file diff --git a/src/components/InteractiveObjects/Teleporter/Teleporter.vue b/src/components/InteractiveObjects/Teleporter/Teleporter.vue index 9a49b60..3d599c1 100644 --- a/src/components/InteractiveObjects/Teleporter/Teleporter.vue +++ b/src/components/InteractiveObjects/Teleporter/Teleporter.vue @@ -17,6 +17,7 @@ export default { modelValue: Object }, methods:{ - } + }, + __noPoints: true } \ No newline at end of file diff --git a/src/components/InteractiveObjects/TextObject/TextObject.vue b/src/components/InteractiveObjects/TextObject/TextObject.vue index 56adea7..5c2208a 100644 --- a/src/components/InteractiveObjects/TextObject/TextObject.vue +++ b/src/components/InteractiveObjects/TextObject/TextObject.vue @@ -21,6 +21,7 @@ export default { modelValue: Object }, methods:{ - } + }, + __noPoints: true } \ No newline at end of file diff --git a/src/components/SceneDesigner/GameObject.vue b/src/components/SceneDesigner/GameObject.vue index 0c4e490..1fad76e 100644 --- a/src/components/SceneDesigner/GameObject.vue +++ b/src/components/SceneDesigner/GameObject.vue @@ -27,7 +27,7 @@ - +
@@ -69,6 +69,8 @@ const components = { PuzzleGame1, PuzzleGame2, MazeQuizGame, Particles, ClassicPuzzle, PairMatchingGame, SingleQuestion, Teleporter }; +import { markRaw } from 'vue'; + export default { emits:['target', 'preview'], props:{ @@ -80,14 +82,15 @@ export default { visible: Boolean, parent: Object }, - components, data(){ return { InteractiveObjectTypes, active: false, activationTypes: ['unlock', 'appear'], + cpc: markRaw(components) } }, + components, mounted(){ this.active = true; this.modelValue.points ??= 10; @@ -98,6 +101,15 @@ export default { components[this.modelValue.type].__transform(this.modelValue) } }, + watch:{ + 'modelValue.type'(n){ + if (components[this.modelValue.type].__noPoints){ + this.modelValue.points = 0; + }else{ + this.modelValue.points = 10; + } + } + }, computed:{ showInView(){ this.vd.__showInView = this.visible && this.parent.visible; diff --git a/src/lib/MeshUtils.js b/src/lib/MeshUtils.js index 8135397..594b0e2 100644 --- a/src/lib/MeshUtils.js +++ b/src/lib/MeshUtils.js @@ -78,7 +78,6 @@ class MeshUtils { let group = new Group(); group.userData.bbox = this.getBoundingBox(object); group.add(object); - group.userData.object = object; group.isWrapper = true; return group; } @@ -92,7 +91,7 @@ class MeshUtils { bottomOrigin(object){ let group = this.centerOrigin(object); - group.userData.object.position.y = -group.userData.bbox.min.y + group.children[0].position.y = -group.userData.bbox.min.y return group; }