新增windTransition例子
This commit is contained in:
Vendored
+3
-1
@@ -374,7 +374,7 @@ declare module es {
|
||||
unload(): void;
|
||||
onActive(): void;
|
||||
onDeactive(): void;
|
||||
begin(): Promise<void>;
|
||||
begin(): void;
|
||||
end(): void;
|
||||
update(): void;
|
||||
render(): void;
|
||||
@@ -1257,6 +1257,7 @@ declare module es {
|
||||
private _alpha;
|
||||
constructor(sceneLoadAction: Function);
|
||||
onBeginTransition(): Promise<void>;
|
||||
protected transitionComplete(): void;
|
||||
render(): void;
|
||||
}
|
||||
}
|
||||
@@ -1270,6 +1271,7 @@ declare module es {
|
||||
windSegments: number;
|
||||
size: number;
|
||||
onBeginTransition(): Promise<void>;
|
||||
protected transitionComplete(): void;
|
||||
}
|
||||
}
|
||||
declare module es {
|
||||
|
||||
+26
-18
@@ -1675,24 +1675,19 @@ var es;
|
||||
Scene.prototype.onDeactive = function () {
|
||||
};
|
||||
Scene.prototype.begin = function () {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
if (this._renderers.length == 0) {
|
||||
this.addRenderer(new es.DefaultRenderer());
|
||||
console.warn("场景开始时没有渲染器 自动添加DefaultRenderer以保证能够正常渲染");
|
||||
}
|
||||
this.camera = this.createEntity("camera").getOrCreateComponent(new es.Camera());
|
||||
es.Physics.reset();
|
||||
if (this.entityProcessors)
|
||||
this.entityProcessors.begin();
|
||||
this.addEventListener(egret.Event.ACTIVATE, this.onActive, this);
|
||||
this.addEventListener(egret.Event.DEACTIVATE, this.onDeactive, this);
|
||||
this.camera.onSceneSizeChanged(this.stage.stageWidth, this.stage.stageHeight);
|
||||
this._didSceneBegin = true;
|
||||
this.onStart();
|
||||
return [2];
|
||||
});
|
||||
});
|
||||
if (this._renderers.length == 0) {
|
||||
this.addRenderer(new es.DefaultRenderer());
|
||||
console.warn("场景开始时没有渲染器 自动添加DefaultRenderer以保证能够正常渲染");
|
||||
}
|
||||
this.camera = this.createEntity("camera").getOrCreateComponent(new es.Camera());
|
||||
es.Physics.reset();
|
||||
if (this.entityProcessors)
|
||||
this.entityProcessors.begin();
|
||||
this.addEventListener(egret.Event.ACTIVATE, this.onActive, this);
|
||||
this.addEventListener(egret.Event.DEACTIVATE, this.onDeactive, this);
|
||||
this.camera.onSceneSizeChanged(this.stage.stageWidth, this.stage.stageHeight);
|
||||
this._didSceneBegin = true;
|
||||
this.onStart();
|
||||
};
|
||||
Scene.prototype.end = function () {
|
||||
this._didSceneBegin = false;
|
||||
@@ -5865,6 +5860,8 @@ var es;
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var _this = this;
|
||||
return __generator(this, function (_a) {
|
||||
if (!this._mask.parent)
|
||||
es.Core.scene.stage.addChild(this._mask);
|
||||
this._mask.graphics.beginFill(this.fadeToColor, 1);
|
||||
this._mask.graphics.drawRect(0, 0, es.Core.graphicsDevice.viewport.width, es.Core.graphicsDevice.viewport.height);
|
||||
this._mask.graphics.endFill();
|
||||
@@ -5887,6 +5884,11 @@ var es;
|
||||
});
|
||||
});
|
||||
};
|
||||
FadeTransition.prototype.transitionComplete = function () {
|
||||
_super.prototype.transitionComplete.call(this);
|
||||
if (this._mask.parent)
|
||||
this._mask.parent.removeChild(this._mask);
|
||||
};
|
||||
FadeTransition.prototype.render = function () {
|
||||
this._mask.graphics.clear();
|
||||
this._mask.graphics.beginFill(this.fadeToColor, this._alpha);
|
||||
@@ -5938,6 +5940,7 @@ var es;
|
||||
_this._mask.graphics.drawRect(0, 0, es.Core.graphicsDevice.viewport.width, es.Core.graphicsDevice.viewport.height);
|
||||
_this._mask.graphics.endFill();
|
||||
_this._mask.filters = [_this._windEffect];
|
||||
es.Core.scene.stage.addChild(_this._mask);
|
||||
return _this;
|
||||
}
|
||||
Object.defineProperty(WindTransition.prototype, "windSegments", {
|
||||
@@ -5969,6 +5972,11 @@ var es;
|
||||
});
|
||||
});
|
||||
};
|
||||
WindTransition.prototype.transitionComplete = function () {
|
||||
_super.prototype.transitionComplete.call(this);
|
||||
if (this._mask.parent)
|
||||
this._mask.parent.removeChild(this._mask);
|
||||
};
|
||||
return WindTransition;
|
||||
}(es.SceneTransition));
|
||||
es.WindTransition = WindTransition;
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -85,7 +85,7 @@ module es {
|
||||
public onDeactive() {
|
||||
}
|
||||
|
||||
public async begin() {
|
||||
public begin() {
|
||||
if (this._renderers.length == 0) {
|
||||
this.addRenderer(new DefaultRenderer());
|
||||
console.warn("场景开始时没有渲染器 自动添加DefaultRenderer以保证能够正常渲染");
|
||||
|
||||
@@ -14,6 +14,9 @@ module es {
|
||||
}
|
||||
|
||||
public async onBeginTransition() {
|
||||
if (!this._mask.parent)
|
||||
Core.scene.stage.addChild(this._mask);
|
||||
|
||||
this._mask.graphics.beginFill(this.fadeToColor, 1);
|
||||
this._mask.graphics.drawRect(0, 0, Core.graphicsDevice.viewport.width, Core.graphicsDevice.viewport.height);
|
||||
this._mask.graphics.endFill();
|
||||
@@ -28,6 +31,13 @@ module es {
|
||||
});
|
||||
}
|
||||
|
||||
protected transitionComplete(){
|
||||
super.transitionComplete();
|
||||
|
||||
if (this._mask.parent)
|
||||
this._mask.parent.removeChild(this._mask);
|
||||
}
|
||||
|
||||
public render() {
|
||||
this._mask.graphics.clear();
|
||||
this._mask.graphics.beginFill(this.fadeToColor, this._alpha);
|
||||
|
||||
@@ -48,6 +48,7 @@ module es {
|
||||
this._mask.graphics.drawRect(0, 0, Core.graphicsDevice.viewport.width, Core.graphicsDevice.viewport.height);
|
||||
this._mask.graphics.endFill();
|
||||
this._mask.filters = [this._windEffect];
|
||||
Core.scene.stage.addChild(this._mask);
|
||||
}
|
||||
|
||||
public set windSegments(value: number) {
|
||||
@@ -63,5 +64,12 @@ module es {
|
||||
await this.tickEffectProgressProperty(this._windEffect, this.duration, this.easeType);
|
||||
this.transitionComplete();
|
||||
}
|
||||
|
||||
protected transitionComplete() {
|
||||
super.transitionComplete();
|
||||
|
||||
if (this._mask.parent)
|
||||
this._mask.parent.removeChild(this._mask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user