MCPcopy Create free account
hub / github.com/esengine/esengine / onInitialize

Method onInitialize

packages/core/src/Utils/Debug/DebugManager.ts:59–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

57 };
58
59 public onInitialize(): void {
60 this.config = this.configService.getConfig();
61
62 // 初始化数据收集器
63 this.entityCollector = new EntityDataCollector();
64 this.systemCollector = new SystemDataCollector();
65 this.performanceCollector = new PerformanceDataCollector();
66 this.componentCollector = new ComponentDataCollector();
67 this.sceneCollector = new SceneDataCollector();
68 this.advancedProfilerCollector = new AdvancedProfilerCollector();
69
70 // 启用高级性能分析器
71 ProfilerSDK.setEnabled(true);
72
73 // 初始化WebSocket管理器
74 this.webSocketManager = new WebSocketManager(
75 this.config.websocketUrl,
76 this.config.autoReconnect !== false
77 );
78
79 // 设置消息处理回调
80 this.webSocketManager.setMessageHandler(this.handleMessage.bind(this));
81
82 // 计算发送间隔(基于帧率)
83 const debugFrameRate = this.config.debugFrameRate || 30;
84 this.sendInterval = 1000 / debugFrameRate;
85
86 // 拦截 console 日志
87 this.interceptConsole();
88
89 this.start();
90 }
91
92 /**
93 * 启动调试管理器

Callers

nothing calls this directly

Calls 6

interceptConsoleMethod · 0.95
startMethod · 0.95
getConfigMethod · 0.65
setEnabledMethod · 0.45
setMessageHandlerMethod · 0.45
bindMethod · 0.45

Tested by

no test coverage detected