diff --git a/src/components/InteractiveObjects/GenenricObject.js b/src/components/InteractiveObjects/GenenricObject.js index e534f34..fa2d4ee 100644 --- a/src/components/InteractiveObjects/GenenricObject.js +++ b/src/components/InteractiveObjects/GenenricObject.js @@ -36,7 +36,7 @@ class GenericObject extends EventManager{ } } if (data.description){ - engine.dashboard.updateText(this.object.__onhud ? data.description : '', (d)=>{ + engine.dashboard.updateText(this.object.__onhud ? data.description : '', false, (d)=>{ d && this.dispatchEvent({type:'finish'}) }) } diff --git a/src/components/InteractiveObjects/InteractiveObject.js b/src/components/InteractiveObjects/InteractiveObject.js index e07c953..c77e118 100644 --- a/src/components/InteractiveObjects/InteractiveObject.js +++ b/src/components/InteractiveObjects/InteractiveObject.js @@ -64,6 +64,13 @@ class InteractiveObject extends EventManager{ // this.io.addEventListener?.(event, this.dispatchEvent.bind(this)) // }) this.io.forwardEvents?.(this); + if (this.emits?.includes('interaction')){ + this.io.once('interaction', ()=>{ + if (obj.introText){ + engine.dashboard.updateText(obj.introText, true) + } + }) + } break; } if (obj.shouldBeLocked){ diff --git a/src/components/InteractiveObjects/PairMatchingGame.js b/src/components/InteractiveObjects/PairMatchingGame.js index f59851d..c12e7bb 100644 --- a/src/components/InteractiveObjects/PairMatchingGame.js +++ b/src/components/InteractiveObjects/PairMatchingGame.js @@ -5,7 +5,7 @@ import { EventManager } from '@/lib/EventManager'; import Utils from '@/lib/Utils'; class PairMatchingGame extends EventManager { - emits = ['finish'] + emits = ['finish', 'interaction'] constructor(engine, data) { super(); return new Promise(async (resolve, reject)=>{ @@ -76,6 +76,7 @@ class PairMatchingGame extends EventManager { let actionDef = {material:{emissiveIntensity:k=>(1+Math.sin((k*2+1.5)*Math.PI))*4 }}; let clickFn = (i) => { + this.dispatchEvent({type:'interaction'}); let oc = clicked; if (done.includes(i.object.userData.gd.id)) return; clicked = i.object; diff --git a/src/components/InteractiveObjects/PairMatchingGame.vue b/src/components/InteractiveObjects/PairMatchingGame.vue index 08cc725..f781dc9 100644 --- a/src/components/InteractiveObjects/PairMatchingGame.vue +++ b/src/components/InteractiveObjects/PairMatchingGame.vue @@ -1,6 +1,7 @@