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();
}
public onBeginTransition() {
public async onBeginTransition() {
this._mask.graphics.beginFill(this.fadeToColor, 1);
this._mask.graphics.drawRect(0, 0, SceneManager.stage.stageWidth, SceneManager.stage.stageHeight);
this._mask.graphics.endFill();

View File

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

View File

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