change event dispatcher
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { BoxGeometry, Mesh, MeshStandardMaterial, Group } from 'three';
|
||||
import { BoxGeometry, Mesh, MeshStandardMaterial, Group, EventDispatcher } from 'three';
|
||||
import { MotionEngine } from '../../lib/MotionEngine';
|
||||
import { centerOrigin } from '@/lib/MeshUtils';
|
||||
|
||||
class PuzzleGame1 {
|
||||
class PuzzleGame1 extends EventDispatcher {
|
||||
constructor(engine, data) {
|
||||
super();
|
||||
return new Promise(async (resolve, reject)=>{
|
||||
let w = data.w, h = data.h, wh = w*h;
|
||||
let container = new Group();
|
||||
@@ -92,7 +93,9 @@ class PuzzleGame1 {
|
||||
o: c,
|
||||
a: { position: { x: i % w, y: Math.trunc(i/w)} },
|
||||
t: 1,
|
||||
f: i == 0 && this.onfinish || undefined
|
||||
f: i == 0 ? ()=>{
|
||||
this.dispatchEvent({type:'finish'})
|
||||
} : undefined
|
||||
});
|
||||
});
|
||||
//engine.dashboard.addPoints(10);
|
||||
|
||||
Reference in New Issue
Block a user