SceneManager更改为Core继承egret.DisplayContainer

This commit is contained in:
yhh
2020-07-23 15:39:18 +08:00
parent 347626a8ea
commit 79c5d6990c
25 changed files with 832 additions and 622 deletions

View File

@@ -66,8 +66,8 @@ module es {
constructor(){
super(PostProcessor.default_vert, GaussianBlurEffect.blur_frag,{
screenWidth: SceneManager.stage.stageWidth,
screenHeight: SceneManager.stage.stageHeight
screenWidth: Core.graphicsDevice.viewport.width,
screenHeight: Core.graphicsDevice.viewport.height
});
}
}

View File

@@ -1,12 +1,20 @@
module es {
export class GraphicsDevice {
private viewport: Viewport;
private _viewport: Viewport;
public get viewport(): Viewport{
return this._viewport;
}
public graphicsCapabilities: GraphicsCapabilities;
constructor(){
this.setup();
this.graphicsCapabilities = new GraphicsCapabilities();
this.graphicsCapabilities.initialize(this);
}
private setup(){
this._viewport = new Viewport(0, 0, Core._instance.stage.stageWidth, Core._instance.stage.stageHeight);
}
}
}

View File

@@ -32,7 +32,7 @@ module es {
this.scene = scene;
this.shape = new egret.Shape();
this.shape.graphics.beginFill(0xFFFFFF, 1);
this.shape.graphics.drawRect(0, 0, SceneManager.stage.stageWidth, SceneManager.stage.stageHeight);
this.shape.graphics.drawRect(0, 0, Core.graphicsDevice.viewport.width, Core.graphicsDevice.viewport.height);
this.shape.graphics.endFill();
scene.addChild(this.shape);
}

View File

@@ -15,9 +15,8 @@ module es {
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.drawRect(0, 0, Core.graphicsDevice.viewport.width, Core.graphicsDevice.viewport.height);
this._mask.graphics.endFill();
SceneManager.stage.addChild(this._mask);
egret.Tween.get(this).to({ _alpha: 1}, this.fadeOutDuration * 1000, this.fadeEaseType)
.call(async () => {
@@ -25,7 +24,6 @@ module es {
}).wait(this.delayBeforeFadeInDuration).call(() => {
egret.Tween.get(this).to({ _alpha: 0 }, this.fadeOutDuration * 1000, this.fadeEaseType).call(() => {
this.transitionComplete();
SceneManager.stage.removeChild(this._mask);
});
});
}
@@ -33,7 +31,7 @@ module es {
public render(){
this._mask.graphics.clear();
this._mask.graphics.beginFill(this.fadeToColor, this._alpha);
this._mask.graphics.drawRect(0, 0, SceneManager.stage.stageWidth, SceneManager.stage.stageHeight);
this._mask.graphics.drawRect(0, 0, Core.graphicsDevice.viewport.width, Core.graphicsDevice.viewport.height);
this._mask.graphics.endFill();
}
}

View File

@@ -44,7 +44,7 @@ module es {
}
protected transitionComplete() {
SceneManager.sceneTransition = null;
Core._instance._sceneTransition = null;
if (this.onTransitionCompleted) {
this.onTransitionCompleted();
@@ -59,7 +59,7 @@ module es {
this.isNewSceneLoaded = true;
}
SceneManager.scene = await this.sceneLoadAction();
Core.scene = await this.sceneLoadAction();
this.isNewSceneLoaded = true;
}

View File

@@ -51,17 +51,15 @@ module es {
this._mask = new egret.Shape();
this._mask.graphics.beginFill(0xFFFFFF, 1);
this._mask.graphics.drawRect(0, 0, SceneManager.stage.stageWidth, SceneManager.stage.stageHeight);
this._mask.graphics.drawRect(0, 0, Core.graphicsDevice.viewport.width, Core.graphicsDevice.viewport.height);
this._mask.graphics.endFill();
this._mask.filters = [this._windEffect];
SceneManager.stage.addChild(this._mask);
}
public async onBeginTransition() {
this.loadNextScene();
await this.tickEffectProgressProperty(this._windEffect, this.duration, this.easeType);
this.transitionComplete();
SceneManager.stage.removeChild(this._mask);
}
}
}

View File

@@ -7,6 +7,20 @@ module es {
private _minDepth: number;
private _maxDepth: number;
public get height(){
return this._height;
}
public set height(value: number){
this._height = value;
}
public get width(){
return this._width;
}
public set width(value: number){
this._width = value;
}
public get aspectRatio(){
if ((this._height != 0) && (this._width != 0))
return (this._width / this._height);