@esengine/ecs-framework 2.1.19 → 2.1.20
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 +382 -6
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/index.umd.js +1 -1
- package/index.umd.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @esengine/ecs-framework v2.1.
|
|
2
|
+
* @esengine/ecs-framework v2.1.20
|
|
3
3
|
* TypeScript definitions
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -759,6 +759,207 @@ interface IPerformanceEventData extends IEventData {
|
|
|
759
759
|
/** 额外数据 */
|
|
760
760
|
metadata?: Record<string, any>;
|
|
761
761
|
}
|
|
762
|
+
/**
|
|
763
|
+
* ECS调试配置接口
|
|
764
|
+
*/
|
|
765
|
+
interface IECSDebugConfig {
|
|
766
|
+
/** 是否启用调试 */
|
|
767
|
+
enabled: boolean;
|
|
768
|
+
/** WebSocket服务器URL */
|
|
769
|
+
websocketUrl: string;
|
|
770
|
+
/** 是否自动重连 */
|
|
771
|
+
autoReconnect?: boolean;
|
|
772
|
+
/** 数据更新间隔(毫秒) */
|
|
773
|
+
updateInterval?: number;
|
|
774
|
+
/** 数据通道配置 */
|
|
775
|
+
channels: {
|
|
776
|
+
entities: boolean;
|
|
777
|
+
systems: boolean;
|
|
778
|
+
performance: boolean;
|
|
779
|
+
components: boolean;
|
|
780
|
+
scenes: boolean;
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* Core配置接口
|
|
785
|
+
*/
|
|
786
|
+
interface ICoreConfig {
|
|
787
|
+
/** 是否启用调试模式 */
|
|
788
|
+
debug?: boolean;
|
|
789
|
+
/** 是否启用实体系统 */
|
|
790
|
+
enableEntitySystems?: boolean;
|
|
791
|
+
/** 调试配置 */
|
|
792
|
+
debugConfig?: IECSDebugConfig;
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* ECS调试数据接口
|
|
796
|
+
*/
|
|
797
|
+
interface IECSDebugData {
|
|
798
|
+
/** 时间戳 */
|
|
799
|
+
timestamp: number;
|
|
800
|
+
/** 框架版本 */
|
|
801
|
+
frameworkVersion?: string;
|
|
802
|
+
/** 是否正在运行 */
|
|
803
|
+
isRunning: boolean;
|
|
804
|
+
/** 框架是否已加载 */
|
|
805
|
+
frameworkLoaded: boolean;
|
|
806
|
+
/** 当前场景名称 */
|
|
807
|
+
currentScene: string;
|
|
808
|
+
/** 实体数据 */
|
|
809
|
+
entities?: IEntityDebugData;
|
|
810
|
+
/** 系统数据 */
|
|
811
|
+
systems?: ISystemDebugData;
|
|
812
|
+
/** 性能数据 */
|
|
813
|
+
performance?: IPerformanceDebugData;
|
|
814
|
+
/** 组件数据 */
|
|
815
|
+
components?: IComponentDebugData;
|
|
816
|
+
/** 场景数据 */
|
|
817
|
+
scenes?: ISceneDebugData;
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* 实体调试数据接口
|
|
821
|
+
*/
|
|
822
|
+
interface IEntityDebugData {
|
|
823
|
+
/** 总实体数 */
|
|
824
|
+
totalEntities: number;
|
|
825
|
+
/** 激活实体数 */
|
|
826
|
+
activeEntities: number;
|
|
827
|
+
/** 待添加实体数 */
|
|
828
|
+
pendingAdd: number;
|
|
829
|
+
/** 待移除实体数 */
|
|
830
|
+
pendingRemove: number;
|
|
831
|
+
/** 按Archetype分组的实体分布 */
|
|
832
|
+
entitiesPerArchetype: Array<{
|
|
833
|
+
signature: string;
|
|
834
|
+
count: number;
|
|
835
|
+
memory: number;
|
|
836
|
+
}>;
|
|
837
|
+
/** 组件数量最多的前几个实体 */
|
|
838
|
+
topEntitiesByComponents: Array<{
|
|
839
|
+
id: string;
|
|
840
|
+
name: string;
|
|
841
|
+
componentCount: number;
|
|
842
|
+
memory: number;
|
|
843
|
+
}>;
|
|
844
|
+
/** 实体详情列表 */
|
|
845
|
+
entityDetails?: Array<{
|
|
846
|
+
id: string | number;
|
|
847
|
+
name?: string;
|
|
848
|
+
tag?: string;
|
|
849
|
+
enabled: boolean;
|
|
850
|
+
componentCount: number;
|
|
851
|
+
components: string[];
|
|
852
|
+
}>;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* 系统调试数据接口
|
|
856
|
+
*/
|
|
857
|
+
interface ISystemDebugData {
|
|
858
|
+
/** 总系统数 */
|
|
859
|
+
totalSystems: number;
|
|
860
|
+
/** 系统信息列表 */
|
|
861
|
+
systemsInfo: Array<{
|
|
862
|
+
name: string;
|
|
863
|
+
type: string;
|
|
864
|
+
entityCount: number;
|
|
865
|
+
executionTime?: number;
|
|
866
|
+
averageExecutionTime?: number;
|
|
867
|
+
minExecutionTime?: number;
|
|
868
|
+
maxExecutionTime?: number;
|
|
869
|
+
executionTimeHistory?: number[];
|
|
870
|
+
memoryUsage?: number;
|
|
871
|
+
updateOrder: number;
|
|
872
|
+
enabled: boolean;
|
|
873
|
+
lastUpdateTime?: number;
|
|
874
|
+
}>;
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* 性能调试数据接口
|
|
878
|
+
*/
|
|
879
|
+
interface IPerformanceDebugData {
|
|
880
|
+
/** ECS框架执行时间(毫秒) */
|
|
881
|
+
frameTime: number;
|
|
882
|
+
/** 引擎总帧时间(毫秒) */
|
|
883
|
+
engineFrameTime?: number;
|
|
884
|
+
/** ECS占总帧时间百分比 */
|
|
885
|
+
ecsPercentage?: number;
|
|
886
|
+
/** 内存使用量(MB) */
|
|
887
|
+
memoryUsage: number;
|
|
888
|
+
/** FPS */
|
|
889
|
+
fps: number;
|
|
890
|
+
/** 平均ECS执行时间(毫秒) */
|
|
891
|
+
averageFrameTime: number;
|
|
892
|
+
/** 最小ECS执行时间(毫秒) */
|
|
893
|
+
minFrameTime: number;
|
|
894
|
+
/** 最大ECS执行时间(毫秒) */
|
|
895
|
+
maxFrameTime: number;
|
|
896
|
+
/** ECS执行时间历史记录 */
|
|
897
|
+
frameTimeHistory: number[];
|
|
898
|
+
/** 系统性能详情 */
|
|
899
|
+
systemPerformance: Array<{
|
|
900
|
+
systemName: string;
|
|
901
|
+
averageTime: number;
|
|
902
|
+
maxTime: number;
|
|
903
|
+
minTime: number;
|
|
904
|
+
samples: number;
|
|
905
|
+
percentage?: number;
|
|
906
|
+
}>;
|
|
907
|
+
/** 系统占比分析数据 */
|
|
908
|
+
systemBreakdown?: Array<{
|
|
909
|
+
systemName: string;
|
|
910
|
+
executionTime: number;
|
|
911
|
+
percentage: number;
|
|
912
|
+
}>;
|
|
913
|
+
/** 内存分配详情 */
|
|
914
|
+
memoryDetails?: {
|
|
915
|
+
entities: number;
|
|
916
|
+
components: number;
|
|
917
|
+
systems: number;
|
|
918
|
+
pooled: number;
|
|
919
|
+
totalMemory: number;
|
|
920
|
+
usedMemory: number;
|
|
921
|
+
freeMemory: number;
|
|
922
|
+
gcCollections: number;
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* 组件调试数据接口
|
|
927
|
+
*/
|
|
928
|
+
interface IComponentDebugData {
|
|
929
|
+
/** 组件类型数 */
|
|
930
|
+
componentTypes: number;
|
|
931
|
+
/** 组件实例总数 */
|
|
932
|
+
componentInstances: number;
|
|
933
|
+
/** 组件分布统计 */
|
|
934
|
+
componentStats: Array<{
|
|
935
|
+
typeName: string;
|
|
936
|
+
instanceCount: number;
|
|
937
|
+
memoryPerInstance: number;
|
|
938
|
+
totalMemory: number;
|
|
939
|
+
poolSize: number;
|
|
940
|
+
poolUtilization: number;
|
|
941
|
+
averagePerEntity?: number;
|
|
942
|
+
}>;
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* 场景调试数据接口
|
|
946
|
+
*/
|
|
947
|
+
interface ISceneDebugData {
|
|
948
|
+
/** 当前场景名称 */
|
|
949
|
+
currentSceneName: string;
|
|
950
|
+
/** 场景是否已初始化 */
|
|
951
|
+
isInitialized: boolean;
|
|
952
|
+
/** 场景运行时间(秒) */
|
|
953
|
+
sceneRunTime: number;
|
|
954
|
+
/** 场景实体数 */
|
|
955
|
+
sceneEntityCount: number;
|
|
956
|
+
/** 场景系统数 */
|
|
957
|
+
sceneSystemCount: number;
|
|
958
|
+
/** 场景内存使用量 */
|
|
959
|
+
sceneMemory: number;
|
|
960
|
+
/** 场景启动时间 */
|
|
961
|
+
sceneUptime: number;
|
|
962
|
+
}
|
|
762
963
|
|
|
763
964
|
/**
|
|
764
965
|
* 游戏组件基类
|
|
@@ -3754,6 +3955,150 @@ declare class EntityBatchOperator {
|
|
|
3754
3955
|
*/
|
|
3755
3956
|
declare function createECSAPI(scene: Scene, querySystem: QuerySystem, eventSystem: TypeSafeEventSystem): ECSFluentAPI;
|
|
3756
3957
|
|
|
3958
|
+
/**
|
|
3959
|
+
* ECS调试报告器 - WebSocket模式
|
|
3960
|
+
*
|
|
3961
|
+
* 负责收集ECS框架的运行时调试数据并通过WebSocket发送到调试服务器
|
|
3962
|
+
*/
|
|
3963
|
+
declare class DebugReporter {
|
|
3964
|
+
private config;
|
|
3965
|
+
private core;
|
|
3966
|
+
private timer?;
|
|
3967
|
+
private ws?;
|
|
3968
|
+
private lastFrameTime;
|
|
3969
|
+
private frameCount;
|
|
3970
|
+
private lastFpsTime;
|
|
3971
|
+
private fps;
|
|
3972
|
+
private sceneStartTime;
|
|
3973
|
+
private isConnected;
|
|
3974
|
+
private reconnectAttempts;
|
|
3975
|
+
private maxReconnectAttempts;
|
|
3976
|
+
private frameTimeHistory;
|
|
3977
|
+
private maxHistoryLength;
|
|
3978
|
+
/**
|
|
3979
|
+
* 构造函数
|
|
3980
|
+
* @param core Core实例
|
|
3981
|
+
* @param config 调试配置
|
|
3982
|
+
*/
|
|
3983
|
+
constructor(core: Core, config: IECSDebugConfig);
|
|
3984
|
+
/**
|
|
3985
|
+
* 启动调试报告器
|
|
3986
|
+
*/
|
|
3987
|
+
private start;
|
|
3988
|
+
/**
|
|
3989
|
+
* 停止调试报告器
|
|
3990
|
+
*/
|
|
3991
|
+
stop(): void;
|
|
3992
|
+
/**
|
|
3993
|
+
* 更新配置
|
|
3994
|
+
* @param newConfig 新配置
|
|
3995
|
+
*/
|
|
3996
|
+
updateConfig(newConfig: IECSDebugConfig): void;
|
|
3997
|
+
/**
|
|
3998
|
+
* 连接WebSocket
|
|
3999
|
+
*/
|
|
4000
|
+
private connectWebSocket;
|
|
4001
|
+
/**
|
|
4002
|
+
* 启动数据流
|
|
4003
|
+
*/
|
|
4004
|
+
private startDataStream;
|
|
4005
|
+
/**
|
|
4006
|
+
* 发送消息
|
|
4007
|
+
*/
|
|
4008
|
+
private send;
|
|
4009
|
+
/**
|
|
4010
|
+
* 处理接收到的消息
|
|
4011
|
+
* @param message 消息内容
|
|
4012
|
+
*/
|
|
4013
|
+
private handleMessage;
|
|
4014
|
+
/**
|
|
4015
|
+
* 收集调试数据
|
|
4016
|
+
* @returns 调试数据对象
|
|
4017
|
+
*/
|
|
4018
|
+
private collectDebugData;
|
|
4019
|
+
/**
|
|
4020
|
+
* 更新FPS计算
|
|
4021
|
+
*/
|
|
4022
|
+
private updateFPS;
|
|
4023
|
+
/**
|
|
4024
|
+
* 获取框架版本
|
|
4025
|
+
*/
|
|
4026
|
+
private getFrameworkVersion;
|
|
4027
|
+
/**
|
|
4028
|
+
* 获取当前场景名称
|
|
4029
|
+
*/
|
|
4030
|
+
private getCurrentSceneName;
|
|
4031
|
+
/**
|
|
4032
|
+
* 收集实体数据
|
|
4033
|
+
*/
|
|
4034
|
+
private collectEntityData;
|
|
4035
|
+
/**
|
|
4036
|
+
* 获取实体详情
|
|
4037
|
+
*/
|
|
4038
|
+
private getEntityDetails;
|
|
4039
|
+
/**
|
|
4040
|
+
* 收集系统数据
|
|
4041
|
+
*/
|
|
4042
|
+
private collectSystemData;
|
|
4043
|
+
/**
|
|
4044
|
+
* 收集性能数据
|
|
4045
|
+
*/
|
|
4046
|
+
private collectPerformanceData;
|
|
4047
|
+
/**
|
|
4048
|
+
* 获取ECS框架整体性能数据
|
|
4049
|
+
*/
|
|
4050
|
+
private getECSPerformanceData;
|
|
4051
|
+
/**
|
|
4052
|
+
* 获取系统性能数据
|
|
4053
|
+
*/
|
|
4054
|
+
private getSystemPerformance;
|
|
4055
|
+
/**
|
|
4056
|
+
* 获取内存详情
|
|
4057
|
+
*/
|
|
4058
|
+
private getMemoryDetails;
|
|
4059
|
+
/**
|
|
4060
|
+
* 收集组件数据
|
|
4061
|
+
*/
|
|
4062
|
+
private collectComponentData;
|
|
4063
|
+
/**
|
|
4064
|
+
* 计算组件实际内存大小
|
|
4065
|
+
*/
|
|
4066
|
+
private calculateComponentMemorySize;
|
|
4067
|
+
/**
|
|
4068
|
+
* 估算对象内存大小(字节)
|
|
4069
|
+
*/
|
|
4070
|
+
private estimateObjectSize;
|
|
4071
|
+
/**
|
|
4072
|
+
* 收集场景数据
|
|
4073
|
+
*/
|
|
4074
|
+
private collectSceneData;
|
|
4075
|
+
/**
|
|
4076
|
+
* 手动触发数据收集
|
|
4077
|
+
* @returns 当前调试数据
|
|
4078
|
+
*/
|
|
4079
|
+
getDebugData(): IECSDebugData;
|
|
4080
|
+
/**
|
|
4081
|
+
* 重置场景时间
|
|
4082
|
+
*/
|
|
4083
|
+
onSceneChanged(): void;
|
|
4084
|
+
/**
|
|
4085
|
+
* 获取连接状态
|
|
4086
|
+
*/
|
|
4087
|
+
get connected(): boolean;
|
|
4088
|
+
/**
|
|
4089
|
+
* 手动重连
|
|
4090
|
+
*/
|
|
4091
|
+
reconnect(): void;
|
|
4092
|
+
/**
|
|
4093
|
+
* 获取Archetype分布
|
|
4094
|
+
*/
|
|
4095
|
+
private getArchetypeDistribution;
|
|
4096
|
+
/**
|
|
4097
|
+
* 获取组件数量最多的实体
|
|
4098
|
+
*/
|
|
4099
|
+
private getTopEntitiesByComponents;
|
|
4100
|
+
}
|
|
4101
|
+
|
|
3757
4102
|
/**
|
|
3758
4103
|
* 游戏引擎核心类
|
|
3759
4104
|
*
|
|
@@ -3843,11 +4188,20 @@ declare class Core {
|
|
|
3843
4188
|
* 当前活动场景
|
|
3844
4189
|
*/
|
|
3845
4190
|
_scene?: Scene;
|
|
4191
|
+
/**
|
|
4192
|
+
* 调试报告器
|
|
4193
|
+
*
|
|
4194
|
+
* 负责收集和发送调试数据。
|
|
4195
|
+
*/
|
|
4196
|
+
_debugReporter?: DebugReporter;
|
|
4197
|
+
/**
|
|
4198
|
+
* Core配置
|
|
4199
|
+
*/
|
|
4200
|
+
private _config;
|
|
3846
4201
|
/**
|
|
3847
4202
|
* 创建核心实例
|
|
3848
4203
|
*
|
|
3849
|
-
* @param
|
|
3850
|
-
* @param enableEntitySystems - 是否启用实体系统,默认为true
|
|
4204
|
+
* @param config - Core配置对象
|
|
3851
4205
|
*/
|
|
3852
4206
|
private constructor();
|
|
3853
4207
|
/**
|
|
@@ -3876,10 +4230,10 @@ declare class Core {
|
|
|
3876
4230
|
*
|
|
3877
4231
|
* 如果实例已存在,则返回现有实例。
|
|
3878
4232
|
*
|
|
3879
|
-
* @param
|
|
4233
|
+
* @param config - Core配置,也可以直接传入boolean表示debug模式(向后兼容)
|
|
3880
4234
|
* @returns Core实例
|
|
3881
4235
|
*/
|
|
3882
|
-
static create(
|
|
4236
|
+
static create(config?: ICoreConfig | boolean): Core;
|
|
3883
4237
|
/**
|
|
3884
4238
|
* 更新游戏逻辑
|
|
3885
4239
|
*
|
|
@@ -3945,6 +4299,28 @@ declare class Core {
|
|
|
3945
4299
|
* @returns ECS API实例,如果未初始化则返回null
|
|
3946
4300
|
*/
|
|
3947
4301
|
static get ecsAPI(): ECSFluentAPI | null;
|
|
4302
|
+
/**
|
|
4303
|
+
* 启用调试功能
|
|
4304
|
+
*
|
|
4305
|
+
* @param config 调试配置
|
|
4306
|
+
*/
|
|
4307
|
+
static enableDebug(config: IECSDebugConfig): void;
|
|
4308
|
+
/**
|
|
4309
|
+
* 禁用调试功能
|
|
4310
|
+
*/
|
|
4311
|
+
static disableDebug(): void;
|
|
4312
|
+
/**
|
|
4313
|
+
* 获取调试数据
|
|
4314
|
+
*
|
|
4315
|
+
* @returns 当前调试数据,如果调试未启用则返回null
|
|
4316
|
+
*/
|
|
4317
|
+
static getDebugData(): any;
|
|
4318
|
+
/**
|
|
4319
|
+
* 检查调试是否启用
|
|
4320
|
+
*
|
|
4321
|
+
* @returns 调试状态
|
|
4322
|
+
*/
|
|
4323
|
+
static get isDebugEnabled(): boolean;
|
|
3948
4324
|
/**
|
|
3949
4325
|
* 场景切换回调
|
|
3950
4326
|
*
|
|
@@ -5094,4 +5470,4 @@ declare class Time {
|
|
|
5094
5470
|
}
|
|
5095
5471
|
|
|
5096
5472
|
export { ArchetypeSystem, AsyncEventHandler$1 as AsyncEventHandler, BitMaskOptimizer, BitmapComponentIndex, Bits, Component, ComponentIndexManager, ComponentPool, 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 };
|
|
5097
|
-
export type { Archetype, ArchetypeQueryResult, ComponentType$1 as ComponentType, DirtyData, DirtyListener, EventListenerConfig, EventStats, IComponent, IComponentEventData, IEntityEventData, IEventBus, IEventData, IEventListenerConfig, IEventStats, IPerformanceEventData, IPoolable, ISceneEventData, ISystemBase, ISystemEventData, ITimer, PerformanceData, PerformanceStats, PerformanceThresholds, PerformanceWarning, PoolStats };
|
|
5473
|
+
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 };
|