* @zh 执行系统的指定阶段 * @en Run specified phase for all systems
(
systems: EntitySystem[],
phase: 'update' | 'lateUpdate',
profileName: string
)
| 534 | * @en Run specified phase for all systems |
| 535 | */ |
| 536 | private _runSystemPhase( |
| 537 | systems: EntitySystem[], |
| 538 | phase: 'update' | 'lateUpdate', |
| 539 | profileName: string |
| 540 | ): void { |
| 541 | const phaseHandle = ProfilerSDK.beginSample(profileName, ProfileCategory.ECS); |
| 542 | try { |
| 543 | for (const system of systems) { |
| 544 | if (!this._shouldSystemRun(system)) continue; |
| 545 | |
| 546 | const suffix = phase === 'lateUpdate' ? '.late' : ''; |
| 547 | const systemHandle = ProfilerSDK.beginSample(`${system.systemName}${suffix}`, ProfileCategory.ECS); |
| 548 | try { |
| 549 | system[phase](); |
| 550 | } catch (error) { |
| 551 | this._handleSystemError(system, phase, error); |
| 552 | } finally { |
| 553 | ProfilerSDK.endSample(systemHandle); |
| 554 | } |
| 555 | } |
| 556 | } finally { |
| 557 | ProfilerSDK.endSample(phaseHandle); |
| 558 | } |
| 559 | } |
| 560 | |
| 561 | private _shouldSystemRun(system: EntitySystem): boolean { |
| 562 | if (!system.enabled) return false; |
no test coverage detected