@esengine/ecs-framework 2.1.19 → 2.1.21
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/README.md +23 -2
- package/index.d.ts +433 -8
- 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/README.md
CHANGED
|
@@ -31,8 +31,27 @@ npm install @esengine/ecs-framework
|
|
|
31
31
|
```typescript
|
|
32
32
|
import { Core, Scene, Entity, Component, EntitySystem } from '@esengine/ecs-framework';
|
|
33
33
|
|
|
34
|
-
// 创建核心实例
|
|
35
|
-
const core = Core.create(
|
|
34
|
+
// 创建核心实例 - 使用配置对象(推荐)
|
|
35
|
+
const core = Core.create({
|
|
36
|
+
debug: true, // 启用调试模式
|
|
37
|
+
enableEntitySystems: true, // 启用实体系统
|
|
38
|
+
debugConfig: { // 可选:调试配置
|
|
39
|
+
enabled: true,
|
|
40
|
+
websocketUrl: 'ws://localhost:8080',
|
|
41
|
+
autoReconnect: true,
|
|
42
|
+
updateInterval: 1000,
|
|
43
|
+
channels: {
|
|
44
|
+
entities: true,
|
|
45
|
+
systems: true,
|
|
46
|
+
performance: true,
|
|
47
|
+
components: true,
|
|
48
|
+
scenes: true
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// 简化创建 - 向后兼容(仍然支持)
|
|
54
|
+
const core2 = Core.create(true); // 等同于 { debug: true, enableEntitySystems: true }
|
|
36
55
|
|
|
37
56
|
// 创建场景
|
|
38
57
|
const scene = new Scene();
|
|
@@ -305,6 +324,7 @@ enum ECSEventType {
|
|
|
305
324
|
| 实体管理器 | ✅ 统一接口 | ❌ 低级 API | ✅ 高级接口 |
|
|
306
325
|
| 性能优化 | ✅ 多重优化 | ✅ 极致性能 | ✅ React 优化 |
|
|
307
326
|
| JavaScript引擎集成 | ✅ 专为JS引擎设计 | ✅ 通用设计 | ⚠️ 主要 React |
|
|
327
|
+
| 可视化调试工具 | ✅ [Cocos插件](https://store.cocos.com/app/detail/7823) | ❌ 无官方工具 | ✅ React DevTools |
|
|
308
328
|
|
|
309
329
|
**选择指南:**
|
|
310
330
|
- 选择本框架:需要完整的游戏开发工具链和中文社区支持
|
|
@@ -331,6 +351,7 @@ ecs-framework/
|
|
|
331
351
|
### 🎯 新手入门
|
|
332
352
|
- **[📖 新手教程完整指南](docs/beginner-tutorials.md)** - 完整学习路径,从零开始 ⭐ **强烈推荐**
|
|
333
353
|
- **[🚀 快速入门](docs/getting-started.md)** - 详细的入门教程,包含Laya/Cocos/Node.js集成指南 ⭐ **平台集成必读**
|
|
354
|
+
- 💡 **Cocos Creator用户特别提示**:我们提供[专用调试插件](https://store.cocos.com/app/detail/7823),支持可视化ECS调试
|
|
334
355
|
- [🧠 技术概念详解](docs/concepts-explained.md) - 通俗易懂的技术概念解释 ⭐ **推荐新手阅读**
|
|
335
356
|
- [🎯 位掩码使用指南](docs/bitmask-guide.md) - 位掩码概念、原理和高级使用技巧
|
|
336
357
|
- [💡 使用场景示例](docs/use-cases.md) - 不同类型游戏的具体应用案例
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @esengine/ecs-framework v2.1.
|
|
2
|
+
* @esengine/ecs-framework v2.1.21
|
|
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
|
* 游戏组件基类
|
|
@@ -2122,7 +2323,8 @@ declare abstract class EntitySystem implements ISystemBase {
|
|
|
2122
2323
|
/**
|
|
2123
2324
|
* 系统初始化
|
|
2124
2325
|
*
|
|
2125
|
-
*
|
|
2326
|
+
* 在系统创建时调用,自动检查场景中已存在的实体是否匹配此系统。
|
|
2327
|
+
* 子类可以重写此方法进行额外的初始化操作。
|
|
2126
2328
|
*/
|
|
2127
2329
|
initialize(): void;
|
|
2128
2330
|
/**
|
|
@@ -3754,6 +3956,150 @@ declare class EntityBatchOperator {
|
|
|
3754
3956
|
*/
|
|
3755
3957
|
declare function createECSAPI(scene: Scene, querySystem: QuerySystem, eventSystem: TypeSafeEventSystem): ECSFluentAPI;
|
|
3756
3958
|
|
|
3959
|
+
/**
|
|
3960
|
+
* ECS调试报告器 - WebSocket模式
|
|
3961
|
+
*
|
|
3962
|
+
* 负责收集ECS框架的运行时调试数据并通过WebSocket发送到调试服务器
|
|
3963
|
+
*/
|
|
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;
|
|
3979
|
+
/**
|
|
3980
|
+
* 构造函数
|
|
3981
|
+
* @param core Core实例
|
|
3982
|
+
* @param config 调试配置
|
|
3983
|
+
*/
|
|
3984
|
+
constructor(core: Core, config: IECSDebugConfig);
|
|
3985
|
+
/**
|
|
3986
|
+
* 启动调试报告器
|
|
3987
|
+
*/
|
|
3988
|
+
private start;
|
|
3989
|
+
/**
|
|
3990
|
+
* 停止调试报告器
|
|
3991
|
+
*/
|
|
3992
|
+
stop(): void;
|
|
3993
|
+
/**
|
|
3994
|
+
* 更新配置
|
|
3995
|
+
* @param newConfig 新配置
|
|
3996
|
+
*/
|
|
3997
|
+
updateConfig(newConfig: IECSDebugConfig): void;
|
|
3998
|
+
/**
|
|
3999
|
+
* 连接WebSocket
|
|
4000
|
+
*/
|
|
4001
|
+
private connectWebSocket;
|
|
4002
|
+
/**
|
|
4003
|
+
* 启动数据流
|
|
4004
|
+
*/
|
|
4005
|
+
private startDataStream;
|
|
4006
|
+
/**
|
|
4007
|
+
* 发送消息
|
|
4008
|
+
*/
|
|
4009
|
+
private send;
|
|
4010
|
+
/**
|
|
4011
|
+
* 处理接收到的消息
|
|
4012
|
+
* @param message 消息内容
|
|
4013
|
+
*/
|
|
4014
|
+
private handleMessage;
|
|
4015
|
+
/**
|
|
4016
|
+
* 收集调试数据
|
|
4017
|
+
* @returns 调试数据对象
|
|
4018
|
+
*/
|
|
4019
|
+
private collectDebugData;
|
|
4020
|
+
/**
|
|
4021
|
+
* 更新FPS计算
|
|
4022
|
+
*/
|
|
4023
|
+
private updateFPS;
|
|
4024
|
+
/**
|
|
4025
|
+
* 获取框架版本
|
|
4026
|
+
*/
|
|
4027
|
+
private getFrameworkVersion;
|
|
4028
|
+
/**
|
|
4029
|
+
* 获取当前场景名称
|
|
4030
|
+
*/
|
|
4031
|
+
private getCurrentSceneName;
|
|
4032
|
+
/**
|
|
4033
|
+
* 收集实体数据
|
|
4034
|
+
*/
|
|
4035
|
+
private collectEntityData;
|
|
4036
|
+
/**
|
|
4037
|
+
* 获取实体详情
|
|
4038
|
+
*/
|
|
4039
|
+
private getEntityDetails;
|
|
4040
|
+
/**
|
|
4041
|
+
* 收集系统数据
|
|
4042
|
+
*/
|
|
4043
|
+
private collectSystemData;
|
|
4044
|
+
/**
|
|
4045
|
+
* 收集性能数据
|
|
4046
|
+
*/
|
|
4047
|
+
private collectPerformanceData;
|
|
4048
|
+
/**
|
|
4049
|
+
* 获取ECS框架整体性能数据
|
|
4050
|
+
*/
|
|
4051
|
+
private getECSPerformanceData;
|
|
4052
|
+
/**
|
|
4053
|
+
* 获取系统性能数据
|
|
4054
|
+
*/
|
|
4055
|
+
private getSystemPerformance;
|
|
4056
|
+
/**
|
|
4057
|
+
* 获取内存详情
|
|
4058
|
+
*/
|
|
4059
|
+
private getMemoryDetails;
|
|
4060
|
+
/**
|
|
4061
|
+
* 收集组件数据
|
|
4062
|
+
*/
|
|
4063
|
+
private collectComponentData;
|
|
4064
|
+
/**
|
|
4065
|
+
* 计算组件实际内存大小
|
|
4066
|
+
*/
|
|
4067
|
+
private calculateComponentMemorySize;
|
|
4068
|
+
/**
|
|
4069
|
+
* 估算对象内存大小(字节)
|
|
4070
|
+
*/
|
|
4071
|
+
private estimateObjectSize;
|
|
4072
|
+
/**
|
|
4073
|
+
* 收集场景数据
|
|
4074
|
+
*/
|
|
4075
|
+
private collectSceneData;
|
|
4076
|
+
/**
|
|
4077
|
+
* 手动触发数据收集
|
|
4078
|
+
* @returns 当前调试数据
|
|
4079
|
+
*/
|
|
4080
|
+
getDebugData(): IECSDebugData;
|
|
4081
|
+
/**
|
|
4082
|
+
* 重置场景时间
|
|
4083
|
+
*/
|
|
4084
|
+
onSceneChanged(): void;
|
|
4085
|
+
/**
|
|
4086
|
+
* 获取连接状态
|
|
4087
|
+
*/
|
|
4088
|
+
get connected(): boolean;
|
|
4089
|
+
/**
|
|
4090
|
+
* 手动重连
|
|
4091
|
+
*/
|
|
4092
|
+
reconnect(): void;
|
|
4093
|
+
/**
|
|
4094
|
+
* 获取Archetype分布
|
|
4095
|
+
*/
|
|
4096
|
+
private getArchetypeDistribution;
|
|
4097
|
+
/**
|
|
4098
|
+
* 获取组件数量最多的实体
|
|
4099
|
+
*/
|
|
4100
|
+
private getTopEntitiesByComponents;
|
|
4101
|
+
}
|
|
4102
|
+
|
|
3757
4103
|
/**
|
|
3758
4104
|
* 游戏引擎核心类
|
|
3759
4105
|
*
|
|
@@ -3843,11 +4189,20 @@ declare class Core {
|
|
|
3843
4189
|
* 当前活动场景
|
|
3844
4190
|
*/
|
|
3845
4191
|
_scene?: Scene;
|
|
4192
|
+
/**
|
|
4193
|
+
* 调试报告器
|
|
4194
|
+
*
|
|
4195
|
+
* 负责收集和发送调试数据。
|
|
4196
|
+
*/
|
|
4197
|
+
_debugReporter?: DebugReporter;
|
|
4198
|
+
/**
|
|
4199
|
+
* Core配置
|
|
4200
|
+
*/
|
|
4201
|
+
private _config;
|
|
3846
4202
|
/**
|
|
3847
4203
|
* 创建核心实例
|
|
3848
4204
|
*
|
|
3849
|
-
* @param
|
|
3850
|
-
* @param enableEntitySystems - 是否启用实体系统,默认为true
|
|
4205
|
+
* @param config - Core配置对象
|
|
3851
4206
|
*/
|
|
3852
4207
|
private constructor();
|
|
3853
4208
|
/**
|
|
@@ -3876,10 +4231,10 @@ declare class Core {
|
|
|
3876
4231
|
*
|
|
3877
4232
|
* 如果实例已存在,则返回现有实例。
|
|
3878
4233
|
*
|
|
3879
|
-
* @param
|
|
4234
|
+
* @param config - Core配置,也可以直接传入boolean表示debug模式(向后兼容)
|
|
3880
4235
|
* @returns Core实例
|
|
3881
4236
|
*/
|
|
3882
|
-
static create(
|
|
4237
|
+
static create(config?: ICoreConfig | boolean): Core;
|
|
3883
4238
|
/**
|
|
3884
4239
|
* 更新游戏逻辑
|
|
3885
4240
|
*
|
|
@@ -3945,6 +4300,28 @@ declare class Core {
|
|
|
3945
4300
|
* @returns ECS API实例,如果未初始化则返回null
|
|
3946
4301
|
*/
|
|
3947
4302
|
static get ecsAPI(): ECSFluentAPI | null;
|
|
4303
|
+
/**
|
|
4304
|
+
* 启用调试功能
|
|
4305
|
+
*
|
|
4306
|
+
* @param config 调试配置
|
|
4307
|
+
*/
|
|
4308
|
+
static enableDebug(config: IECSDebugConfig): void;
|
|
4309
|
+
/**
|
|
4310
|
+
* 禁用调试功能
|
|
4311
|
+
*/
|
|
4312
|
+
static disableDebug(): void;
|
|
4313
|
+
/**
|
|
4314
|
+
* 获取调试数据
|
|
4315
|
+
*
|
|
4316
|
+
* @returns 当前调试数据,如果调试未启用则返回null
|
|
4317
|
+
*/
|
|
4318
|
+
static getDebugData(): any;
|
|
4319
|
+
/**
|
|
4320
|
+
* 检查调试是否启用
|
|
4321
|
+
*
|
|
4322
|
+
* @returns 调试状态
|
|
4323
|
+
*/
|
|
4324
|
+
static get isDebugEnabled(): boolean;
|
|
3948
4325
|
/**
|
|
3949
4326
|
* 场景切换回调
|
|
3950
4327
|
*
|
|
@@ -5019,6 +5396,54 @@ declare class ComponentPool<T extends Component> {
|
|
|
5019
5396
|
*/
|
|
5020
5397
|
getMaxSize(): number;
|
|
5021
5398
|
}
|
|
5399
|
+
/**
|
|
5400
|
+
* 全局组件池管理器
|
|
5401
|
+
*/
|
|
5402
|
+
declare class ComponentPoolManager {
|
|
5403
|
+
private static instance;
|
|
5404
|
+
private pools;
|
|
5405
|
+
private constructor();
|
|
5406
|
+
static getInstance(): ComponentPoolManager;
|
|
5407
|
+
/**
|
|
5408
|
+
* 注册组件池
|
|
5409
|
+
*/
|
|
5410
|
+
registerPool<T extends Component>(componentName: string, createFn: () => T, resetFn?: (component: T) => void, maxSize?: number): void;
|
|
5411
|
+
/**
|
|
5412
|
+
* 获取组件实例
|
|
5413
|
+
*/
|
|
5414
|
+
acquireComponent<T extends Component>(componentName: string): T | null;
|
|
5415
|
+
/**
|
|
5416
|
+
* 释放组件实例
|
|
5417
|
+
*/
|
|
5418
|
+
releaseComponent<T extends Component>(componentName: string, component: T): void;
|
|
5419
|
+
/**
|
|
5420
|
+
* 预热所有池
|
|
5421
|
+
*/
|
|
5422
|
+
prewarmAll(count?: number): void;
|
|
5423
|
+
/**
|
|
5424
|
+
* 清空所有池
|
|
5425
|
+
*/
|
|
5426
|
+
clearAll(): void;
|
|
5427
|
+
/**
|
|
5428
|
+
* 获取池统计信息
|
|
5429
|
+
*/
|
|
5430
|
+
getPoolStats(): Map<string, {
|
|
5431
|
+
available: number;
|
|
5432
|
+
maxSize: number;
|
|
5433
|
+
}>;
|
|
5434
|
+
/**
|
|
5435
|
+
* 获取池利用率信息(用于调试)
|
|
5436
|
+
*/
|
|
5437
|
+
getPoolUtilization(): Map<string, {
|
|
5438
|
+
used: number;
|
|
5439
|
+
total: number;
|
|
5440
|
+
utilization: number;
|
|
5441
|
+
}>;
|
|
5442
|
+
/**
|
|
5443
|
+
* 获取指定组件的池利用率
|
|
5444
|
+
*/
|
|
5445
|
+
getComponentUtilization(componentName: string): number;
|
|
5446
|
+
}
|
|
5022
5447
|
|
|
5023
5448
|
/**
|
|
5024
5449
|
* 类型工具类
|
|
@@ -5093,5 +5518,5 @@ declare class Time {
|
|
|
5093
5518
|
static checkEvery(interval: number, lastTime: number): boolean;
|
|
5094
5519
|
}
|
|
5095
5520
|
|
|
5096
|
-
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 };
|
|
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 };
|
|
5522
|
+
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 };
|