新增系统debug使用时间
This commit is contained in:
7
source/bin/framework.d.ts
vendored
7
source/bin/framework.d.ts
vendored
@@ -1291,6 +1291,11 @@ declare module es {
|
||||
scene: Scene;
|
||||
private _matcher;
|
||||
readonly matcher: Matcher;
|
||||
private _startTime;
|
||||
private _endTime;
|
||||
private _useTime;
|
||||
/** 获取系统在当前帧所消耗的时间 仅在debug模式下生效 */
|
||||
readonly useTime: number;
|
||||
initialize(): void;
|
||||
onChanged(entity: Entity): void;
|
||||
add(entity: Entity): void;
|
||||
@@ -1816,7 +1821,7 @@ declare module es {
|
||||
}
|
||||
declare module es {
|
||||
class EntityProcessorList {
|
||||
protected _processors: EntitySystem[];
|
||||
_processors: EntitySystem[];
|
||||
add(processor: EntitySystem): void;
|
||||
remove(processor: EntitySystem): void;
|
||||
onComponentAdded(entity: Entity): void;
|
||||
|
||||
@@ -2913,6 +2913,9 @@ var es;
|
||||
var EntitySystem = /** @class */ (function () {
|
||||
function EntitySystem(matcher) {
|
||||
this._entities = [];
|
||||
this._startTime = 0;
|
||||
this._endTime = 0;
|
||||
this._useTime = 0;
|
||||
this._matcher = matcher ? matcher : es.Matcher.empty();
|
||||
this.initialize();
|
||||
}
|
||||
@@ -2937,6 +2940,14 @@ var es;
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(EntitySystem.prototype, "useTime", {
|
||||
/** 获取系统在当前帧所消耗的时间 仅在debug模式下生效 */
|
||||
get: function () {
|
||||
return this._useTime;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
EntitySystem.prototype.initialize = function () {
|
||||
};
|
||||
EntitySystem.prototype.onChanged = function (entity) {
|
||||
@@ -2973,13 +2984,22 @@ var es;
|
||||
* 在系统处理开始前调用
|
||||
* 在下一个系统开始处理或新的处理回合开始之前(以先到者为准),使用此方法创建的任何实体都不会激活
|
||||
*/
|
||||
EntitySystem.prototype.begin = function () { };
|
||||
EntitySystem.prototype.begin = function () {
|
||||
if (!es.Core.Instance.debug)
|
||||
return;
|
||||
this._startTime = Date.now();
|
||||
};
|
||||
EntitySystem.prototype.process = function (entities) { };
|
||||
EntitySystem.prototype.lateProcess = function (entities) { };
|
||||
/**
|
||||
* 系统处理完毕后调用
|
||||
*/
|
||||
EntitySystem.prototype.end = function () { };
|
||||
EntitySystem.prototype.end = function () {
|
||||
if (!es.Core.Instance.debug)
|
||||
return;
|
||||
this._endTime = Date.now();
|
||||
this._useTime = this._endTime - this._startTime;
|
||||
};
|
||||
/**
|
||||
* 系统是否需要处理
|
||||
*
|
||||
@@ -4045,10 +4065,8 @@ var es;
|
||||
ComponentList.prototype.update = function () {
|
||||
this.updateLists();
|
||||
for (var i = 0; i < this._updatableComponents.length; i++) {
|
||||
var component = this._updatableComponents[i];
|
||||
if (component.enabled) {
|
||||
component.update();
|
||||
}
|
||||
if (this._updatableComponents[i].enabled)
|
||||
this._updatableComponents[i].update();
|
||||
}
|
||||
};
|
||||
ComponentList.prototype.onEntityTransformChanged = function (comp) {
|
||||
|
||||
2
source/bin/framework.min.js
vendored
2
source/bin/framework.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -30,6 +30,14 @@ module es {
|
||||
return this._matcher;
|
||||
}
|
||||
|
||||
private _startTime = 0;
|
||||
private _endTime = 0;
|
||||
private _useTime = 0;
|
||||
/** 获取系统在当前帧所消耗的时间 仅在debug模式下生效 */
|
||||
public get useTime() {
|
||||
return this._useTime;
|
||||
}
|
||||
|
||||
public initialize() {
|
||||
|
||||
}
|
||||
@@ -76,7 +84,12 @@ module es {
|
||||
* 在系统处理开始前调用
|
||||
* 在下一个系统开始处理或新的处理回合开始之前(以先到者为准),使用此方法创建的任何实体都不会激活
|
||||
*/
|
||||
protected begin() { }
|
||||
protected begin() {
|
||||
if (!Core.Instance.debug)
|
||||
return;
|
||||
|
||||
this._startTime = Date.now();
|
||||
}
|
||||
|
||||
protected process(entities: Entity[]) { }
|
||||
|
||||
@@ -85,7 +98,13 @@ module es {
|
||||
/**
|
||||
* 系统处理完毕后调用
|
||||
*/
|
||||
protected end() { }
|
||||
protected end() {
|
||||
if (!Core.Instance.debug)
|
||||
return;
|
||||
|
||||
this._endTime = Date.now();
|
||||
this._useTime = this._endTime - this._startTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统是否需要处理
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module es {
|
||||
export class EntityProcessorList {
|
||||
protected _processors: EntitySystem[] = [];
|
||||
public _processors: EntitySystem[] = [];
|
||||
|
||||
public add(processor: EntitySystem) {
|
||||
this._processors.push(processor);
|
||||
|
||||
Reference in New Issue
Block a user