Commit f3e6ad3f authored by Tt's avatar Tt

移除多余节点

parent 3f440434
...@@ -35,6 +35,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -35,6 +35,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.event.clear(); pg.event.clear();
} }
async onLoadEnd() { async onLoadEnd() {
pg.event.clear();
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考 // TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData() this.initData()
this.initView() this.initView()
...@@ -109,11 +110,12 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -109,11 +110,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
private isEnding: boolean; private isEnding: boolean;
gameOver() { gameOver() {
this.isEnding = true; this.isEnding = true;
this.clearAllChild();
this.sendData(this.data.questions.length * 3).then(() => { this.sendData(this.data.questions.length * 3).then(() => {
})
const middleLayer = cc.find('middleLayer').getComponent('middleLayer'); const middleLayer = cc.find('middleLayer').getComponent('middleLayer');
middleLayer.saveGolds(this.data.questions.length * 3); // 保存金币数量;num 是获得金币的数量,数字类型; middleLayer.saveGolds(this.data.questions.length * 3); // 保存金币数量;num 是获得金币的数量,数字类型;
middleLayer.goNextPage(); // 跳转到下一页 middleLayer.goNextPage(); // 跳转到下一页
})
} }
private rightList: Array<any>; private rightList: Array<any>;
private startCreate: boolean; private startCreate: boolean;
...@@ -238,6 +240,18 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -238,6 +240,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
stopFly(item) { stopFly(item) {
cc.Tween.stopAllByTarget(item); cc.Tween.stopAllByTarget(item);
} }
clearAllChild() {
// let layer_paopao = pg.view.find(this, 'layer_game/layer_paopao')
// let children = layer_paopao.children;
// children.forEach((node, i) => {
// if (this.rightList.some(dt => node.data.id == dt.id)) return;
// cc.Tween.stopAllByTarget(node);
// cc.tween(node).by(0.5 + (i / children.length) * 0.5, { y: -1500 }).call(() => {
// node.active = false;
// }).start();
// })
pg.view.find(this, 'layer_game/layer_paopao').removeAllChildren();
}
// 点击泡泡 // 点击泡泡
touchPaoPao(e: any) { touchPaoPao(e: any) {
if (this.isEnding) return; if (this.isEnding) return;
...@@ -274,7 +288,6 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -274,7 +288,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
this.scheduleOnce(() => { this.scheduleOnce(() => {
item.parent = null; item.parent = null;
this.canTouch = true;
if (this.rightList.length == this.currentRightList.length) { if (this.rightList.length == this.currentRightList.length) {
cc.Tween.stopAll(); cc.Tween.stopAll();
this.startCreate = false; this.startCreate = false;
......
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