@esengine/ecs-framework 2.1.22 → 2.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @esengine/ecs-framework v2.1.22
2
+ * @esengine/ecs-framework v2.1.23
3
3
  * TypeScript definitions
4
4
  */
5
5
  /**
@@ -769,8 +769,10 @@ interface IECSDebugConfig {
769
769
  websocketUrl: string;
770
770
  /** 是否自动重连 */
771
771
  autoReconnect?: boolean;
772
- /** 数据更新间隔(毫秒) */
772
+ /** 数据更新间隔(毫秒)- 已弃用,使用debugFrameRate替代 */
773
773
  updateInterval?: number;
774
+ /** 调试数据发送帧率 (60fps, 30fps, 15fps) */
775
+ debugFrameRate?: 60 | 30 | 15;
774
776
  /** 数据通道配置 */
775
777
  channels: {
776
778
  entities: boolean;
@@ -850,6 +852,44 @@ interface IEntityDebugData {
850
852
  componentCount: number;
851
853
  components: string[];
852
854
  }>;
855
+ /** 实体层次结构(根实体) */
856
+ entityHierarchy?: Array<{
857
+ id: number;
858
+ name: string;
859
+ active: boolean;
860
+ enabled: boolean;
861
+ activeInHierarchy: boolean;
862
+ componentCount: number;
863
+ componentTypes: string[];
864
+ parentId: number | null;
865
+ children: any[];
866
+ depth: number;
867
+ tag: number;
868
+ updateOrder: number;
869
+ }>;
870
+ /** 实体详细信息映射 */
871
+ entityDetailsMap?: Record<number, {
872
+ id: number;
873
+ name: string;
874
+ active: boolean;
875
+ enabled: boolean;
876
+ activeInHierarchy: boolean;
877
+ destroyed: boolean;
878
+ tag: number;
879
+ updateOrder: number;
880
+ componentMask: string;
881
+ parentId: number | null;
882
+ parentName: string | null;
883
+ childCount: number;
884
+ childIds: number[];
885
+ depth: number;
886
+ components: Array<{
887
+ typeName: string;
888
+ properties: Record<string, any>;
889
+ }>;
890
+ componentCount: number;
891
+ componentTypes: string[];
892
+ }>;
853
893
  }
854
894
  /**
855
895
  * 系统调试数据接口
@@ -3957,94 +3997,114 @@ declare class EntityBatchOperator {
3957
3997
  declare function createECSAPI(scene: Scene, querySystem: QuerySystem, eventSystem: TypeSafeEventSystem): ECSFluentAPI;
3958
3998
 
3959
3999
  /**
3960
- * ECS调试报告器 - WebSocket模式
3961
- *
3962
- * 负责收集ECS框架的运行时调试数据并通过WebSocket发送到调试服务器
4000
+ * 实体数据收集器
3963
4001
  */
