Commit 44ab19be authored by 汪欢's avatar 汪欢

拼图倒计时

parent 9f9c4064
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -69,14 +69,20 @@ export default class GameView extends engine.Container { ...@@ -69,14 +69,20 @@ export default class GameView extends engine.Container {
this.onTimer(); this.onTimer();
}, 10) }, 10)
} }
// this._timeCounter += 0.01;
// this._timeCounter = this.afterPointTwo(this._timeCounter);
// this._timeCounter = Math.floor((this._timeCounter + 0.1) * 10) / 10;
// console.log(this._timeCounter)
onTimer() { onTimer() {
// this._timeCounter++;
this._timeCounter += 0.01;
this._timeCounter = this.afterPointTwo(this._timeCounter); // 以GAME_TIME为标准
// this._timeCounter = Math.floor((this._timeCounter + 0.1) * 10) / 10; GAME_TIME -= 0.01
// console.log(this._timeCounter) GAME_TIME = this.afterPointTwo(GAME_TIME);
console.log(GAME_TIME);
engine.globalEvent.dispatchEvent('pictures-time-update', { engine.globalEvent.dispatchEvent('pictures-time-update', {
second: this.getSecond(), second: this.getSecond(),
...@@ -100,13 +106,14 @@ export default class GameView extends engine.Container { ...@@ -100,13 +106,14 @@ export default class GameView extends engine.Container {
} }
getSecond() { getSecond() {
return GAME_TIME - this._timeCounter; return GAME_TIME
// return GAME_TIME - this.countTime; // return GAME_TIME - this._timeCounter;
} }
stop() { stop() {
this._timeCounter = 0; // this._timeCounter = 0;
GAME_TIME = props.GAME_TIME
clearInterval(this._timer); clearInterval(this._timer);
} }
......
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