maxPoints

This commit is contained in:
2026-04-13 08:43:30 +03:00
parent 36bd33b1f9
commit c69070fdc8
10 changed files with 31 additions and 9 deletions
@@ -30,6 +30,7 @@ export default {
this.modelValue.title = e.name this.modelValue.title = e.name
this.modelValue.exclude = true this.modelValue.exclude = true
} }
} },
__noPoints: true
} }
</script> </script>
@@ -5,6 +5,9 @@ class GenericObject extends EventManager{
#actions = []; #actions = [];
constructor(engine, data){ constructor(engine, data){
super(); super();
if (!data.description || data.exclude){
this.maxPoints = 0;
}
return new Promise(async(resolve, reject)=>{ return new Promise(async(resolve, reject)=>{
this.source = await engine.load(data.$go.asset.name); this.source = await engine.load(data.$go.asset.name);
this.object = engine.meshUtils.bottomOrigin(this.source.scene) this.object = engine.meshUtils.bottomOrigin(this.source.scene)
@@ -44,6 +44,8 @@ class ImageObject extends EventManager{
textScrolledCallback: ()=>{ this.dispatchEvent({type:'finish'}); } textScrolledCallback: ()=>{ this.dispatchEvent({type:'finish'}); }
}) })
}) })
}else{
this.maxPoints = 0
} }
resolve(this) resolve(this)
@@ -77,6 +77,7 @@ class InteractiveObject extends EventManager{
engine.tm?.setGameObject(obj.id); engine.tm?.setGameObject(obj.id);
}) })
} }
['minPoints', 'maxPoints'].filter(p=>this.io[p] !== undefined).forEach(p=> this[p] = this.io[p] )
break; break;
} }
if (obj.shouldBeLocked){ if (obj.shouldBeLocked){
@@ -43,6 +43,7 @@ export default {
this.modelValue.h = 50; this.modelValue.h = 50;
this.modelValue.exclude = true; this.modelValue.exclude = true;
} }
} },
__noPoints: true
} }
</script> </script>
@@ -46,7 +46,8 @@ export default {
return data.__root.scenes.find(s=>s.data.id == data.switchScene).data.environment; return data.__root.scenes.find(s=>s.data.id == data.switchScene).data.environment;
} }
}) })
} },
__noPoints: true
} }
</script> </script>
@@ -17,6 +17,7 @@ export default {
modelValue: Object modelValue: Object
}, },
methods:{ methods:{
} },
__noPoints: true
} }
</script> </script>
@@ -21,6 +21,7 @@ export default {
modelValue: Object modelValue: Object
}, },
methods:{ methods:{
} },
__noPoints: true
} }
</script> </script>
+14 -2
View File
@@ -27,7 +27,7 @@
<v-form class="pt-4"> <v-form class="pt-4">
<v-text-field density="compact" :label="l.name" v-model="modelValue.title"></v-text-field> <v-text-field density="compact" :label="l.name" v-model="modelValue.title"></v-text-field>
<!-- <v-text-field density="compact" :label="l.id" v-model="modelValue.id"></v-text-field> --> <!-- <v-text-field density="compact" :label="l.id" v-model="modelValue.id"></v-text-field> -->
<v-number-input density="compact" :label="l.completionPoints" v-model="modelValue.points"></v-number-input> <v-number-input density="compact" v-if="!cpc[modelValue.type].__noPoints" :label="l.completionPoints" v-model="modelValue.points"></v-number-input>
</v-form> </v-form>
<div v-if="selected && modelValue.type"> <div v-if="selected && modelValue.type">
<component :is="modelValue.type" v-model="mv"></component> <component :is="modelValue.type" v-model="mv"></component>
@@ -69,6 +69,8 @@ const components = {
PuzzleGame1, PuzzleGame2, MazeQuizGame, Particles, ClassicPuzzle, PairMatchingGame, SingleQuestion, Teleporter PuzzleGame1, PuzzleGame2, MazeQuizGame, Particles, ClassicPuzzle, PairMatchingGame, SingleQuestion, Teleporter
}; };
import { markRaw } from 'vue';
export default { export default {
emits:['target', 'preview'], emits:['target', 'preview'],
props:{ props:{
@@ -80,14 +82,15 @@ export default {
visible: Boolean, visible: Boolean,
parent: Object parent: Object
}, },
components,
data(){ data(){
return { return {
InteractiveObjectTypes, InteractiveObjectTypes,
active: false, active: false,
activationTypes: ['unlock', 'appear'], activationTypes: ['unlock', 'appear'],
cpc: markRaw(components)
} }
}, },
components,
mounted(){ mounted(){
this.active = true; this.active = true;
this.modelValue.points ??= 10; this.modelValue.points ??= 10;
@@ -98,6 +101,15 @@ export default {
components[this.modelValue.type].__transform(this.modelValue) 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:{ computed:{
showInView(){ showInView(){
this.vd.__showInView = this.visible && this.parent.visible; this.vd.__showInView = this.visible && this.parent.visible;
+1 -2
View File
@@ -78,7 +78,6 @@ class MeshUtils {
let group = new Group(); let group = new Group();
group.userData.bbox = this.getBoundingBox(object); group.userData.bbox = this.getBoundingBox(object);
group.add(object); group.add(object);
group.userData.object = object;
group.isWrapper = true; group.isWrapper = true;
return group; return group;
} }
@@ -92,7 +91,7 @@ class MeshUtils {
bottomOrigin(object){ bottomOrigin(object){
let group = this.centerOrigin(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; return group;
} }