新增 _graphicsDeviceChangeTimer 用于凝聚GraphicsDeviceReset事件

This commit is contained in:
yhh
2020-11-26 10:39:32 +08:00
parent 918d998f4c
commit 1bb1b8704b
6 changed files with 110 additions and 65 deletions

View File

@@ -62,7 +62,7 @@ module es {
Physics.reset();
this.updateResolutionScaler();
if (this.entityProcessors)
if (this.entityProcessors != null)
this.entityProcessors.begin();
Core.emitter.addObserver(CoreEvents.GraphicsDeviceReset,this.updateResolutionScaler, this);
@@ -76,13 +76,13 @@ module es {
public end() {
this._didSceneBegin = false;
Core.emitter.removeObserver(CoreEvents.GraphicsDeviceReset, this.updateResolutionScaler);
Core.emitter.removeObserver(CoreEvents.OrientationChanged, this.updateResolutionScaler);
for (let i = 0; i < this._renderers.length; i++) {
this._renderers[i].unload();
}
Core.emitter.removeObserver(CoreEvents.GraphicsDeviceReset, this.updateResolutionScaler);
Core.emitter.removeObserver(CoreEvents.OrientationChanged, this.updateResolutionScaler);
this.entities.removeAllEntities();
for (let i = 0; i < this._sceneComponents.length; i++) {
@@ -90,6 +90,8 @@ module es {
}
this._sceneComponents.length = 0;
Physics.clear();
if (this.entityProcessors)
this.entityProcessors.end();
@@ -110,16 +112,16 @@ module es {
}
// 更新我们的实体解析器
if (this.entityProcessors)
if (this.entityProcessors != null)
this.entityProcessors.update();
// 更新我们的实体组
this.entities.update();
if (this.entityProcessors)
if (this.entityProcessors != null)
this.entityProcessors.lateUpdate();
// 我们在实体之后更新我们的呈现。如果添加了任何新的渲染,请进行更新
// 我们在entity.update之后更新我们的renderables以防止任何新的Renderables被添加
this.renderableComponents.updateList();
}
@@ -134,7 +136,7 @@ module es {
* 只有在SceneTransition请求渲染时它才会有一个值。
*/
public postRender() {
}
/**