import BasicObject from "./BasicObject"; /** * 基础管理器 - 逻辑层 */ export default abstract class BasicManager extends BasicObject { /**帧循环组件列表 */ protected updateComponents: Map>; constructor () { super(); this.updateComponents = new Map>(); } public _update (dt: number): void { this.updateComponents.forEach((values: Map, i: any) => { let length = values.size; values.forEach((value: BasicObject, j: any) => { if (value.isUpdate == true) { if (value.isValid == false || value.isDestroy == true) { values.delete(j); } else { if (value != null && value.enabled == true) { value._update(dt); } } } }); // 长度发生变化 if (length != values.size) { if (values.size > 0) { this.updateComponents.set(i, values); } else { this.updateComponents.delete(i); } } }); } }