Commit 0c261be1 authored by wildfirecode's avatar wildfirecode

1

parent a65da7ca
This diff is collapsed.
......@@ -53,7 +53,7 @@ function launchWithCustomModule(customModule) {
}, 500);
});
engine.globalEvent.addEventListener('pictures-time-update', (e) => {
console.log(e.type, e.data);
// console.log(e.type, e.data);
});
engine.globalEvent.addEventListener('pictures-game-fail', (e) => {
console.log(e.type, e.data);
......
This diff is collapsed.
This diff is collapsed.
......@@ -5,12 +5,12 @@
"MAX_COL": {
"alias": "图片分成几列",
"type": "number",
"default": 3
"default": 2
},
"MAX_ROW": {
"alias": "图片分成几行",
"type": "number",
"default": 4
"default": 2
},
"W": {
"alias": "图片的宽度",
......@@ -30,7 +30,7 @@
"GAME_TIME": {
"alias": "游戏时间",
"type": "number",
"default": 20
"default": 50
}
},
......
......@@ -60,9 +60,9 @@ export default class GameView extends engine.Container {
}
// this._timer = setInterval(() => {
// this.onTimer();
// }, 10)
this._timer = setInterval(() => {
this.onTimer();
}, 10)
}
......@@ -71,7 +71,7 @@ export default class GameView extends engine.Container {
this._timeCounter += 0.01;
this._timeCounter = this.afterPointTwo(this._timeCounter);
// this._timeCounter = Math.floor((this._timeCounter + 0.1) * 10) / 10;
console.log(this._timeCounter)
// console.log(this._timeCounter)
engine.globalEvent.dispatchEvent('pictures-time-update', {
second: this.getSecond(),
......@@ -100,7 +100,6 @@ export default class GameView extends engine.Container {
}
stop() {
// this.countTime = 0
this._timeCounter = 0;
clearInterval(this._timer);
......@@ -302,15 +301,15 @@ export default class GameView extends engine.Container {
private onSuccess() {
console.log('拼图成功!');
this.stop();
engine.globalEvent.dispatchEvent('pictures-game-success', { time: this._timeCounter });
this.stop();
}
onMove(e: engine.MouseEvent) {
// 当前图片的位置
this.dragPic.x = e.stageX - this.localPicX;
this.dragPic.y = e.stageY - this.localPicY;
console.log(this.dragPic.x, this.dragPic.y)
// console.log(this.dragPic.x, this.dragPic.y)
// 当前图片的中心位置
this.centerX = this.dragPic.x + w / 2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment