Commit 3a9081eb authored by 邱旭's avatar 邱旭

1

parent 6b27b6af
...@@ -33,18 +33,47 @@ export default class RainObj { ...@@ -33,18 +33,47 @@ export default class RainObj {
} }
private touchTap() { private touchTap() {
GDispatcher.dispatchEvent('hbGameAddScore', RainData.data[this.data.key].score); egret.Tween.removeTweens(this.module);
this.module.source = `hbGame_${this.data.key}_touch_png`;
this.moduleEffect(); // 模型特效
GDispatcher.dispatchEvent('hbGameAddScore', RainData.data[this.data.key].score); // 加分
this.addScoreEffect(); // 添加分数特效
this.destroy(); this.destroy();
} }
// 模型特效
private moduleEffect() {
let _scaleX = this.module.scaleX;
let _scaleY = this.module.scaleY;
egret.Tween.get(this.module).to({scaleX: _scaleX + 0.2, scaleY: _scaleY + 0.2}, 100).call(() => {
this.module.source = `hbGame_${this.data.key}_touch_png`;
egret.Tween.get(this.module).to({scaleX: _scaleX, scaleY: _scaleY}, 100);
});
}
// 添加分数特效
private addScoreEffect() {
setTimeout(() => {
let score = new eui.Image(`hbGame_+${RainData.data[this.data.key].score}_png`);
let _x = score.x = this.module.x - 20;
let _y = score.y = this.module.y;
score.scaleY = score.scaleX = 0.3;
score.alpha = 0;
this.rainGroup.addChild(score);
egret.Tween.get(score).to({y: _y - 60, scaleX: 1, scaleY: 1, alpha: 1}, 400).call(() => {
egret.Tween.get(score).to({y: _y - 120, alpha: 0}, 400).call(() => {
score.visible = false
});
});
}, 500);
}
private destroy() { private destroy() {
egret.Tween.removeTweens(this.module);
this.module.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.touchTap, this); this.module.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.touchTap, this);
this.module.touchEnabled = false; this.module.touchEnabled = false;
setTimeout(() => { setTimeout(() => {
this.rainGroup.removeChild(this.module); this.rainGroup.removeChild(this.module);
this.data.pool.push(this); this.data.pool.push(this);
}, 1000); }, 600);
} }
} }
\ No newline at end of file
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