Commit 271341df authored by liujiangnan's avatar liujiangnan

Merge branch 'master' of http://vcs.ireadabc.com/template/LWD_3

parents 0a30bf35 da158981
...@@ -32,6 +32,8 @@ var game = cc.Class({ ...@@ -32,6 +32,8 @@ var game = cc.Class({
}, },
ctor: function () { ctor: function () {
this._timeoutIds = [];
this._intervalIds = [];
game.inst = this; game.inst = this;
LWD_3.game = game; LWD_3.game = game;
}, },
...@@ -146,9 +148,9 @@ var game = cc.Class({ ...@@ -146,9 +148,9 @@ var game = cc.Class({
.start(); .start();
} }
setTimeout(() => { this._timeoutIds.push(setTimeout(() => {
this.UpdataUi(); this.UpdataUi();
}, 1000); }, 1000));
} }
}, },
...@@ -156,9 +158,9 @@ var game = cc.Class({ ...@@ -156,9 +158,9 @@ var game = cc.Class({
finish() { finish() {
this.playLionDragon("normal") this.playLionDragon("normal")
this.playCatDragon("finish") this.playCatDragon("finish")
setTimeout(() => { this._timeoutIds(setTimeout(() => {
LWD_3.speaker.inst.playEffect(LWD_3.enum.E_Audio.CatComplete); LWD_3.speaker.inst.playEffect(LWD_3.enum.E_Audio.CatComplete);
}, 500) }, 500));
}, },
//检测放到哪个节点底下 //检测放到哪个节点底下
...@@ -327,4 +329,15 @@ var game = cc.Class({ ...@@ -327,4 +329,15 @@ var game = cc.Class({
this.onBtnReStart(); this.onBtnReStart();
} }
}, },
_timeoutIds: null,
_intervalIds: null,
// 生命周期
onDestroy() {
this._timeoutIds.forEach(id => {
clearTimeout(id);
});
this._intervalIds.forEach(id => {
clearInterval(id);
});
},
}); });
...@@ -15,6 +15,8 @@ var eff_well = cc.Class({ ...@@ -15,6 +15,8 @@ var eff_well = cc.Class({
ctor: function () { ctor: function () {
eff_well.inst = this; eff_well.inst = this;
LWD_3.eff_well = eff_well; LWD_3.eff_well = eff_well;
this._timeoutIds = [];
this._intervalIds = [];
}, },
//显示特效 //显示特效
...@@ -23,8 +25,19 @@ var eff_well = cc.Class({ ...@@ -23,8 +25,19 @@ var eff_well = cc.Class({
this.eff_welldown.play(); this.eff_welldown.play();
//播放撒花音效 //播放撒花音效
LWD_3.speaker.inst.play_congratulation(); LWD_3.speaker.inst.play_congratulation();
setTimeout(() => { this._timeoutIds.push(setTimeout(() => {
this.node.active = false; this.node.active = false;
}, 2000) }, 2000));
} },
_timeoutIds: null,
_intervalIds: null,
// 生命周期
onDestroy() {
this._timeoutIds.forEach(id => {
clearTimeout(id);
});
this._intervalIds.forEach(id => {
clearInterval(id);
});
},
}); });
...@@ -21,6 +21,8 @@ cc.Class({ ...@@ -21,6 +21,8 @@ cc.Class({
}, },
start: function () { start: function () {
this._timeoutIds = [];
this._intervalIds = [];
this.node.on(cc.Node.EventType.TOUCH_START, this.touchBegan, this); this.node.on(cc.Node.EventType.TOUCH_START, this.touchBegan, this);
this.node.on(cc.Node.EventType.TOUCH_MOVE, this.touchMove, this); this.node.on(cc.Node.EventType.TOUCH_MOVE, this.touchMove, this);
this.node.on(cc.Node.EventType.TOUCH_END, this.touchEnd, this); this.node.on(cc.Node.EventType.TOUCH_END, this.touchEnd, this);
...@@ -52,6 +54,7 @@ cc.Class({ ...@@ -52,6 +54,7 @@ cc.Class({
}); });
} }
}, 1000) }, 1000)
this._intervalIds.push(this.timer);
this.isMove = false; this.isMove = false;
this.deltaPos = this.node.x + this.node.y; this.deltaPos = this.node.x + this.node.y;
}, },
...@@ -136,7 +139,7 @@ cc.Class({ ...@@ -136,7 +139,7 @@ cc.Class({
//先播放错误声音 //先播放错误声音
LWD_3.speaker.inst.playEffect(LWD_3.enum.E_Audio.Right); LWD_3.speaker.inst.playEffect(LWD_3.enum.E_Audio.Right);
setTimeout(() => { this._timeoutIds.push(setTimeout(() => {
LWD_3.game.inst.playCatDragon("right"); LWD_3.game.inst.playCatDragon("right");
let num = LWD_3.utils.randFromTo_Int(LWD_3.enum.E_Audio.CatRight1, LWD_3.enum.E_Audio.CatRight2); let num = LWD_3.utils.randFromTo_Int(LWD_3.enum.E_Audio.CatRight1, LWD_3.enum.E_Audio.CatRight2);
...@@ -149,7 +152,7 @@ cc.Class({ ...@@ -149,7 +152,7 @@ cc.Class({
LWD_3.data_mgr.quesId += 1; LWD_3.data_mgr.quesId += 1;
LWD_3.game.inst.resetQues(); LWD_3.game.inst.resetQues();
} }
}, 500) }, 500));
// LWD_3.data_mgr.nowNum -= 1; // LWD_3.data_mgr.nowNum -= 1;
// if (LWD_3.data_mgr.nowNum == 0) { // if (LWD_3.data_mgr.nowNum == 0) {
...@@ -185,7 +188,7 @@ cc.Class({ ...@@ -185,7 +188,7 @@ cc.Class({
.to(0.15, { scaleY: 1.1, scaleX: 0.9 }) .to(0.15, { scaleY: 1.1, scaleX: 0.9 })
.to(0.1, { scaleY: 1, scaleX: 1 }) .to(0.1, { scaleY: 1, scaleX: 1 })
.start() .start()
setTimeout(() => { this._timeoutIds.push(setTimeout(() => {
//回到原来的位置 //回到原来的位置
this.node.x = 0; this.node.x = 0;
this.node.y = 0; this.node.y = 0;
...@@ -198,7 +201,7 @@ cc.Class({ ...@@ -198,7 +201,7 @@ cc.Class({
}); });
LWD_3.game.inst.playCatDragon("wrong"); LWD_3.game.inst.playCatDragon("wrong");
LWD_3.game.inst.playLionDragon("normal"); LWD_3.game.inst.playLionDragon("normal");
}, 500) }, 500));
}, },
//触摸取消 //触摸取消
...@@ -230,9 +233,9 @@ cc.Class({ ...@@ -230,9 +233,9 @@ cc.Class({
onBtnRotate: function () { onBtnRotate: function () {
var scaleX = this.node.scaleY; var scaleX = this.node.scaleY;
this._isRotate = true; this._isRotate = true;
setTimeout(() => { this._timeoutIds.push(setTimeout(() => {
this._isRotate = false; this._isRotate = false;
}, 600) }, 600));
cc.tween(this.node) cc.tween(this.node)
.to(0.3, { scaleX: 0 }) .to(0.3, { scaleX: 0 })
...@@ -274,4 +277,15 @@ cc.Class({ ...@@ -274,4 +277,15 @@ cc.Class({
node.scaleX *= maxSize; node.scaleX *= maxSize;
node.scaleY *= maxSize; node.scaleY *= maxSize;
}, },
_timeoutIds: null,
_intervalIds: null,
// 生命周期
onDestroy() {
this._timeoutIds.forEach(id => {
clearTimeout(id);
});
this._intervalIds.forEach(id => {
clearInterval(id);
});
},
}); });
...@@ -162,6 +162,7 @@ LWD_3.data_mgr = { ...@@ -162,6 +162,7 @@ LWD_3.data_mgr = {
LWD_3.game.inst.hintPlay(); LWD_3.game.inst.hintPlay();
} }
}, 1000) }, 1000)
g.game.inst._intervalIds.push(this.timer);
LWD_3.game.inst.isLoadEnd = true; LWD_3.game.inst.isLoadEnd = true;
}, },
......
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