async scenetransition

This commit is contained in:
yhh
2020-06-30 21:42:51 +08:00
parent db7aac2b90
commit 099aa749e1
3 changed files with 7 additions and 8 deletions

View File

@@ -12,7 +12,7 @@ class FadeTransition extends SceneTransition {
this._mask = new egret.Shape(); this._mask = new egret.Shape();
} }
public onBeginTransition() { public async onBeginTransition() {
this._mask.graphics.beginFill(this.fadeToColor, 1); this._mask.graphics.beginFill(this.fadeToColor, 1);
this._mask.graphics.drawRect(0, 0, SceneManager.stage.stageWidth, SceneManager.stage.stageHeight); this._mask.graphics.drawRect(0, 0, SceneManager.stage.stageWidth, SceneManager.stage.stageHeight);
this._mask.graphics.endFill(); this._mask.graphics.endFill();

View File

@@ -37,8 +37,8 @@ abstract class SceneTransition {
} }
public onBeginTransition() { public async onBeginTransition() {
this.loadNextScene(); await this.loadNextScene();
this.transitionComplete(); this.transitionComplete();
} }

View File

@@ -56,11 +56,10 @@ class WindTransition extends SceneTransition {
SceneManager.stage.addChild(this._mask); SceneManager.stage.addChild(this._mask);
} }
public onBeginTransition() { public async onBeginTransition() {
this.loadNextScene(); this.loadNextScene();
this.tickEffectProgressProperty(this._windEffect, this.duration, this.easeType).then(()=>{ await this.tickEffectProgressProperty(this._windEffect, this.duration, this.easeType);
this.transitionComplete(); this.transitionComplete();
SceneManager.stage.removeChild(this._mask); SceneManager.stage.removeChild(this._mask);
});
} }
} }