Commit 56d675c8 authored by zjz1994's avatar zjz1994

卡游戏显示默认北京页Bug

parent 27d77726
......@@ -96,9 +96,20 @@ export default class SceneCtrl {
// scene.start(data);
// }, this);
// scene.addEventListener(egret.Event.ADDED_TO_STAGE,this.sceneAddStateListener,this);
let oldScene:Scene;
if(this.currentScene){
oldScene = this.currentScene;
}
scene.once(egret.Event.ADDED_TO_STAGE, () => {
// console.log("addToStageListener",scene.skinName);
scene.start(data);
if(oldScene){
console.log("移除scene------------",oldScene.skinName);
oldScene.parent&&oldScene.parent.removeChild(oldScene);
oldScene.destroy();
oldScene = null;
}
}, this);
scene.onLoad().then(() => {
// console.log("onLoad---after",scene.skinName);
......@@ -126,18 +137,19 @@ export default class SceneCtrl {
}
private addToStage(scene: Scene) {
let oldScene: Scene;
if (this._currentScene) {
oldScene = this._currentScene;
}
// let oldScene: Scene;
// if (this._currentScene) {
// oldScene = this._currentScene;
// }
this._currentScene = scene;
this._parent.addChild(scene);
wait(1000).then(()=>{
if(oldScene) {
oldScene.destroy();
this._parent.removeChild(oldScene);
}
});
// console.log("场景切换",scene.skinName,oldScene.skinName);
// wait(1000).then(()=>{
// if(oldScene) {
// oldScene.destroy();
// this._parent.removeChild(oldScene);
// }
// });
}
_sceneClassMap: any;
......
......@@ -417,6 +417,9 @@ export default class MainScene extends Scene {
this.mapContainer = new egret.DisplayObjectContainer();
this.addChild(this.mapContainer);
this.wormholeContainer = new egret.DisplayObjectContainer();
this.addChild(this.wormholeContainer);
//修改流沙的问题
this.mapupContainer = new egret.DisplayObjectContainer();
this.addChild(this.mapupContainer);
......@@ -479,6 +482,7 @@ export default class MainScene extends Scene {
this.effectContainer.removeChildren();
this.guideContainer.removeChildren();
this.festivalContainer.removeChildren();
this.wormholeContainer.removeChildren();
}
async start(data) {
super.start();
......@@ -883,16 +887,6 @@ export default class MainScene extends Scene {
this.map = bg;
this.map.addChild(conveyor);
this.wormholeContainer = new egret.DisplayObjectContainer();
this.addChild(this.wormholeContainer);
//修改流沙的问题
this.mapupContainer = new egret.DisplayObjectContainer();
this.addChild(this.mapupContainer);
//容器
this.elementContainer = new egret.DisplayObjectContainer();
this.addChild(this.elementContainer);
//加遮罩,大遮罩一直都加,小遮罩时时判断
if(this.elementConMask){
this.elementConMask.graphics.clear();
......@@ -1614,7 +1608,7 @@ export default class MainScene extends Scene {
}
removeEvents() {
// console.log('mainscene-----移除事件监听------removeEvents');
console.log('mainscene-------removeEvents');
this.removeEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
this.settingBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_settingBtn, this);
this.questionBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_questionBtn, this)
......@@ -1633,11 +1627,6 @@ export default class MainScene extends Scene {
this.propBtnCon.stepBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_stepBtn, this)
//容器事件
this.elementContainer.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.mouseDownE, this);
this.elementContainer.removeEventListener(egret.TouchEvent.TOUCH_MOVE, this.mouseMoveE, this);
this.reCoverAllLattice();
//回收炮台相关动画
for(var i=0;i<this.cannoEffect.length;i++){
......@@ -1661,6 +1650,10 @@ export default class MainScene extends Scene {
}
this.cannoEffect = new Array();
}
destroy() {
console.log("mainscene-------------destroy");
super.destroy();
}
onEnterFrame() {
if(this.enableTouch && !this.gameGuide) {
......
......@@ -741,7 +741,7 @@ export default class MapScene extends Scene {
}
destroy() {
// console.log("map销毁");
console.log("map------------destroy");
super.destroy();
// this.removeIcon();
......@@ -1238,6 +1238,7 @@ export default class MapScene extends Scene {
}
protected removeEvents(){
console.log("map-----------removeEvents");
this['goldBtn'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_goldBtn, this);
this['guide'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_guide, this);
// this['act2Btn'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_act2btn, this);
......
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