Commit f3e6ad3f authored by Tt's avatar Tt

移除多余节点

parent 3f440434
......@@ -35,6 +35,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.event.clear();
}
async onLoadEnd() {
pg.event.clear();
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData()
this.initView()
......@@ -60,7 +61,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
private audioId: any;
onTouchVoice() {
if (this.isEnding) return;
if (this.isEnding) return;
if (!this.canTouch) return;
if (this.audioId) {
cc.audioEngine.stopEffect(this.audioId);
......@@ -109,11 +110,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
private isEnding: boolean;
gameOver() {
this.isEnding = true;
this.clearAllChild();
this.sendData(this.data.questions.length * 3).then(() => {
const middleLayer = cc.find('middleLayer').getComponent('middleLayer');
middleLayer.saveGolds(this.data.questions.length * 3); // 保存金币数量;num 是获得金币的数量,数字类型;
middleLayer.goNextPage(); // 跳转到下一页
})
const middleLayer = cc.find('middleLayer').getComponent('middleLayer');
middleLayer.saveGolds(this.data.questions.length * 3); // 保存金币数量;num 是获得金币的数量,数字类型;
middleLayer.goNextPage(); // 跳转到下一页
}
private rightList: Array<any>;
private startCreate: boolean;
......@@ -238,9 +240,21 @@ export default class SceneComponent extends MyCocosSceneComponent {
stopFly(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) {
if (this.isEnding) return;
if (this.isEnding) return;
if (!this.canTouch) return;
this.canTouch = false;
// 如果泡泡没有到指定位置不允许点击
......@@ -274,7 +288,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
this.scheduleOnce(() => {
item.parent = null;
this.canTouch = true;
if (this.rightList.length == this.currentRightList.length) {
cc.Tween.stopAll();
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