使用DI避免依赖问题
This commit is contained in:
@@ -12,14 +12,14 @@ import { getComponentInstanceTypeName, getSystemInstanceTypeName } from '../../E
|
|||||||
import type { IService } from '../../Core/ServiceContainer';
|
import type { IService } from '../../Core/ServiceContainer';
|
||||||
import { SceneManager } from '../../ECS/SceneManager';
|
import { SceneManager } from '../../ECS/SceneManager';
|
||||||
import { PerformanceMonitor } from '../PerformanceMonitor';
|
import { PerformanceMonitor } from '../PerformanceMonitor';
|
||||||
|
import { Injectable, Inject } from '../../Core/DI/Decorators';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调试管理器
|
* 调试管理器
|
||||||
*
|
*
|
||||||
* 整合所有调试数据收集器,负责收集和发送调试数据
|
* 整合所有调试数据收集器,负责收集和发送调试数据
|
||||||
*
|
|
||||||
* 通过构造函数接收SceneManager和PerformanceMonitor,避免直接依赖Core实例
|
|
||||||
*/
|
*/
|
||||||
|
@Injectable()
|
||||||
export class DebugManager implements IService {
|
export class DebugManager implements IService {
|
||||||
private config: IECSDebugConfig;
|
private config: IECSDebugConfig;
|
||||||
private webSocketManager: WebSocketManager;
|
private webSocketManager: WebSocketManager;
|
||||||
@@ -36,15 +36,9 @@ export class DebugManager implements IService {
|
|||||||
private sendInterval: number;
|
private sendInterval: number;
|
||||||
private isRunning: boolean = false;
|
private isRunning: boolean = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* 构造调试管理器
|
|
||||||
* @param sceneManager 场景管理器
|
|
||||||
* @param performanceMonitor 性能监控器
|
|
||||||
* @param config 调试配置
|
|
||||||
*/
|
|
||||||
constructor(
|
constructor(
|
||||||
sceneManager: SceneManager,
|
@Inject(SceneManager) sceneManager: SceneManager,
|
||||||
performanceMonitor: PerformanceMonitor,
|
@Inject(PerformanceMonitor) performanceMonitor: PerformanceMonitor,
|
||||||
config: IECSDebugConfig
|
config: IECSDebugConfig
|
||||||
) {
|
) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
|||||||
Reference in New Issue
Block a user