3964
- declare class DebugReporter {
3965
- private config;
3966
- private core;
3967
- private timer?;
3968
- private ws?;
3969
- private lastFrameTime;
3970
- private frameCount;
3971
- private lastFpsTime;
3972
- private fps;
3973
- private sceneStartTime;
3974
- private isConnected;
3975
- private reconnectAttempts;
3976
- private maxReconnectAttempts;
3977
- private frameTimeHistory;
3978
- private maxHistoryLength;
4002
+ declare class EntityDataCollector {
3979
4003
  /**
3980
- * 构造函数
3981
- * @param core Core实例
3982
- * @param config 调试配置
4004
+ * 收集实体数据
3983
4005
  */
3984
- constructor(core: Core, config: IECSDebugConfig);
4006
+ collectEntityData(): IEntityDebugData;
3985
4007
  /**
3986
- * 启动调试报告器
4008
+ * 获取空的实体数据
3987
4009
  */
3988
- private start;
4010
+ private getEmptyEntityDebugData;
3989
4011
  /**
3990
- * 停止调试报告器
4012
+ * 计算实体统计信息
3991
4013
  */
3992
- stop(): void;
4014
+ private calculateFallbackEntityStats;
3993
4015
  /**
3994
- * 更新配置
3995
- * @param newConfig 新配置
4016
+ * 收集原型数据
3996
4017
  */
3997
- updateConfig(newConfig: IECSDebugConfig): void;
4018
+ private collectArchetypeData;
3998
4019
  /**
3999
- * 连接WebSocket
4020
+ * 提取原型统计信息
4000
4021
  */
4001
- private connectWebSocket;
4022
+ private extractArchetypeStatistics;
4002
4023
  /**
4003
- * 启动数据流
4024
+ * 计算实体内存使用量
4004
4025
  */
4005
- private startDataStream;
4026
+ estimateEntityMemoryUsage(entity: any): number;
4006
4027
  /**
4007
- * 发送消息
4028
+ * 计算对象大小
4008
4029
  */
4009
- private send;
4030
+ calculateObjectSize(obj: any, excludeKeys?: string[]): number;
4010
4031
  /**
4011
- * 处理接收到的消息
4012
- * @param message 消息内容
4032
+ * 构建实体层次结构树
4013
4033
  */
4014
- private handleMessage;
4034
+ private buildEntityHierarchyTree;
4015
4035
  /**
4016
- * 收集调试数据
4017
- * @returns 调试数据对象
4036
+ * 构建实体层次结构节点
4018
4037
  */
4019
- private collectDebugData;
4038
+ private buildEntityHierarchyNode;
4020
4039
  /**
4021
- * 更新FPS计算
4040
+ * 构建实体详情映射
4022
4041
  */
4023
- private updateFPS;
4042
+ private buildEntityDetailsMap;
4024
4043
  /**
4025
- * 获取框架版本
4044
+ * 构建实体基础信息
4026
4045
  */
4027
- private getFrameworkVersion;
4046
+ private buildFallbackEntityInfo;
4028
4047
  /**
4029
- * 获取当前场景名称
4048
+ * 提取组件详细信息
4030
4049
  */
4031
- private getCurrentSceneName;
4050
+ private extractComponentDetails;
4032
4051
  /**
4033
- * 收集实体数据
4052
+ * 格式化属性值
4053
+ */
4054
+ private formatPropertyValue;
4055
+ /**
4056
+ * 获取Archetype分布
4057
+ */
4058
+ private getArchetypeDistribution;
4059
+ /**
4060
+ * 获取组件数量最多的实体
4061
+ */
4062
+ private getTopEntitiesByComponents;
4063
+ /**
4064
+ * 提取实体详细信息
4065
+ */
4066
+ private extractEntityDetails;
4067
+ /**
4068
+ * 生成组件掩码的可读描述
4069
+ */
4070
+ private generateComponentMaskDescription;
4071
+ /**
4072
+ * 生成实体状态描述
4073
+ */
4074
+ private generateEntityStatusDescription;
4075
+ /**
4076
+ * 提取变换信息
4034
4077
  */
4035
- private collectEntityData;
4078
+ private extractTransformInfo;
4036
4079
  /**
4037
- * 获取实体详情
4080
+ * 格式化Vector3对象
4038
4081
  */
4039
- private getEntityDetails;
4082
+ private formatVector3;
4083
+ }
4084
+
4085
+ /**
4086
+ * 系统数据收集器
4087
+ */
4088
+ declare class SystemDataCollector {
4040
4089
  /**
4041
4090
  * 收集系统数据
4042
4091
  */
4043
- private collectSystemData;
4092
+ collectSystemData(performanceMonitor: any): ISystemDebugData;
4093
+ }
4094
+
4095
+ /**
4096
+ * 性能数据收集器
4097
+ */
4098
+ declare class PerformanceDataCollector {
4099
+ private frameTimeHistory;
4100
+ private maxHistoryLength;
4101
+ private lastGCCount;
4102
+ private gcCollections;
4103
+ private lastMemoryCheck;
4044
4104
  /**
4045
4105
  * 收集性能数据
4046
4106
  */
4047
- private collectPerformanceData;
4107
+ collectPerformanceData(performanceMonitor: any): IPerformanceDebugData;
4048
4108
  /**
4049
4109
  * 获取ECS框架整体性能数据
4050
4110
  */
@@ -4057,47 +4117,194 @@ declare class DebugReporter {
4057
4117
  * 获取内存详情
4058
4118
  */
4059
4119
  private getMemoryDetails;
4120
+ /**
4121
+ * 更新GC计数
4122
+ */
4123
+ private updateGCCount;
4124
+ }
4125
+
4126
+ /**
4127
+ * 组件数据收集器
4128
+ */
4129
+ declare class ComponentDataCollector {
4060
4130
  /**
4061
4131
  * 收集组件数据
4062
4132
  */
4063
- private collectComponentData;
4133
+ collectComponentData(): IComponentDebugData;
4064
4134
  /**
4065
4135
  * 计算组件实际内存大小
4066
4136
  */
4067
4137
  private calculateComponentMemorySize;
4068
4138
  /**
4069
- * 估算对象内存大小(字节)
4139
+ * 估算对象内存大小
4070
4140
  */
4071
4141
  private estimateObjectSize;
4142
+ }
4143
+
4144
+ /**
4145
+ * 场景数据收集器
4146
+ */
4147
+ declare class SceneDataCollector {
4148
+ private sceneStartTime;
4072
4149
  /**
4073
4150
  * 收集场景数据
4074
4151
  */
4075
- private collectSceneData;
4152
+ collectSceneData(): ISceneDebugData;
4076
4153
  /**
4077
- * 手动触发数据收集
4078
- * @returns 当前调试数据
4154
+ * 设置场景开始时间
4079
4155
  */
4080
- getDebugData(): IECSDebugData;
4156
+ setSceneStartTime(time: number): void;
4157
+ }
4158
+
4159
+ /**
4160
+ * WebSocket连接管理器
4161
+ */
4162
+ declare class WebSocketManager {
4163
+ private ws?;
4164
+ private isConnected;
4165
+ private reconnectAttempts;
4166
+ private maxReconnectAttempts;
4167
+ private reconnectInterval;
4168
+ private url;
4169
+ private autoReconnect;
4170
+ private reconnectTimer?;
4171
+ private onOpen?;
4172
+ private onClose?;
4173
+ private onError?;
4174
+ private messageHandler?;
4175
+ constructor(url: string, autoReconnect?: boolean);
4081
4176
  /**
4082
- * 重置场景时间
4177
+ * 设置消息处理回调
4083
4178
  */
4084
- onSceneChanged(): void;
4179
+ setMessageHandler(handler: (message: any) => void): void;
4180
+ /**
4181
+ * 连接WebSocket
4182
+ */
4183
+ connect(): Promise<void>;
4184
+ /**
4185
+ * 断开连接
4186
+ */
4187
+ disconnect(): void;
4188
+ /**
4189
+ * 发送数据
4190
+ */
4191
+ send(data: any): void;
4085
4192
  /**
4086
4193
  * 获取连接状态
4087
4194
  */
4088
- get connected(): boolean;
4195
+ getConnectionStatus(): boolean;
4089
4196
  /**
4090
- * 手动重连
4197
+ * 设置最大重连次数
4091
4198
  */
4092
- reconnect(): void;
4199
+ setMaxReconnectAttempts(attempts: number): void;
4093
4200
  /**
4094
- * 获取Archetype分布
4201
+ * 设置重连间隔
4095
4202
  */
4096
- private getArchetypeDistribution;
4203
+ setReconnectInterval(interval: number): void;
4097
4204
  /**
4098
- * 获取组件数量最多的实体
4205
+ * 计划重连
4099
4206
  */
4100
- private getTopEntitiesByComponents;
4207
+ private scheduleReconnect;
4208
+ /**
4209
+ * 处理接收到的消息
4210
+ */
4211
+ private handleMessage;
4212
+ private handleOpen;
4213
+ private handleClose;
4214
+ private handleError;
4215
+ private handleConnectionFailure;
4216
+ }
4217
+
4218
+ /**
4219
+ * 调试管理器
4220
+ *
4221
+ * 整合所有调试数据收集器,负责收集和发送调试数据
4222
+ */
4223
+ declare class DebugManager {
4224
+ private config;
4225
+ private webSocketManager;
4226
+ private entityCollector;
4227
+ private systemCollector;
4228
+ private performanceCollector;
4229
+ private componentCollector;
4230
+ private sceneCollector;
4231
+ private frameCounter;
4232
+ private lastSendTime;
4233
+ private sendInterval;
4234
+ private isRunning;
4235
+ constructor(core: Core, config: IECSDebugConfig);
4236
+ /**
4237
+ * 启动调试管理器
4238
+ */
4239
+ start(): void;
4240
+ /**
4241
+ * 停止调试管理器
4242
+ */
4243
+ stop(): void;
4244
+ /**
4245
+ * 更新配置
4246
+ */
4247
+ updateConfig(config: IECSDebugConfig): void;
4248
+ /**
4249
+ * 帧更新回调
4250
+ */
4251
+ onFrameUpdate(deltaTime: number): void;
4252
+ /**
4253
+ * 场景变更回调
4254
+ */
4255
+ onSceneChanged(): void;
4256
+ /**
4257
+ * 处理来自调试面板的消息
4258
+ */
4259
+ private handleMessage;
4260
+ /**
4261
+ * 处理内存快照请求
4262
+ */
4263
+ private handleMemorySnapshotRequest;
4264
+ /**
4265
+ * 捕获内存快照
4266
+ */
4267
+ private captureMemorySnapshot;
4268
+ /**
4269
+ * 收集基础内存信息
4270
+ */
4271
+ private collectBaseMemoryInfo;
4272
+ /**
4273
+ * 收集实体内存统计
4274
+ */
4275
+ private collectEntityMemoryStats;
4276
+ /**
4277
+ * 收集组件内存统计
4278
+ */
4279
+ private collectComponentMemoryStats;
4280
+ /**
4281
+ * 收集系统内存统计
4282
+ */
4283
+ private collectSystemMemoryStats;
4284
+ /**
4285
+ * 收集对象池内存统计
4286
+ */
4287
+ private collectPoolMemoryStats;
4288
+ /**
4289
+ * 收集性能统计信息
4290
+ */
4291
+ private collectPerformanceStats;
4292
+ /**
4293
+ * 获取内存大小分类
4294
+ */
4295
+ private getMemorySizeCategory;
4296
+ /**
4297
+ * 获取调试数据
4298
+ */
4299
+ getDebugData(): IECSDebugData;
4300
+ /**
4301
+ * 连接WebSocket
4302
+ */
4303
+ private connectWebSocket;
4304
+ /**
4305
+ * 发送调试数据
4306
+ */
4307
+ private sendDebugData;
4101
4308
  }
4102
4309
 
4103
4310
  /**
@@ -4190,11 +4397,11 @@ declare class Core {
4190
4397
  */
4191
4398
  _scene?: Scene;
4192
4399
  /**
4193
- * 调试报告器
4400
+ * 调试管理器
4194
4401
  *
4195
4402
  * 负责收集和发送调试数据。
4196
4403
  */
4197
- _debugReporter?: DebugReporter;
4404
+ _debugManager?: DebugManager;
4198
4405
  /**
4199
4406
  * Core配置
4200
4407
  */
@@ -5518,5 +5725,5 @@ declare class Time {
5518
5725
  static checkEvery(interval: number, lastTime: number): boolean;
5519
5726
  }
5520
5727
 
5521
- export { ArchetypeSystem, AsyncEventHandler$1 as AsyncEventHandler, BitMaskOptimizer, BitmapComponentIndex, Bits, Component, ComponentIndexManager, ComponentPool, ComponentPoolManager, ComponentStorage, ComponentTypeManager, Core, DirtyFlag, DirtyTrackingSystem, ECSEventType, ECSFluentAPI, EVENT_TYPES, Emitter, Entity, EntityList, EntityManager, EntityProcessorList, EntityQueryBuilder, EntitySystem, EventBus, EventHandler$1 as EventHandler, EventPriority, EventTypeValidator, FuncPack, GlobalEventBus, GlobalManager, HashComponentIndex, IdentifierPool, IndexType, IndexUpdateBatcher, IntervalSystem, Matcher, NumberExtension, PassiveSystem, PerformanceMonitor, PerformanceWarningType, Pool, PoolManager, ProcessingSystem, QuerySystem, Scene, TieredObjectPool, Time, Timer, TimerManager, TypeSafeEventSystem, TypeUtils, createECSAPI };
5728
+ export { ArchetypeSystem, AsyncEventHandler$1 as AsyncEventHandler, BitMaskOptimizer, BitmapComponentIndex, Bits, Component, ComponentDataCollector, ComponentIndexManager, ComponentPool, ComponentPoolManager, ComponentStorage, ComponentTypeManager, Core, DebugManager, DirtyFlag, DirtyTrackingSystem, ECSEventType, ECSFluentAPI, EVENT_TYPES, Emitter, Entity, EntityDataCollector, EntityList, EntityManager, EntityProcessorList, EntityQueryBuilder, EntitySystem, EventBus, EventHandler$1 as EventHandler, EventPriority, EventTypeValidator, FuncPack, GlobalEventBus, GlobalManager, HashComponentIndex, IdentifierPool, IndexType, IndexUpdateBatcher, IntervalSystem, Matcher, NumberExtension, PassiveSystem, PerformanceDataCollector, PerformanceMonitor, PerformanceWarningType, Pool, PoolManager, ProcessingSystem, QuerySystem, Scene, SceneDataCollector, SystemDataCollector, TieredObjectPool, Time, Timer, TimerManager, TypeSafeEventSystem, TypeUtils, WebSocketManager, createECSAPI };
5522
5729
  export type { Archetype, ArchetypeQueryResult, ComponentType$1 as ComponentType, DirtyData, DirtyListener, EventListenerConfig, EventStats, IComponent, IComponentDebugData, IComponentEventData, ICoreConfig, IECSDebugConfig, IECSDebugData, IEntityDebugData, IEntityEventData, IEventBus, IEventData, IEventListenerConfig, IEventStats, IPerformanceDebugData, IPerformanceEventData, IPoolable, ISceneDebugData, ISceneEventData, ISystemBase, ISystemDebugData, ISystemEventData, ITimer, PerformanceData, PerformanceStats, PerformanceThresholds, PerformanceWarning, PoolStats };