1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import BasicObject from "./BasicObject";
- /**
- * 基础管理器 - 逻辑层
- */
- export default abstract class BasicManager extends BasicObject {
-
- /**帧循环组件列表 */
- protected updateComponents: Map<any, Map<any, BasicObject>>;
- constructor () {
- super();
-
- this.updateComponents = new Map<any, Map<any, BasicObject>>();
- }
- public _update (dt: number): void {
- this.updateComponents.forEach((values: Map<any, BasicObject>, 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);
- }
- }
- });
- }
- }
|