@esengine/ecs-framework 2.1.43 → 2.1.45
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.cjs +1 -1
- package/index.cjs.map +1 -1
- package/index.d.ts +1052 -322
- package/index.mjs +1 -1
- package/index.mjs.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.45
|
|
3
3
|
* TypeScript definitions
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -1838,6 +1838,9 @@ declare class SoAStorage<T extends Component> {
|
|
|
1838
1838
|
private resize;
|
|
1839
1839
|
getActiveIndices(): number[];
|
|
1840
1840
|
getFieldArray(fieldName: string): Float32Array | Float64Array | Int32Array | null;
|
|
1841
|
+
getTypedFieldArray<K extends keyof T>(fieldName: K): Float32Array | Float64Array | Int32Array | null;
|
|
1842
|
+
getEntityIndex(entityId: number): number | undefined;
|
|
1843
|
+
getEntityIdByIndex(index: number): number | undefined;
|
|
1841
1844
|
size(): number;
|
|
1842
1845
|
clear(): void;
|
|
1843
1846
|
compact(): void;
|
|
@@ -2021,6 +2024,52 @@ declare class ComponentStorage<T extends Component> {
|
|
|
2021
2024
|
declare class ComponentStorageManager {
|
|
2022
2025
|
private static readonly _logger;
|
|
2023
2026
|
private storages;
|
|
2027
|
+
/**
|
|
2028
|
+
* 检查组件类型是否启用SoA存储
|
|
2029
|
+
* @param componentType 组件类型
|
|
2030
|
+
* @returns 是否为SoA存储
|
|
2031
|
+
*/
|
|
2032
|
+
isSoAStorage<T extends Component>(componentType: ComponentType<T>): boolean;
|
|
2033
|
+
/**
|
|
2034
|
+
* 获取SoA存储器(类型安全)
|
|
2035
|
+
* @param componentType 组件类型
|
|
2036
|
+
* @returns SoA存储器或null
|
|
2037
|
+
*/
|
|
2038
|
+
getSoAStorage<T extends Component>(componentType: ComponentType<T>): SoAStorage<T> | null;
|
|
2039
|
+
/**
|
|
2040
|
+
* 直接获取SoA字段数组(类型安全)
|
|
2041
|
+
* @param componentType 组件类型
|
|
2042
|
+
* @param fieldName 字段名
|
|
2043
|
+
* @returns TypedArray或null
|
|
2044
|
+
*/
|
|
2045
|
+
getFieldArray<T extends Component>(componentType: ComponentType<T>, fieldName: string): Float32Array | Float64Array | Int32Array | null;
|
|
2046
|
+
/**
|
|
2047
|
+
* 直接获取SoA字段数组(类型安全,带字段名检查)
|
|
2048
|
+
* @param componentType 组件类型
|
|
2049
|
+
* @param fieldName 字段名(类型检查)
|
|
2050
|
+
* @returns TypedArray或null
|
|
2051
|
+
*/
|
|
2052
|
+
getTypedFieldArray<T extends Component, K extends keyof T>(componentType: ComponentType<T>, fieldName: K): Float32Array | Float64Array | Int32Array | null;
|
|
2053
|
+
/**
|
|
2054
|
+
* 获取SoA存储的活跃索引
|
|
2055
|
+
* @param componentType 组件类型
|
|
2056
|
+
* @returns 活跃索引数组或空数组
|
|
2057
|
+
*/
|
|
2058
|
+
getActiveIndices<T extends Component>(componentType: ComponentType<T>): number[];
|
|
2059
|
+
/**
|
|
2060
|
+
* 获取实体在SoA存储中的索引
|
|
2061
|
+
* @param componentType 组件类型
|
|
2062
|
+
* @param entityId 实体ID
|
|
2063
|
+
* @returns 存储索引或undefined
|
|
2064
|
+
*/
|
|
2065
|
+
getEntityIndex<T extends Component>(componentType: ComponentType<T>, entityId: number): number | undefined;
|
|
2066
|
+
/**
|
|
2067
|
+
* 根据索引获取实体ID
|
|
2068
|
+
* @param componentType 组件类型
|
|
2069
|
+
* @param index 存储索引
|
|
2070
|
+
* @returns 实体ID或undefined
|
|
2071
|
+
*/
|
|
2072
|
+
getEntityIdByIndex<T extends Component>(componentType: ComponentType<T>, index: number): number | undefined;
|
|
2024
2073
|
/**
|
|
2025
2074
|
* 获取或创建组件存储器(默认原始存储)
|
|
2026
2075
|
* @param componentType 组件类型
|
|
@@ -2079,155 +2128,6 @@ declare class ComponentStorageManager {
|
|
|
2079
2128
|
clear(): void;
|
|
2080
2129
|
}
|
|
2081
2130
|
|
|
2082
|
-
/**
|
|
2083
|
-
* 组件索引类型
|
|
2084
|
-
*/
|
|
2085
|
-
declare enum IndexType {
|
|
2086
|
-
/** 哈希索引 - 最快查找 */
|
|
2087
|
-
HASH = "hash",
|
|
2088
|
-
/** 位图索引 - 内存高效 */
|
|
2089
|
-
BITMAP = "bitmap",
|
|
2090
|
-
/** 排序索引 - 支持范围查询 */
|
|
2091
|
-
SORTED = "sorted"
|
|
2092
|
-
}
|
|
2093
|
-
/**
|
|
2094
|
-
* 索引统计信息
|
|
2095
|
-
*/
|
|
2096
|
-
interface IndexStats {
|
|
2097
|
-
/** 索引类型 */
|
|
2098
|
-
type: IndexType;
|
|
2099
|
-
/** 索引大小 */
|
|
2100
|
-
size: number;
|
|
2101
|
-
/** 内存使用量(字节) */
|
|
2102
|
-
memoryUsage: number;
|
|
2103
|
-
/** 查询次数 */
|
|
2104
|
-
queryCount: number;
|
|
2105
|
-
/** 平均查询时间(毫秒) */
|
|
2106
|
-
avgQueryTime: number;
|
|
2107
|
-
/** 最后更新时间 */
|
|
2108
|
-
lastUpdated: number;
|
|
2109
|
-
}
|
|
2110
|
-
/**
|
|
2111
|
-
* 组件索引接口
|
|
2112
|
-
*/
|
|
2113
|
-
interface IComponentIndex {
|
|
2114
|
-
/** 索引类型 */
|
|
2115
|
-
readonly type: IndexType;
|
|
2116
|
-
/** 添加实体到索引 */
|
|
2117
|
-
addEntity(entity: Entity): void;
|
|
2118
|
-
/** 从索引中移除实体 */
|
|
2119
|
-
removeEntity(entity: Entity): void;
|
|
2120
|
-
/** 查询包含指定组件的实体 */
|
|
2121
|
-
query(componentType: ComponentType): Set<Entity>;
|
|
2122
|
-
/** 批量查询多个组件 */
|
|
2123
|
-
queryMultiple(componentTypes: ComponentType[], operation: 'AND' | 'OR'): Set<Entity>;
|
|
2124
|
-
/** 清空索引 */
|
|
2125
|
-
clear(): void;
|
|
2126
|
-
/** 获取索引统计信息 */
|
|
2127
|
-
getStats(): IndexStats;
|
|
2128
|
-
}
|
|
2129
|
-
/**
|
|
2130
|
-
* 哈希索引实现
|
|
2131
|
-
*
|
|
2132
|
-
* 使用Map数据结构,提供O(1)的查找性能。
|
|
2133
|
-
* 适合大多数查询场景。
|
|
2134
|
-
*/
|
|
2135
|
-
declare class HashComponentIndex implements IComponentIndex {
|
|
2136
|
-
readonly type = IndexType.HASH;
|
|
2137
|
-
private _componentToEntities;
|
|
2138
|
-
private _entityToComponents;
|
|
2139
|
-
private _queryCount;
|
|
2140
|
-
private _totalQueryTime;
|
|
2141
|
-
private _lastUpdated;
|
|
2142
|
-
private _setPool;
|
|
2143
|
-
private _componentTypeSetPool;
|
|
2144
|
-
addEntity(entity: Entity): void;
|
|
2145
|
-
removeEntity(entity: Entity): void;
|
|
2146
|
-
query(componentType: ComponentType): Set<Entity>;
|
|
2147
|
-
queryMultiple(componentTypes: ComponentType[], operation: 'AND' | 'OR'): Set<Entity>;
|
|
2148
|
-
clear(): void;
|
|
2149
|
-
getStats(): IndexStats;
|
|
2150
|
-
}
|
|
2151
|
-
/**
|
|
2152
|
-
* 位图索引实现
|
|
2153
|
-
*
|
|
2154
|
-
* 使用位操作进行快速集合运算,内存效率高。
|
|
2155
|
-
* 适合有限组件类型和大量实体的场景。
|
|
2156
|
-
*/
|
|
2157
|
-
declare class BitmapComponentIndex implements IComponentIndex {
|
|
2158
|
-
readonly type = IndexType.BITMAP;
|
|
2159
|
-
private _componentTypeToBit;
|
|
2160
|
-
private _entityToBitmap;
|
|
2161
|
-
private _bitToEntities;
|
|
2162
|
-
private _nextBit;
|
|
2163
|
-
private _queryCount;
|
|
2164
|
-
private _totalQueryTime;
|
|
2165
|
-
private _lastUpdated;
|
|
2166
|
-
addEntity(entity: Entity): void;
|
|
2167
|
-
removeEntity(entity: Entity): void;
|
|
2168
|
-
query(componentType: ComponentType): Set<Entity>;
|
|
2169
|
-
queryMultiple(componentTypes: ComponentType[], operation: 'AND' | 'OR'): Set<Entity>;
|
|
2170
|
-
clear(): void;
|
|
2171
|
-
getStats(): IndexStats;
|
|
2172
|
-
}
|
|
2173
|
-
/**
|
|
2174
|
-
* 智能组件索引管理器
|
|
2175
|
-
*
|
|
2176
|
-
* 根据使用模式自动选择最优的索引策略。
|
|
2177
|
-
* 支持动态切换索引类型以获得最佳性能。
|
|
2178
|
-
*/
|
|
2179
|
-
declare class ComponentIndexManager {
|
|
2180
|
-
private _activeIndex;
|
|
2181
|
-
private _indexHistory;
|
|
2182
|
-
private _autoOptimize;
|
|
2183
|
-
private _optimizationThreshold;
|
|
2184
|
-
constructor(initialType?: IndexType);
|
|
2185
|
-
/**
|
|
2186
|
-
* 添加实体到索引
|
|
2187
|
-
*/
|
|
2188
|
-
addEntity(entity: Entity): void;
|
|
2189
|
-
/**
|
|
2190
|
-
* 从索引中移除实体
|
|
2191
|
-
*/
|
|
2192
|
-
removeEntity(entity: Entity): void;
|
|
2193
|
-
/**
|
|
2194
|
-
* 查询包含指定组件的实体
|
|
2195
|
-
*/
|
|
2196
|
-
query(componentType: ComponentType): Set<Entity>;
|
|
2197
|
-
/**
|
|
2198
|
-
* 批量查询多个组件
|
|
2199
|
-
*/
|
|
2200
|
-
queryMultiple(componentTypes: ComponentType[], operation: 'AND' | 'OR'): Set<Entity>;
|
|
2201
|
-
/**
|
|
2202
|
-
* 手动切换索引类型
|
|
2203
|
-
*/
|
|
2204
|
-
switchIndexType(type: IndexType): void;
|
|
2205
|
-
/**
|
|
2206
|
-
* 启用/禁用自动优化
|
|
2207
|
-
*/
|
|
2208
|
-
setAutoOptimize(enabled: boolean): void;
|
|
2209
|
-
/**
|
|
2210
|
-
* 获取当前索引统计信息
|
|
2211
|
-
*/
|
|
2212
|
-
getStats(): IndexStats;
|
|
2213
|
-
/**
|
|
2214
|
-
* 获取所有索引类型的历史统计信息
|
|
2215
|
-
*/
|
|
2216
|
-
getAllStats(): Map<IndexType, IndexStats>;
|
|
2217
|
-
/**
|
|
2218
|
-
* 清空索引
|
|
2219
|
-
*/
|
|
2220
|
-
clear(): void;
|
|
2221
|
-
/**
|
|
2222
|
-
* 创建指定类型的索引
|
|
2223
|
-
*/
|
|
2224
|
-
private createIndex;
|
|
2225
|
-
/**
|
|
2226
|
-
* 检查是否需要优化索引
|
|
2227
|
-
*/
|
|
2228
|
-
private checkOptimization;
|
|
2229
|
-
}
|
|
2230
|
-
|
|
2231
2131
|
/**
|
|
2232
2132
|
* 原型标识符
|
|
2233
2133
|
*/
|
|
@@ -2638,12 +2538,6 @@ declare class QuerySystem {
|
|
|
2638
2538
|
hitRate: string;
|
|
2639
2539
|
};
|
|
2640
2540
|
};
|
|
2641
|
-
/**
|
|
2642
|
-
* 切换组件索引类型
|
|
2643
|
-
*
|
|
2644
|
-
* @param indexType 新的索引类型
|
|
2645
|
-
*/
|
|
2646
|
-
switchComponentIndexType(indexType: IndexType): void;
|
|
2647
2541
|
/**
|
|
2648
2542
|
* 配置脏标记系统
|
|
2649
2543
|
*
|
|
@@ -4678,163 +4572,610 @@ declare class ECSFluentAPI {
|
|
|
4678
4572
|
declare function createECSAPI(scene: IScene, querySystem: QuerySystem, eventSystem: TypeSafeEventSystem): ECSFluentAPI;
|
|
4679
4573
|
|
|
4680
4574
|
/**
|
|
4681
|
-
*
|
|
4575
|
+
* 全局系统接口
|
|
4576
|
+
* 全局系统是在World级别运行的系统,不依赖特定Scene
|
|
4682
4577
|
*/
|
|
4683
|
-
|
|
4684
|
-
collectEntityData(): IEntityDebugData;
|
|
4685
|
-
getRawEntityList(): Array<{
|
|
4686
|
-
id: number;
|
|
4687
|
-
name: string;
|
|
4688
|
-
active: boolean;
|
|
4689
|
-
enabled: boolean;
|
|
4690
|
-
activeInHierarchy: boolean;
|
|
4691
|
-
componentCount: number;
|
|
4692
|
-
componentTypes: string[];
|
|
4693
|
-
parentId: number | null;
|
|
4694
|
-
childIds: number[];
|
|
4695
|
-
depth: number;
|
|
4696
|
-
tag: number;
|
|
4697
|
-
updateOrder: number;
|
|
4698
|
-
}>;
|
|
4699
|
-
getEntityDetails(entityId: number): any;
|
|
4700
|
-
private getSceneInfo;
|
|
4701
|
-
collectEntityDataWithMemory(): IEntityDebugData;
|
|
4702
|
-
private collectArchetypeData;
|
|
4703
|
-
private getArchetypeDistributionFast;
|
|
4704
|
-
private getTopEntitiesByComponentsFast;
|
|
4705
|
-
private collectArchetypeDataWithMemory;
|
|
4706
|
-
private extractArchetypeStatistics;
|
|
4707
|
-
private extractArchetypeStatisticsWithMemory;
|
|
4708
|
-
private getArchetypeDistribution;
|
|
4709
|
-
private getArchetypeDistributionWithMemory;
|
|
4710
|
-
private getTopEntitiesByComponents;
|
|
4711
|
-
private getTopEntitiesByComponentsWithMemory;
|
|
4712
|
-
private getEmptyEntityDebugData;
|
|
4713
|
-
private calculateFallbackEntityStats;
|
|
4714
|
-
estimateEntityMemoryUsage(entity: any): number;
|
|
4715
|
-
calculateObjectSize(obj: any, excludeKeys?: string[]): number;
|
|
4716
|
-
private buildEntityHierarchyTree;
|
|
4578
|
+
interface IGlobalSystem {
|
|
4717
4579
|
/**
|
|
4718
|
-
*
|
|
4580
|
+
* 系统名称
|
|
4719
4581
|
*/
|
|
4720
|
-
|
|
4582
|
+
readonly name: string;
|
|
4721
4583
|
/**
|
|
4722
|
-
*
|
|
4584
|
+
* 初始化系统
|
|
4723
4585
|
*/
|
|
4724
|
-
|
|
4586
|
+
initialize?(): void;
|
|
4725
4587
|
/**
|
|
4726
|
-
*
|
|
4588
|
+
* 更新系统
|
|
4727
4589
|
*/
|
|
4728
|
-
|
|
4590
|
+
update(deltaTime?: number): void;
|
|
4729
4591
|
/**
|
|
4730
|
-
*
|
|
4592
|
+
* 重置系统
|
|
4731
4593
|
*/
|
|
4732
|
-
|
|
4733
|
-
typeName: string;
|
|
4734
|
-
properties: Record<string, any>;
|
|
4735
|
-
}>;
|
|
4594
|
+
reset?(): void;
|
|
4736
4595
|
/**
|
|
4737
|
-
*
|
|
4596
|
+
* 销毁系统
|
|
4738
4597
|
*/
|
|
4739
|
-
|
|
4598
|
+
destroy?(): void;
|
|
4599
|
+
}
|
|
4600
|
+
/**
|
|
4601
|
+
* World配置接口
|
|
4602
|
+
*/
|
|
4603
|
+
interface IWorldConfig {
|
|
4740
4604
|
/**
|
|
4741
|
-
*
|
|
4605
|
+
* World名称
|
|
4742
4606
|
*/
|
|
4743
|
-
|
|
4607
|
+
name?: string;
|
|
4744
4608
|
/**
|
|
4745
|
-
*
|
|
4609
|
+
* 是否启用调试模式
|
|
4746
4610
|
*/
|
|
4747
|
-
|
|
4611
|
+
debug?: boolean;
|
|
4748
4612
|
/**
|
|
4749
|
-
*
|
|
4613
|
+
* 最大Scene数量限制
|
|
4750
4614
|
*/
|
|
4751
|
-
|
|
4615
|
+
maxScenes?: number;
|
|
4752
4616
|
/**
|
|
4753
|
-
*
|
|
4617
|
+
* 是否自动清理空Scene
|
|
4754
4618
|
*/
|
|
4755
|
-
|
|
4619
|
+
autoCleanup?: boolean;
|
|
4620
|
+
}
|
|
4621
|
+
/**
|
|
4622
|
+
* World类 - ECS世界管理器
|
|
4623
|
+
*
|
|
4624
|
+
* World是Scene的容器,每个World可以管理多个Scene。
|
|
4625
|
+
* 这种设计允许创建独立的游戏世界,如:
|
|
4626
|
+
* - 游戏房间(每个房间一个World)
|
|
4627
|
+
* - 不同的游戏模式
|
|
4628
|
+
* - 独立的模拟环境
|
|
4629
|
+
*
|
|
4630
|
+
* @example
|
|
4631
|
+
* ```typescript
|
|
4632
|
+
* // 创建游戏房间的World
|
|
4633
|
+
* const roomWorld = new World({ name: 'Room_001' });
|
|
4634
|
+
*
|
|
4635
|
+
* // 在World中创建Scene
|
|
4636
|
+
* const gameScene = roomWorld.createScene('game', new Scene());
|
|
4637
|
+
* const uiScene = roomWorld.createScene('ui', new Scene());
|
|
4638
|
+
*
|
|
4639
|
+
* // 更新整个World
|
|
4640
|
+
* roomWorld.update(deltaTime);
|
|
4641
|
+
* ```
|
|
4642
|
+
*/
|
|
4643
|
+
declare class World {
|
|
4644
|
+
readonly name: string;
|
|
4645
|
+
private readonly _config;
|
|
4646
|
+
private readonly _scenes;
|
|
4647
|
+
private readonly _activeScenes;
|
|
4648
|
+
private readonly _globalSystems;
|
|
4649
|
+
private _isActive;
|
|
4650
|
+
private _createdAt;
|
|
4651
|
+
constructor(config?: IWorldConfig);
|
|
4756
4652
|
/**
|
|
4757
|
-
*
|
|
4653
|
+
* 创建并添加Scene到World
|
|
4758
4654
|
*/
|
|
4759
|
-
|
|
4655
|
+
createScene<T extends IScene>(sceneId: string, sceneInstance?: T): T;
|
|
4760
4656
|
/**
|
|
4761
|
-
*
|
|
4657
|
+
* 移除Scene
|
|
4762
4658
|
*/
|
|
4763
|
-
|
|
4659
|
+
removeScene(sceneId: string): boolean;
|
|
4764
4660
|
/**
|
|
4765
|
-
*
|
|
4661
|
+
* 获取Scene
|
|
4766
4662
|
*/
|
|
4767
|
-
|
|
4768
|
-
}
|
|
4769
|
-
|
|
4770
|
-
/**
|
|
4771
|
-
* 系统数据收集器
|
|
4772
|
-
*/
|
|
4773
|
-
declare class SystemDataCollector {
|
|
4663
|
+
getScene<T extends IScene>(sceneId: string): T | null;
|
|
4774
4664
|
/**
|
|
4775
|
-
*
|
|
4665
|
+
* 获取所有Scene ID
|
|
4776
4666
|
*/
|
|
4777
|
-
|
|
4778
|
-
}
|
|
4779
|
-
|
|
4780
|
-
/**
|
|
4781
|
-
* 性能数据收集器
|
|
4782
|
-
*/
|
|
4783
|
-
declare class PerformanceDataCollector {
|
|
4784
|
-
private frameTimeHistory;
|
|
4785
|
-
private maxHistoryLength;
|
|
4786
|
-
private lastGCCount;
|
|
4787
|
-
private gcCollections;
|
|
4788
|
-
private lastMemoryCheck;
|
|
4667
|
+
getSceneIds(): string[];
|
|
4789
4668
|
/**
|
|
4790
|
-
*
|
|
4669
|
+
* 获取所有Scene
|
|
4791
4670
|
*/
|
|
4792
|
-
|
|
4671
|
+
getAllScenes(): IScene[];
|
|
4793
4672
|
/**
|
|
4794
|
-
*
|
|
4673
|
+
* 设置Scene激活状态
|
|
4795
4674
|
*/
|
|
4796
|
-
|
|
4675
|
+
setSceneActive(sceneId: string, active: boolean): void;
|
|
4797
4676
|
/**
|
|
4798
|
-
*
|
|
4677
|
+
* 检查Scene是否激活
|
|
4799
4678
|
*/
|
|
4800
|
-
|
|
4679
|
+
isSceneActive(sceneId: string): boolean;
|
|
4801
4680
|
/**
|
|
4802
|
-
*
|
|
4681
|
+
* 获取活跃Scene数量
|
|
4803
4682
|
*/
|
|
4804
|
-
|
|
4683
|
+
getActiveSceneCount(): number;
|
|
4805
4684
|
/**
|
|
4806
|
-
*
|
|
4685
|
+
* 添加全局System
|
|
4686
|
+
* 全局System会在所有激活Scene之前更新
|
|
4807
4687
|
*/
|
|
4808
|
-
|
|
4809
|
-
}
|
|
4810
|
-
|
|
4811
|
-
/**
|
|
4812
|
-
* 组件数据收集器
|
|
4813
|
-
*/
|
|
4814
|
-
declare class ComponentDataCollector {
|
|
4815
|
-
private static componentSizeCache;
|
|
4688
|
+
addGlobalSystem<T extends IGlobalSystem>(system: T): T;
|
|
4816
4689
|
/**
|
|
4817
|
-
*
|
|
4690
|
+
* 移除全局System
|
|
4818
4691
|
*/
|
|
4819
|
-
|
|
4692
|
+
removeGlobalSystem(system: IGlobalSystem): boolean;
|
|
4820
4693
|
/**
|
|
4821
|
-
*
|
|
4694
|
+
* 获取全局System
|
|
4822
4695
|
*/
|
|
4823
|
-
|
|
4824
|
-
private calculateQuickObjectSize;
|
|
4696
|
+
getGlobalSystem<T extends IGlobalSystem>(type: new (...args: any[]) => T): T | null;
|
|
4825
4697
|
/**
|
|
4826
|
-
*
|
|
4827
|
-
* 只在用户主动请求内存快照时调用
|
|
4698
|
+
* 启动World
|
|
4828
4699
|
*/
|
|
4829
|
-
|
|
4700
|
+
start(): void;
|
|
4830
4701
|
/**
|
|
4831
|
-
*
|
|
4832
|
-
* 优化版本:减少递归深度,提高性能
|
|
4702
|
+
* 停止World
|
|
4833
4703
|
*/
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4704
|
+
stop(): void;
|
|
4705
|
+
/**
|
|
4706
|
+
* 更新World中的全局System
|
|
4707
|
+
* 注意:此方法由Core.update()调用,不应直接调用
|
|
4708
|
+
*/
|
|
4709
|
+
updateGlobalSystems(): void;
|
|
4710
|
+
/**
|
|
4711
|
+
* 更新World中的所有激活Scene
|
|
4712
|
+
* 注意:此方法由Core.update()调用,不应直接调用
|
|
4713
|
+
*/
|
|
4714
|
+
updateScenes(): void;
|
|
4715
|
+
/**
|
|
4716
|
+
* 销毁World
|
|
4717
|
+
*/
|
|
4718
|
+
destroy(): void;
|
|
4719
|
+
/**
|
|
4720
|
+
* 获取World状态
|
|
4721
|
+
*/
|
|
4722
|
+
getStatus(): {
|
|
4723
|
+
name: string;
|
|
4724
|
+
isActive: boolean;
|
|
4725
|
+
sceneCount: number;
|
|
4726
|
+
activeSceneCount: number;
|
|
4727
|
+
globalSystemCount: number;
|
|
4728
|
+
createdAt: number;
|
|
4729
|
+
config: {
|
|
4730
|
+
/**
|
|
4731
|
+
* World名称
|
|
4732
|
+
*/
|
|
4733
|
+
name?: string;
|
|
4734
|
+
/**
|
|
4735
|
+
* 是否启用调试模式
|
|
4736
|
+
*/
|
|
4737
|
+
debug?: boolean;
|
|
4738
|
+
/**
|
|
4739
|
+
* 最大Scene数量限制
|
|
4740
|
+
*/
|
|
4741
|
+
maxScenes?: number;
|
|
4742
|
+
/**
|
|
4743
|
+
* 是否自动清理空Scene
|
|
4744
|
+
*/
|
|
4745
|
+
autoCleanup?: boolean;
|
|
4746
|
+
};
|
|
4747
|
+
scenes: {
|
|
4748
|
+
id: string;
|
|
4749
|
+
isActive: boolean;
|
|
4750
|
+
name: string;
|
|
4751
|
+
}[];
|
|
4752
|
+
};
|
|
4753
|
+
/**
|
|
4754
|
+
* 获取World统计信息
|
|
4755
|
+
*/
|
|
4756
|
+
getStats(): {
|
|
4757
|
+
totalEntities: number;
|
|
4758
|
+
totalSystems: number;
|
|
4759
|
+
memoryUsage: number;
|
|
4760
|
+
performance: {
|
|
4761
|
+
averageUpdateTime: number;
|
|
4762
|
+
maxUpdateTime: number;
|
|
4763
|
+
};
|
|
4764
|
+
};
|
|
4765
|
+
/**
|
|
4766
|
+
* 检查是否应该执行自动清理
|
|
4767
|
+
*/
|
|
4768
|
+
private shouldAutoCleanup;
|
|
4769
|
+
/**
|
|
4770
|
+
* 执行清理操作
|
|
4771
|
+
*/
|
|
4772
|
+
private cleanup;
|
|
4773
|
+
/**
|
|
4774
|
+
* 检查World是否激活
|
|
4775
|
+
*/
|
|
4776
|
+
get isActive(): boolean;
|
|
4777
|
+
/**
|
|
4778
|
+
* 获取Scene数量
|
|
4779
|
+
*/
|
|
4780
|
+
get sceneCount(): number;
|
|
4781
|
+
/**
|
|
4782
|
+
* 获取创建时间
|
|
4783
|
+
*/
|
|
4784
|
+
get createdAt(): number;
|
|
4785
|
+
}
|
|
4786
|
+
|
|
4787
|
+
/**
|
|
4788
|
+
* WorldManager配置接口
|
|
4789
|
+
*/
|
|
4790
|
+
interface IWorldManagerConfig {
|
|
4791
|
+
/**
|
|
4792
|
+
* 最大World数量
|
|
4793
|
+
*/
|
|
4794
|
+
maxWorlds?: number;
|
|
4795
|
+
/**
|
|
4796
|
+
* 是否自动清理空World
|
|
4797
|
+
*/
|
|
4798
|
+
autoCleanup?: boolean;
|
|
4799
|
+
/**
|
|
4800
|
+
* 清理间隔(毫秒)
|
|
4801
|
+
*/
|
|
4802
|
+
cleanupInterval?: number;
|
|
4803
|
+
/**
|
|
4804
|
+
* 是否启用调试模式
|
|
4805
|
+
*/
|
|
4806
|
+
debug?: boolean;
|
|
4807
|
+
}
|
|
4808
|
+
/**
|
|
4809
|
+
* World管理器 - 管理所有World实例
|
|
4810
|
+
*
|
|
4811
|
+
* WorldManager是全局单例,负责管理所有World的生命周期。
|
|
4812
|
+
* 每个World都是独立的ECS环境,可以包含多个Scene。
|
|
4813
|
+
*
|
|
4814
|
+
* 设计理念:
|
|
4815
|
+
* - Core负责单Scene的传统ECS管理
|
|
4816
|
+
* - World负责多Scene的管理和协调
|
|
4817
|
+
* - WorldManager负责多World的全局管理
|
|
4818
|
+
*
|
|
4819
|
+
* @example
|
|
4820
|
+
* ```typescript
|
|
4821
|
+
* // 获取全局WorldManager
|
|
4822
|
+
* const worldManager = WorldManager.getInstance();
|
|
4823
|
+
*
|
|
4824
|
+
* // 创建游戏房间World
|
|
4825
|
+
* const roomWorld = worldManager.createWorld('room_001', {
|
|
4826
|
+
* name: 'GameRoom_001',
|
|
4827
|
+
* maxScenes: 5
|
|
4828
|
+
* });
|
|
4829
|
+
*
|
|
4830
|
+
* // 在游戏循环中更新所有World
|
|
4831
|
+
* worldManager.updateAll(deltaTime);
|
|
4832
|
+
* ```
|
|
4833
|
+
*/
|
|
4834
|
+
declare class WorldManager {
|
|
4835
|
+
private static _instance;
|
|
4836
|
+
private readonly _config;
|
|
4837
|
+
private readonly _worlds;
|
|
4838
|
+
private readonly _activeWorlds;
|
|
4839
|
+
private _cleanupTimer;
|
|
4840
|
+
private _isRunning;
|
|
4841
|
+
private constructor();
|
|
4842
|
+
/**
|
|
4843
|
+
* 获取WorldManager单例实例
|
|
4844
|
+
*/
|
|
4845
|
+
static getInstance(config?: IWorldManagerConfig): WorldManager;
|
|
4846
|
+
/**
|
|
4847
|
+
* 重置WorldManager实例(主要用于测试)
|
|
4848
|
+
*/
|
|
4849
|
+
static reset(): void;
|
|
4850
|
+
/**
|
|
4851
|
+
* 创建新World
|
|
4852
|
+
*/
|
|
4853
|
+
createWorld(worldId: string, config?: IWorldConfig): World;
|
|
4854
|
+
/**
|
|
4855
|
+
* 移除World
|
|
4856
|
+
*/
|
|
4857
|
+
removeWorld(worldId: string): boolean;
|
|
4858
|
+
/**
|
|
4859
|
+
* 获取World
|
|
4860
|
+
*/
|
|
4861
|
+
getWorld(worldId: string): World | null;
|
|
4862
|
+
/**
|
|
4863
|
+
* 获取所有World ID
|
|
4864
|
+
*/
|
|
4865
|
+
getWorldIds(): string[];
|
|
4866
|
+
/**
|
|
4867
|
+
* 获取所有World
|
|
4868
|
+
*/
|
|
4869
|
+
getAllWorlds(): World[];
|
|
4870
|
+
/**
|
|
4871
|
+
* 设置World激活状态
|
|
4872
|
+
*/
|
|
4873
|
+
setWorldActive(worldId: string, active: boolean): void;
|
|
4874
|
+
/**
|
|
4875
|
+
* 检查World是否激活
|
|
4876
|
+
*/
|
|
4877
|
+
isWorldActive(worldId: string): boolean;
|
|
4878
|
+
/**
|
|
4879
|
+
* 获取所有激活的World
|
|
4880
|
+
* 注意:此方法供Core.update()使用
|
|
4881
|
+
*/
|
|
4882
|
+
getActiveWorlds(): World[];
|
|
4883
|
+
/**
|
|
4884
|
+
* 启动所有World
|
|
4885
|
+
*/
|
|
4886
|
+
startAll(): void;
|
|
4887
|
+
/**
|
|
4888
|
+
* 停止所有World
|
|
4889
|
+
*/
|
|
4890
|
+
stopAll(): void;
|
|
4891
|
+
/**
|
|
4892
|
+
* 查找满足条件的World
|
|
4893
|
+
*/
|
|
4894
|
+
findWorlds(predicate: (world: World) => boolean): World[];
|
|
4895
|
+
/**
|
|
4896
|
+
* 根据名称查找World
|
|
4897
|
+
*/
|
|
4898
|
+
findWorldByName(name: string): World | null;
|
|
4899
|
+
/**
|
|
4900
|
+
* 获取WorldManager统计信息
|
|
4901
|
+
*/
|
|
4902
|
+
getStats(): {
|
|
4903
|
+
totalWorlds: number;
|
|
4904
|
+
activeWorlds: number;
|
|
4905
|
+
totalScenes: number;
|
|
4906
|
+
totalEntities: number;
|
|
4907
|
+
totalSystems: number;
|
|
4908
|
+
memoryUsage: number;
|
|
4909
|
+
isRunning: boolean;
|
|
4910
|
+
config: {
|
|
4911
|
+
/**
|
|
4912
|
+
* 最大World数量
|
|
4913
|
+
*/
|
|
4914
|
+
maxWorlds?: number;
|
|
4915
|
+
/**
|
|
4916
|
+
* 是否自动清理空World
|
|
4917
|
+
*/
|
|
4918
|
+
autoCleanup?: boolean;
|
|
4919
|
+
/**
|
|
4920
|
+
* 清理间隔(毫秒)
|
|
4921
|
+
*/
|
|
4922
|
+
cleanupInterval?: number;
|
|
4923
|
+
/**
|
|
4924
|
+
* 是否启用调试模式
|
|
4925
|
+
*/
|
|
4926
|
+
debug?: boolean;
|
|
4927
|
+
};
|
|
4928
|
+
worlds: any[];
|
|
4929
|
+
};
|
|
4930
|
+
/**
|
|
4931
|
+
* 获取详细状态信息
|
|
4932
|
+
*/
|
|
4933
|
+
getDetailedStatus(): {
|
|
4934
|
+
worlds: {
|
|
4935
|
+
id: string;
|
|
4936
|
+
isActive: boolean;
|
|
4937
|
+
status: {
|
|
4938
|
+
name: string;
|
|
4939
|
+
isActive: boolean;
|
|
4940
|
+
sceneCount: number;
|
|
4941
|
+
activeSceneCount: number;
|
|
4942
|
+
globalSystemCount: number;
|
|
4943
|
+
createdAt: number;
|
|
4944
|
+
config: {
|
|
4945
|
+
name?: string;
|
|
4946
|
+
debug?: boolean;
|
|
4947
|
+
maxScenes?: number;
|
|
4948
|
+
autoCleanup?: boolean;
|
|
4949
|
+
};
|
|
4950
|
+
scenes: {
|
|
4951
|
+
id: string;
|
|
4952
|
+
isActive: boolean;
|
|
4953
|
+
name: string;
|
|
4954
|
+
}[];
|
|
4955
|
+
};
|
|
4956
|
+
}[];
|
|
4957
|
+
totalWorlds: number;
|
|
4958
|
+
activeWorlds: number;
|
|
4959
|
+
totalScenes: number;
|
|
4960
|
+
totalEntities: number;
|
|
4961
|
+
totalSystems: number;
|
|
4962
|
+
memoryUsage: number;
|
|
4963
|
+
isRunning: boolean;
|
|
4964
|
+
config: {
|
|
4965
|
+
/**
|
|
4966
|
+
* 最大World数量
|
|
4967
|
+
*/
|
|
4968
|
+
maxWorlds?: number;
|
|
4969
|
+
/**
|
|
4970
|
+
* 是否自动清理空World
|
|
4971
|
+
*/
|
|
4972
|
+
autoCleanup?: boolean;
|
|
4973
|
+
/**
|
|
4974
|
+
* 清理间隔(毫秒)
|
|
4975
|
+
*/
|
|
4976
|
+
cleanupInterval?: number;
|
|
4977
|
+
/**
|
|
4978
|
+
* 是否启用调试模式
|
|
4979
|
+
*/
|
|
4980
|
+
debug?: boolean;
|
|
4981
|
+
};
|
|
4982
|
+
};
|
|
4983
|
+
/**
|
|
4984
|
+
* 清理空World
|
|
4985
|
+
*/
|
|
4986
|
+
cleanup(): number;
|
|
4987
|
+
/**
|
|
4988
|
+
* 销毁WorldManager
|
|
4989
|
+
*/
|
|
4990
|
+
destroy(): void;
|
|
4991
|
+
/**
|
|
4992
|
+
* 启动清理定时器
|
|
4993
|
+
*/
|
|
4994
|
+
private startCleanupTimer;
|
|
4995
|
+
/**
|
|
4996
|
+
* 停止清理定时器
|
|
4997
|
+
*/
|
|
4998
|
+
private stopCleanupTimer;
|
|
4999
|
+
/**
|
|
5000
|
+
* 判断World是否应该被清理
|
|
5001
|
+
*/
|
|
5002
|
+
private shouldCleanupWorld;
|
|
5003
|
+
/**
|
|
5004
|
+
* 获取World总数
|
|
5005
|
+
*/
|
|
5006
|
+
get worldCount(): number;
|
|
5007
|
+
/**
|
|
5008
|
+
* 获取激活World数量
|
|
5009
|
+
*/
|
|
5010
|
+
get activeWorldCount(): number;
|
|
5011
|
+
/**
|
|
5012
|
+
* 检查是否正在运行
|
|
5013
|
+
*/
|
|
5014
|
+
get isRunning(): boolean;
|
|
5015
|
+
/**
|
|
5016
|
+
* 获取配置
|
|
5017
|
+
*/
|
|
5018
|
+
get config(): IWorldManagerConfig;
|
|
5019
|
+
}
|
|
5020
|
+
|
|
5021
|
+
/**
|
|
5022
|
+
* 实体数据收集器
|
|
5023
|
+
*/
|
|
5024
|
+
declare class EntityDataCollector {
|
|
5025
|
+
collectEntityData(): IEntityDebugData;
|
|
5026
|
+
getRawEntityList(): Array<{
|
|
5027
|
+
id: number;
|
|
5028
|
+
name: string;
|
|
5029
|
+
active: boolean;
|
|
5030
|
+
enabled: boolean;
|
|
5031
|
+
activeInHierarchy: boolean;
|
|
5032
|
+
componentCount: number;
|
|
5033
|
+
componentTypes: string[];
|
|
5034
|
+
parentId: number | null;
|
|
5035
|
+
childIds: number[];
|
|
5036
|
+
depth: number;
|
|
5037
|
+
tag: number;
|
|
5038
|
+
updateOrder: number;
|
|
5039
|
+
}>;
|
|
5040
|
+
getEntityDetails(entityId: number): any;
|
|
5041
|
+
private getSceneInfo;
|
|
5042
|
+
collectEntityDataWithMemory(): IEntityDebugData;
|
|
5043
|
+
private collectArchetypeData;
|
|
5044
|
+
private getArchetypeDistributionFast;
|
|
5045
|
+
private getTopEntitiesByComponentsFast;
|
|
5046
|
+
private collectArchetypeDataWithMemory;
|
|
5047
|
+
private extractArchetypeStatistics;
|
|
5048
|
+
private extractArchetypeStatisticsWithMemory;
|
|
5049
|
+
private getArchetypeDistribution;
|
|
5050
|
+
private getArchetypeDistributionWithMemory;
|
|
5051
|
+
private getTopEntitiesByComponents;
|
|
5052
|
+
private getTopEntitiesByComponentsWithMemory;
|
|
5053
|
+
private getEmptyEntityDebugData;
|
|
5054
|
+
private calculateFallbackEntityStats;
|
|
5055
|
+
estimateEntityMemoryUsage(entity: any): number;
|
|
5056
|
+
calculateObjectSize(obj: any, excludeKeys?: string[]): number;
|
|
5057
|
+
private buildEntityHierarchyTree;
|
|
5058
|
+
/**
|
|
5059
|
+
* 构建实体层次结构节点
|
|
5060
|
+
*/
|
|
5061
|
+
private buildEntityHierarchyNode;
|
|
5062
|
+
/**
|
|
5063
|
+
* 构建实体详情映射
|
|
5064
|
+
*/
|
|
5065
|
+
private buildEntityDetailsMap;
|
|
5066
|
+
/**
|
|
5067
|
+
* 构建实体基础信息
|
|
5068
|
+
*/
|
|
5069
|
+
private buildFallbackEntityInfo;
|
|
5070
|
+
/**
|
|
5071
|
+
* 提取组件详细信息
|
|
5072
|
+
*/
|
|
5073
|
+
extractComponentDetails(components: Component[]): Array<{
|
|
5074
|
+
typeName: string;
|
|
5075
|
+
properties: Record<string, any>;
|
|
5076
|
+
}>;
|
|
5077
|
+
/**
|
|
5078
|
+
* 获取组件的完整属性信息(仅在需要时调用)
|
|
5079
|
+
*/
|
|
5080
|
+
getComponentProperties(entityId: number, componentIndex: number): Record<string, any>;
|
|
5081
|
+
/**
|
|
5082
|
+
* 格式化属性值
|
|
5083
|
+
*/
|
|
5084
|
+
private formatPropertyValue;
|
|
5085
|
+
/**
|
|
5086
|
+
* 格式化对象第一层
|
|
5087
|
+
*/
|
|
5088
|
+
private formatObjectFirstLevel;
|
|
5089
|
+
/**
|
|
5090
|
+
* 创建懒加载占位符
|
|
5091
|
+
*/
|
|
5092
|
+
private createLazyLoadPlaceholder;
|
|
5093
|
+
/**
|
|
5094
|
+
* 获取对象摘要信息
|
|
5095
|
+
*/
|
|
5096
|
+
private getObjectSummary;
|
|
5097
|
+
/**
|
|
5098
|
+
* 生成对象ID
|
|
5099
|
+
*/
|
|
5100
|
+
private generateObjectId;
|
|
5101
|
+
/**
|
|
5102
|
+
* 展开懒加载对象(供调试面板调用)
|
|
5103
|
+
*/
|
|
5104
|
+
expandLazyObject(entityId: number, componentIndex: number, propertyPath: string): any;
|
|
5105
|
+
/**
|
|
5106
|
+
* 根据路径获取对象
|
|
5107
|
+
*/
|
|
5108
|
+
private getObjectByPath;
|
|
5109
|
+
}
|
|
5110
|
+
|
|
5111
|
+
/**
|
|
5112
|
+
* 系统数据收集器
|
|
5113
|
+
*/
|
|
5114
|
+
declare class SystemDataCollector {
|
|
5115
|
+
/**
|
|
5116
|
+
* 收集系统数据
|
|
5117
|
+
*/
|
|
5118
|
+
collectSystemData(performanceMonitor: any): ISystemDebugData;
|
|
5119
|
+
}
|
|
5120
|
+
|
|
5121
|
+
/**
|
|
5122
|
+
* 性能数据收集器
|
|
5123
|
+
*/
|
|
5124
|
+
declare class PerformanceDataCollector {
|
|
5125
|
+
private frameTimeHistory;
|
|
5126
|
+
private maxHistoryLength;
|
|
5127
|
+
private lastGCCount;
|
|
5128
|
+
private gcCollections;
|
|
5129
|
+
private lastMemoryCheck;
|
|
5130
|
+
/**
|
|
5131
|
+
* 收集性能数据
|
|
5132
|
+
*/
|
|
5133
|
+
collectPerformanceData(performanceMonitor: any): IPerformanceDebugData;
|
|
5134
|
+
/**
|
|
5135
|
+
* 获取ECS框架整体性能数据
|
|
5136
|
+
*/
|
|
5137
|
+
private getECSPerformanceData;
|
|
5138
|
+
/**
|
|
5139
|
+
* 获取系统性能数据
|
|
5140
|
+
*/
|
|
5141
|
+
private getSystemPerformance;
|
|
5142
|
+
/**
|
|
5143
|
+
* 获取内存详情
|
|
5144
|
+
*/
|
|
5145
|
+
private getMemoryDetails;
|
|
5146
|
+
/**
|
|
5147
|
+
* 更新GC计数
|
|
5148
|
+
*/
|
|
5149
|
+
private updateGCCount;
|
|
5150
|
+
}
|
|
5151
|
+
|
|
5152
|
+
/**
|
|
5153
|
+
* 组件数据收集器
|
|
5154
|
+
*/
|
|
5155
|
+
declare class ComponentDataCollector {
|
|
5156
|
+
private static componentSizeCache;
|
|
5157
|
+
/**
|
|
5158
|
+
* 收集组件数据(轻量版,不计算实际内存大小)
|
|
5159
|
+
*/
|
|
5160
|
+
collectComponentData(): IComponentDebugData;
|
|
5161
|
+
/**
|
|
5162
|
+
* 获取组件类型的估算内存大小(基于预设值,不进行实际计算)
|
|
5163
|
+
*/
|
|
5164
|
+
private getEstimatedComponentSize;
|
|
5165
|
+
private calculateQuickObjectSize;
|
|
5166
|
+
/**
|
|
5167
|
+
* 为内存快照功能提供的详细内存计算
|
|
5168
|
+
* 只在用户主动请求内存快照时调用
|
|
5169
|
+
*/
|
|
5170
|
+
calculateDetailedComponentMemory(typeName: string): number;
|
|
5171
|
+
/**
|
|
5172
|
+
* 估算对象内存大小(仅用于内存快照)
|
|
5173
|
+
* 优化版本:减少递归深度,提高性能
|
|
5174
|
+
*/
|
|
5175
|
+
private estimateObjectSize;
|
|
5176
|
+
static clearCache(): void;
|
|
5177
|
+
}
|
|
5178
|
+
|
|
4838
5179
|
/**
|
|
4839
5180
|
* 场景数据收集器
|
|
4840
5181
|
*/
|
|
@@ -5040,6 +5381,18 @@ declare class Core {
|
|
|
5040
5381
|
* 当设置为true时,游戏循环将暂停执行。
|
|
5041
5382
|
*/
|
|
5042
5383
|
static paused: boolean;
|
|
5384
|
+
/**
|
|
5385
|
+
* 默认World ID
|
|
5386
|
+
*
|
|
5387
|
+
* 用于单Scene模式的默认World标识
|
|
5388
|
+
*/
|
|
5389
|
+
private static readonly DEFAULT_WORLD_ID;
|
|
5390
|
+
/**
|
|
5391
|
+
* 默认Scene ID
|
|
5392
|
+
*
|
|
5393
|
+
* 用于单Scene模式的默认Scene标识
|
|
5394
|
+
*/
|
|
5395
|
+
private static readonly DEFAULT_SCENE_ID;
|
|
5043
5396
|
/**
|
|
5044
5397
|
* 全局核心实例
|
|
5045
5398
|
*/
|
|
@@ -5060,12 +5413,6 @@ declare class Core {
|
|
|
5060
5413
|
* 在调试模式下会启用额外的性能监控和错误检查。
|
|
5061
5414
|
*/
|
|
5062
5415
|
readonly debug: boolean;
|
|
5063
|
-
/**
|
|
5064
|
-
* 待切换的场景
|
|
5065
|
-
*
|
|
5066
|
-
* 存储下一帧要切换到的场景实例。
|
|
5067
|
-
*/
|
|
5068
|
-
_nextScene: IScene | null;
|
|
5069
5416
|
/**
|
|
5070
5417
|
* 全局管理器集合
|
|
5071
5418
|
*
|
|
@@ -5096,16 +5443,18 @@ declare class Core {
|
|
|
5096
5443
|
* 提供便捷的ECS操作接口。
|
|
5097
5444
|
*/
|
|
5098
5445
|
_ecsAPI?: ECSFluentAPI;
|
|
5099
|
-
/**
|
|
5100
|
-
* 当前活动场景
|
|
5101
|
-
*/
|
|
5102
|
-
_scene?: IScene;
|
|
5103
5446
|
/**
|
|
5104
5447
|
* 调试管理器
|
|
5105
5448
|
*
|
|
5106
5449
|
* 负责收集和发送调试数据。
|
|
5107
5450
|
*/
|
|
5108
5451
|
_debugManager?: DebugManager;
|
|
5452
|
+
/**
|
|
5453
|
+
* World管理器
|
|
5454
|
+
*
|
|
5455
|
+
* 管理多个World实例,支持多房间/多世界架构。
|
|
5456
|
+
*/
|
|
5457
|
+
_worldManager?: WorldManager;
|
|
5109
5458
|
/**
|
|
5110
5459
|
* Core配置
|
|
5111
5460
|
*/
|
|
@@ -5127,58 +5476,24 @@ declare class Core {
|
|
|
5127
5476
|
*/
|
|
5128
5477
|
static get Instance(): Core;
|
|
5129
5478
|
/**
|
|
5130
|
-
*
|
|
5479
|
+
* 获取当前活动的场景(属性访问器)
|
|
5131
5480
|
*
|
|
5132
5481
|
* @returns 当前场景实例,如果没有则返回null
|
|
5133
5482
|
*/
|
|
5134
5483
|
static get scene(): IScene | null;
|
|
5135
5484
|
/**
|
|
5136
|
-
*
|
|
5485
|
+
* 获取当前活动的场景(方法调用)
|
|
5137
5486
|
*
|
|
5138
|
-
* @
|
|
5139
|
-
* 而 setScene() 提供更好的类型安全性和可预测的激活时序。
|
|
5140
|
-
*
|
|
5141
|
-
* 迁移示例:
|
|
5142
|
-
* ```typescript
|
|
5143
|
-
* // 旧方式(已废弃)
|
|
5144
|
-
* Core.scene = myScene;
|
|
5145
|
-
*
|
|
5146
|
-
* // 新方式(推荐)
|
|
5147
|
-
* Core.setScene(myScene);
|
|
5148
|
-
* ```
|
|
5149
|
-
*
|
|
5150
|
-
* 如果当前没有场景,会立即切换;否则会在下一帧切换。
|
|
5151
|
-
*
|
|
5152
|
-
* @param value - 场景实例
|
|
5487
|
+
* @returns 当前场景实例,如果没有则返回null
|
|
5153
5488
|
*/
|
|
5154
|
-
static
|
|
5489
|
+
static getScene<T extends IScene>(): T | null;
|
|
5155
5490
|
/**
|
|
5156
|
-
*
|
|
5157
|
-
*
|
|
5158
|
-
* 这是设置场景的推荐方法,提供更好的类型安全性和可预测的激活时序。
|
|
5159
|
-
* 相比于 scene setter,此方法能确保场景正确初始化和激活。
|
|
5160
|
-
*
|
|
5161
|
-
* 如果当前没有场景,会立即切换;否则会在下一帧切换。
|
|
5491
|
+
* 设置当前场景
|
|
5162
5492
|
*
|
|
5163
5493
|
* @param scene - 要设置的场景实例
|
|
5164
5494
|
* @returns 设置的场景实例,便于链式调用
|
|
5165
|
-
*
|
|
5166
|
-
* @example
|
|
5167
|
-
* ```typescript
|
|
5168
|
-
* const myScene = new MyScene();
|
|
5169
|
-
* Core.setScene(myScene);
|
|
5170
|
-
*
|
|
5171
|
-
* // 链式调用
|
|
5172
|
-
* const scene = Core.setScene(new MyScene()).addSystem(new MySystem());
|
|
5173
|
-
* ```
|
|
5174
5495
|
*/
|
|
5175
5496
|
static setScene<T extends IScene>(scene: T): T;
|
|
5176
|
-
/**
|
|
5177
|
-
* 类型安全的场景获取方法
|
|
5178
|
-
*
|
|
5179
|
-
* @returns 当前场景实例
|
|
5180
|
-
*/
|
|
5181
|
-
static getScene<T extends IScene>(): T | null;
|
|
5182
5497
|
/**
|
|
5183
5498
|
* 创建Core实例
|
|
5184
5499
|
*
|
|
@@ -5288,11 +5603,23 @@ declare class Core {
|
|
|
5288
5603
|
*/
|
|
5289
5604
|
static get supportsBigInt(): boolean;
|
|
5290
5605
|
/**
|
|
5291
|
-
*
|
|
5606
|
+
* 获取WorldManager实例
|
|
5292
5607
|
*
|
|
5293
|
-
* @
|
|
5608
|
+
* @returns WorldManager实例,如果未初始化则自动创建
|
|
5609
|
+
*/
|
|
5610
|
+
static getWorldManager(): WorldManager;
|
|
5611
|
+
/**
|
|
5612
|
+
* 启用World管理
|
|
5613
|
+
*
|
|
5614
|
+
* 显式启用World功能,用于多房间/多世界架构
|
|
5294
5615
|
*/
|
|
5295
|
-
|
|
5616
|
+
static enableWorldManager(): WorldManager;
|
|
5617
|
+
/**
|
|
5618
|
+
* 确保默认World存在
|
|
5619
|
+
*
|
|
5620
|
+
* 内部方法,用于懒初始化默认World
|
|
5621
|
+
*/
|
|
5622
|
+
private ensureDefaultWorld;
|
|
5296
5623
|
/**
|
|
5297
5624
|
* 场景切换回调
|
|
5298
5625
|
*
|
|
@@ -5784,6 +6111,316 @@ declare class ComponentTypeManager {
|
|
|
5784
6111
|
get registeredTypeCount(): number;
|
|
5785
6112
|
}
|
|
5786
6113
|
|
|
6114
|
+
/**
|
|
6115
|
+
* 稀疏集合实现
|
|
6116
|
+
*
|
|
6117
|
+
* 提供O(1)的插入、删除、查找操作,同时保持数据的紧凑存储。
|
|
6118
|
+
* 使用密集数组存储实际数据,稀疏映射提供快速访问
|
|
6119
|
+
*
|
|
6120
|
+
* @template T 存储的数据类型
|
|
6121
|
+
*
|
|
6122
|
+
* @example
|
|
6123
|
+
* ```typescript
|
|
6124
|
+
* const sparseSet = new SparseSet<Entity>();
|
|
6125
|
+
*
|
|
6126
|
+
* sparseSet.add(entity1);
|
|
6127
|
+
* sparseSet.add(entity2);
|
|
6128
|
+
*
|
|
6129
|
+
* if (sparseSet.has(entity1)) {
|
|
6130
|
+
* sparseSet.remove(entity1);
|
|
6131
|
+
* }
|
|
6132
|
+
*
|
|
6133
|
+
* sparseSet.forEach((entity, index) => {
|
|
6134
|
+
* console.log(`Entity at index ${index}: ${entity.name}`);
|
|
6135
|
+
* });
|
|
6136
|
+
* ```
|
|
6137
|
+
*/
|
|
6138
|
+
declare class SparseSet<T> {
|
|
6139
|
+
/**
|
|
6140
|
+
* 密集存储数组
|
|
6141
|
+
*
|
|
6142
|
+
* 连续存储所有有效数据,确保遍历时的缓存友好性。
|
|
6143
|
+
*/
|
|
6144
|
+
private _dense;
|
|
6145
|
+
/**
|
|
6146
|
+
* 稀疏映射表
|
|
6147
|
+
*
|
|
6148
|
+
* 将数据项映射到密集数组中的索引,提供O(1)的查找性能。
|
|
6149
|
+
*/
|
|
6150
|
+
private _sparse;
|
|
6151
|
+
/**
|
|
6152
|
+
* 添加元素到集合
|
|
6153
|
+
*
|
|
6154
|
+
* @param item 要添加的元素
|
|
6155
|
+
* @returns 是否成功添加(false表示元素已存在)
|
|
6156
|
+
*/
|
|
6157
|
+
add(item: T): boolean;
|
|
6158
|
+
/**
|
|
6159
|
+
* 从集合中移除元素
|
|
6160
|
+
*
|
|
6161
|
+
* 使用swap-and-pop技术保持数组紧凑性:
|
|
6162
|
+
* 1. 将要删除的元素与最后一个元素交换
|
|
6163
|
+
* 2. 删除最后一个元素
|
|
6164
|
+
* 3. 更新映射表
|
|
6165
|
+
*
|
|
6166
|
+
* @param item 要移除的元素
|
|
6167
|
+
* @returns 是否成功移除(false表示元素不存在)
|
|
6168
|
+
*/
|
|
6169
|
+
remove(item: T): boolean;
|
|
6170
|
+
/**
|
|
6171
|
+
* 检查元素是否存在于集合中
|
|
6172
|
+
*
|
|
6173
|
+
* @param item 要检查的元素
|
|
6174
|
+
* @returns 元素是否存在
|
|
6175
|
+
*/
|
|
6176
|
+
has(item: T): boolean;
|
|
6177
|
+
/**
|
|
6178
|
+
* 获取元素在密集数组中的索引
|
|
6179
|
+
*
|
|
6180
|
+
* @param item 要查询的元素
|
|
6181
|
+
* @returns 索引,如果元素不存在则返回undefined
|
|
6182
|
+
*/
|
|
6183
|
+
getIndex(item: T): number | undefined;
|
|
6184
|
+
/**
|
|
6185
|
+
* 根据索引获取元素
|
|
6186
|
+
*
|
|
6187
|
+
* @param index 索引
|
|
6188
|
+
* @returns 元素,如果索引无效则返回undefined
|
|
6189
|
+
*/
|
|
6190
|
+
getByIndex(index: number): T | undefined;
|
|
6191
|
+
/**
|
|
6192
|
+
* 获取集合大小
|
|
6193
|
+
*/
|
|
6194
|
+
get size(): number;
|
|
6195
|
+
/**
|
|
6196
|
+
* 检查集合是否为空
|
|
6197
|
+
*/
|
|
6198
|
+
get isEmpty(): boolean;
|
|
6199
|
+
/**
|
|
6200
|
+
* 遍历集合中的所有元素
|
|
6201
|
+
*
|
|
6202
|
+
* 保证遍历顺序与添加顺序一致(除非中间有删除操作)。
|
|
6203
|
+
* 遍历性能优秀,因为数据在内存中连续存储。
|
|
6204
|
+
*
|
|
6205
|
+
* @param callback 遍历回调函数
|
|
6206
|
+
*/
|
|
6207
|
+
forEach(callback: (item: T, index: number) => void): void;
|
|
6208
|
+
/**
|
|
6209
|
+
* 映射集合中的所有元素
|
|
6210
|
+
*
|
|
6211
|
+
* @param callback 映射回调函数
|
|
6212
|
+
* @returns 映射后的新数组
|
|
6213
|
+
*/
|
|
6214
|
+
map<U>(callback: (item: T, index: number) => U): U[];
|
|
6215
|
+
/**
|
|
6216
|
+
* 过滤集合中的元素
|
|
6217
|
+
*
|
|
6218
|
+
* @param predicate 过滤条件
|
|
6219
|
+
* @returns 满足条件的元素数组
|
|
6220
|
+
*/
|
|
6221
|
+
filter(predicate: (item: T, index: number) => boolean): T[];
|
|
6222
|
+
/**
|
|
6223
|
+
* 查找第一个满足条件的元素
|
|
6224
|
+
*
|
|
6225
|
+
* @param predicate 查找条件
|
|
6226
|
+
* @returns 找到的元素,如果没有则返回undefined
|
|
6227
|
+
*/
|
|
6228
|
+
find(predicate: (item: T, index: number) => boolean): T | undefined;
|
|
6229
|
+
/**
|
|
6230
|
+
* 检查是否存在满足条件的元素
|
|
6231
|
+
*
|
|
6232
|
+
* @param predicate 检查条件
|
|
6233
|
+
* @returns 是否存在满足条件的元素
|
|
6234
|
+
*/
|
|
6235
|
+
some(predicate: (item: T, index: number) => boolean): boolean;
|
|
6236
|
+
/**
|
|
6237
|
+
* 检查是否所有元素都满足条件
|
|
6238
|
+
*
|
|
6239
|
+
* @param predicate 检查条件
|
|
6240
|
+
* @returns 是否所有元素都满足条件
|
|
6241
|
+
*/
|
|
6242
|
+
every(predicate: (item: T, index: number) => boolean): boolean;
|
|
6243
|
+
/**
|
|
6244
|
+
* 获取密集数组的只读副本
|
|
6245
|
+
*
|
|
6246
|
+
* 返回数组的浅拷贝,确保外部无法直接修改内部数据。
|
|
6247
|
+
*/
|
|
6248
|
+
getDenseArray(): readonly T[];
|
|
6249
|
+
/**
|
|
6250
|
+
* 获取密集数组的直接引用(内部使用)
|
|
6251
|
+
*
|
|
6252
|
+
* 警告:直接修改返回的数组会破坏数据结构的完整性。
|
|
6253
|
+
* 仅在性能关键场景下使用,并确保不会修改数组内容。
|
|
6254
|
+
*/
|
|
6255
|
+
getDenseArrayUnsafe(): readonly T[];
|
|
6256
|
+
/**
|
|
6257
|
+
* 清空集合
|
|
6258
|
+
*/
|
|
6259
|
+
clear(): void;
|
|
6260
|
+
/**
|
|
6261
|
+
* 转换为数组
|
|
6262
|
+
*/
|
|
6263
|
+
toArray(): T[];
|
|
6264
|
+
/**
|
|
6265
|
+
* 转换为Set
|
|
6266
|
+
*/
|
|
6267
|
+
toSet(): Set<T>;
|
|
6268
|
+
/**
|
|
6269
|
+
* 获取内存使用统计信息
|
|
6270
|
+
*/
|
|
6271
|
+
getMemoryStats(): {
|
|
6272
|
+
denseArraySize: number;
|
|
6273
|
+
sparseMapSize: number;
|
|
6274
|
+
totalMemory: number;
|
|
6275
|
+
};
|
|
6276
|
+
/**
|
|
6277
|
+
* 验证数据结构的完整性
|
|
6278
|
+
*
|
|
6279
|
+
* 调试用方法,检查内部数据结构是否一致。
|
|
6280
|
+
*/
|
|
6281
|
+
validate(): boolean;
|
|
6282
|
+
}
|
|
6283
|
+
|
|
6284
|
+
/**
|
|
6285
|
+
* 组件稀疏集合实现
|
|
6286
|
+
*
|
|
6287
|
+
* 结合通用稀疏集合和组件位掩码
|
|
6288
|
+
*
|
|
6289
|
+
* 存储结构:
|
|
6290
|
+
* - 稀疏集合存储实体
|
|
6291
|
+
* - 位掩码数组存储组件信息
|
|
6292
|
+
* - 组件类型映射表
|
|
6293
|
+
*/
|
|
6294
|
+
declare class ComponentSparseSet {
|
|
6295
|
+
/**
|
|
6296
|
+
* 实体稀疏集合
|
|
6297
|
+
*
|
|
6298
|
+
* 存储所有拥有组件的实体,提供O(1)的实体操作。
|
|
6299
|
+
*/
|
|
6300
|
+
private _entities;
|
|
6301
|
+
/**
|
|
6302
|
+
* 组件位掩码数组
|
|
6303
|
+
*
|
|
6304
|
+
* 与实体稀疏集合的密集数组对应,存储每个实体的组件位掩码。
|
|
6305
|
+
* 数组索引与稀疏集合的密集数组索引一一对应。
|
|
6306
|
+
*/
|
|
6307
|
+
private _componentMasks;
|
|
6308
|
+
/**
|
|
6309
|
+
* 组件类型到实体集合的映射
|
|
6310
|
+
*
|
|
6311
|
+
* 维护每个组件类型对应的实体集合,用于快速的单组件查询。
|
|
6312
|
+
*/
|
|
6313
|
+
private _componentToEntities;
|
|
6314
|
+
/**
|
|
6315
|
+
* 实体集合对象池
|
|
6316
|
+
*
|
|
6317
|
+
* 使用core库的Pool系统来管理PoolableEntitySet对象的复用。
|
|
6318
|
+
*/
|
|
6319
|
+
private static _entitySetPool;
|
|
6320
|
+
constructor();
|
|
6321
|
+
/**
|
|
6322
|
+
* 添加实体到组件索引
|
|
6323
|
+
*
|
|
6324
|
+
* 分析实体的组件组成,生成位掩码,并更新所有相关索引。
|
|
6325
|
+
*
|
|
6326
|
+
* @param entity 要添加的实体
|
|
6327
|
+
*/
|
|
6328
|
+
addEntity(entity: Entity): void;
|
|
6329
|
+
/**
|
|
6330
|
+
* 从组件索引中移除实体
|
|
6331
|
+
*
|
|
6332
|
+
* 清理实体相关的所有索引数据,保持数据结构的紧凑性。
|
|
6333
|
+
*
|
|
6334
|
+
* @param entity 要移除的实体
|
|
6335
|
+
*/
|
|
6336
|
+
removeEntity(entity: Entity): void;
|
|
6337
|
+
/**
|
|
6338
|
+
* 查询包含指定组件的所有实体
|
|
6339
|
+
*
|
|
6340
|
+
* @param componentType 组件类型
|
|
6341
|
+
* @returns 包含该组件的实体集合
|
|
6342
|
+
*/
|
|
6343
|
+
queryByComponent(componentType: ComponentType): Set<Entity>;
|
|
6344
|
+
/**
|
|
6345
|
+
* 多组件查询(AND操作)
|
|
6346
|
+
*
|
|
6347
|
+
* 查找同时包含所有指定组件的实体。
|
|
6348
|
+
*
|
|
6349
|
+
* @param componentTypes 组件类型数组
|
|
6350
|
+
* @returns 满足条件的实体集合
|
|
6351
|
+
*/
|
|
6352
|
+
queryMultipleAnd(componentTypes: ComponentType[]): Set<Entity>;
|
|
6353
|
+
/**
|
|
6354
|
+
* 多组件查询(OR操作)
|
|
6355
|
+
*
|
|
6356
|
+
* 查找包含任意一个指定组件的实体。
|
|
6357
|
+
*
|
|
6358
|
+
* @param componentTypes 组件类型数组
|
|
6359
|
+
* @returns 满足条件的实体集合
|
|
6360
|
+
*/
|
|
6361
|
+
queryMultipleOr(componentTypes: ComponentType[]): Set<Entity>;
|
|
6362
|
+
/**
|
|
6363
|
+
* 检查实体是否包含指定组件
|
|
6364
|
+
*
|
|
6365
|
+
* @param entity 实体
|
|
6366
|
+
* @param componentType 组件类型
|
|
6367
|
+
* @returns 是否包含该组件
|
|
6368
|
+
*/
|
|
6369
|
+
hasComponent(entity: Entity, componentType: ComponentType): boolean;
|
|
6370
|
+
/**
|
|
6371
|
+
* 获取实体的组件位掩码
|
|
6372
|
+
*
|
|
6373
|
+
* @param entity 实体
|
|
6374
|
+
* @returns 组件位掩码,如果实体不存在则返回undefined
|
|
6375
|
+
*/
|
|
6376
|
+
getEntityMask(entity: Entity): IBigIntLike | undefined;
|
|
6377
|
+
/**
|
|
6378
|
+
* 获取所有实体
|
|
6379
|
+
*
|
|
6380
|
+
* @returns 所有实体的数组
|
|
6381
|
+
*/
|
|
6382
|
+
getAllEntities(): Entity[];
|
|
6383
|
+
/**
|
|
6384
|
+
* 获取实体数量
|
|
6385
|
+
*/
|
|
6386
|
+
get size(): number;
|
|
6387
|
+
/**
|
|
6388
|
+
* 检查是否为空
|
|
6389
|
+
*/
|
|
6390
|
+
get isEmpty(): boolean;
|
|
6391
|
+
/**
|
|
6392
|
+
* 遍历所有实体
|
|
6393
|
+
*
|
|
6394
|
+
* @param callback 遍历回调函数
|
|
6395
|
+
*/
|
|
6396
|
+
forEach(callback: (entity: Entity, mask: IBigIntLike, index: number) => void): void;
|
|
6397
|
+
/**
|
|
6398
|
+
* 清空所有数据
|
|
6399
|
+
*/
|
|
6400
|
+
clear(): void;
|
|
6401
|
+
/**
|
|
6402
|
+
* 获取内存使用统计
|
|
6403
|
+
*/
|
|
6404
|
+
getMemoryStats(): {
|
|
6405
|
+
entitiesMemory: number;
|
|
6406
|
+
masksMemory: number;
|
|
6407
|
+
mappingsMemory: number;
|
|
6408
|
+
totalMemory: number;
|
|
6409
|
+
};
|
|
6410
|
+
/**
|
|
6411
|
+
* 验证数据结构完整性
|
|
6412
|
+
*/
|
|
6413
|
+
validate(): boolean;
|
|
6414
|
+
/**
|
|
6415
|
+
* 获取实体的组件类型集合
|
|
6416
|
+
*/
|
|
6417
|
+
private getEntityComponentTypes;
|
|
6418
|
+
/**
|
|
6419
|
+
* 更新组件类型到实体的映射
|
|
6420
|
+
*/
|
|
6421
|
+
private updateComponentMappings;
|
|
6422
|
+
}
|
|
6423
|
+
|
|
5787
6424
|
/**
|
|
5788
6425
|
* 存储组件类型名称的Symbol键
|
|
5789
6426
|
*/
|
|
@@ -6227,6 +6864,99 @@ declare class EntityManager {
|
|
|
6227
6864
|
private updateTagIndex;
|
|
6228
6865
|
}
|
|
6229
6866
|
|
|
6867
|
+
/**
|
|
6868
|
+
* 索引统计信息
|
|
6869
|
+
*/
|
|
6870
|
+
interface IndexStats {
|
|
6871
|
+
/** 索引大小 */
|
|
6872
|
+
size: number;
|
|
6873
|
+
/** 内存使用量(字节) */
|
|
6874
|
+
memoryUsage: number;
|
|
6875
|
+
/** 查询次数 */
|
|
6876
|
+
queryCount: number;
|
|
6877
|
+
/** 平均查询时间(毫秒) */
|
|
6878
|
+
avgQueryTime: number;
|
|
6879
|
+
/** 最后更新时间 */
|
|
6880
|
+
lastUpdated: number;
|
|
6881
|
+
}
|
|
6882
|
+
/**
|
|
6883
|
+
* 组件索引接口
|
|
6884
|
+
*/
|
|
6885
|
+
interface IComponentIndex {
|
|
6886
|
+
/** 添加实体到索引 */
|
|
6887
|
+
addEntity(entity: Entity): void;
|
|
6888
|
+
/** 从索引中移除实体 */
|
|
6889
|
+
removeEntity(entity: Entity): void;
|
|
6890
|
+
/** 查询包含指定组件的实体 */
|
|
6891
|
+
query(componentType: ComponentType): Set<Entity>;
|
|
6892
|
+
/** 批量查询多个组件 */
|
|
6893
|
+
queryMultiple(componentTypes: ComponentType[], operation: 'AND' | 'OR'): Set<Entity>;
|
|
6894
|
+
/** 清空索引 */
|
|
6895
|
+
clear(): void;
|
|
6896
|
+
/** 获取索引统计信息 */
|
|
6897
|
+
getStats(): IndexStats;
|
|
6898
|
+
}
|
|
6899
|
+
/**
|
|
6900
|
+
* 通用组件索引实现
|
|
6901
|
+
*
|
|
6902
|
+
* 基于Sparse Set算法:
|
|
6903
|
+
* - O(1)的实体添加、删除、查找
|
|
6904
|
+
* - 高效的位运算查询
|
|
6905
|
+
* - 内存紧凑的存储结构
|
|
6906
|
+
* - 缓存友好的遍历性能
|
|
6907
|
+
*/
|
|
6908
|
+
declare class ComponentIndex implements IComponentIndex {
|
|
6909
|
+
/**
|
|
6910
|
+
* 组件稀疏集合
|
|
6911
|
+
*
|
|
6912
|
+
* 核心存储结构,处理所有实体和组件的索引操作。
|
|
6913
|
+
*/
|
|
6914
|
+
private _sparseSet;
|
|
6915
|
+
private _queryCount;
|
|
6916
|
+
private _totalQueryTime;
|
|
6917
|
+
private _lastUpdated;
|
|
6918
|
+
constructor();
|
|
6919
|
+
addEntity(entity: Entity): void;
|
|
6920
|
+
removeEntity(entity: Entity): void;
|
|
6921
|
+
query(componentType: ComponentType): Set<Entity>;
|
|
6922
|
+
queryMultiple(componentTypes: ComponentType[], operation: 'AND' | 'OR'): Set<Entity>;
|
|
6923
|
+
clear(): void;
|
|
6924
|
+
getStats(): IndexStats;
|
|
6925
|
+
}
|
|
6926
|
+
/**
|
|
6927
|
+
* 组件索引管理器
|
|
6928
|
+
*
|
|
6929
|
+
* 使用统一的组件索引实现,自动优化查询性能。
|
|
6930
|
+
*/
|
|
6931
|
+
declare class ComponentIndexManager {
|
|
6932
|
+
private _index;
|
|
6933
|
+
constructor();
|
|
6934
|
+
/**
|
|
6935
|
+
* 添加实体到索引
|
|
6936
|
+
*/
|
|
6937
|
+
addEntity(entity: Entity): void;
|
|
6938
|
+
/**
|
|
6939
|
+
* 从索引中移除实体
|
|
6940
|
+
*/
|
|
6941
|
+
removeEntity(entity: Entity): void;
|
|
6942
|
+
/**
|
|
6943
|
+
* 查询包含指定组件的实体
|
|
6944
|
+
*/
|
|
6945
|
+
query(componentType: ComponentType): Set<Entity>;
|
|
6946
|
+
/**
|
|
6947
|
+
* 批量查询多个组件
|
|
6948
|
+
*/
|
|
6949
|
+
queryMultiple(componentTypes: ComponentType[], operation: 'AND' | 'OR'): Set<Entity>;
|
|
6950
|
+
/**
|
|
6951
|
+
* 获取索引统计信息
|
|
6952
|
+
*/
|
|
6953
|
+
getStats(): IndexStats;
|
|
6954
|
+
/**
|
|
6955
|
+
* 清空索引
|
|
6956
|
+
*/
|
|
6957
|
+
clear(): void;
|
|
6958
|
+
}
|
|
6959
|
+
|
|
6230
6960
|
/**
|
|
6231
6961
|
* 脏标记类型
|
|
6232
6962
|
*/
|
|
@@ -6582,5 +7312,5 @@ declare class Time {
|
|
|
6582
7312
|
static checkEvery(interval: number, lastTime: number): boolean;
|
|
6583
7313
|
}
|
|
6584
7314
|
|
|
6585
|
-
export { ArchetypeSystem, AsyncEventHandler, BigIntFactory,
|
|
6586
|
-
export type { Archetype, ArchetypeQueryResult, ComponentType$1 as ComponentType, DirtyData, DirtyListener, EventListenerConfig, EventStats, IComponent, IComponentDebugData, IComponentEventData, ICoreConfig, IECSDebugConfig, IECSDebugData, IEntityDebugData, IEntityEventData, IEntityHierarchyNode, IEventBus, IEventData, IEventListenerConfig, IEventStats, ILogger, IPerformanceDebugData, IPerformanceEventData, IPoolable, IScene, ISceneConfig, ISceneDebugData, ISceneEventData, ISceneFactory, ISystemBase, ISystemDebugData, ISystemEventData, ITimer, LoggerConfig, PerformanceData, PerformanceStats, PerformanceThresholds, PerformanceWarning, PoolStats };
|
|
7315
|
+
export { ArchetypeSystem, AsyncEventHandler, BigIntFactory, Bits, COMPONENT_TYPE_NAME, Component, ComponentDataCollector, ComponentIndex, ComponentIndexManager, ComponentPool, ComponentPoolManager, ComponentRegistry, ComponentSparseSet, ComponentStorage, ComponentTypeManager, ConsoleLogger, Core, DebugManager, DirtyFlag, DirtyTrackingSystem, ECSComponent, ECSEventType, ECSFluentAPI, ECSSystem, EVENT_TYPES, Emitter, EnableSoA, Entity, EntityDataCollector, EntityList, EntityManager, EntityProcessorList, EntityQueryBuilder, EntitySystem, EventBus, EventHandler, EventPriority, EventTypeValidator, Float32, Float64, FuncPack, GlobalEventBus, GlobalManager, HighPrecision, IdentifierPool, Int32, IntervalSystem, LogLevel, Logger, LoggerManager, Matcher, NumberExtension, PassiveSystem, PerformanceDataCollector, PerformanceMonitor, PerformanceWarningType, Pool, PoolManager, ProcessingSystem, QuerySystem, SYSTEM_TYPE_NAME, Scene, SceneDataCollector, SerializeMap, SoAStorage, SparseSet, SystemDataCollector, Time, Timer, TimerManager, TypeSafeEventSystem, TypeUtils, WebSocketManager, World, WorldManager, createECSAPI, createLogger, getComponentInstanceTypeName, getComponentTypeName, getSystemInstanceTypeName, getSystemTypeName, setGlobalLogLevel };
|
|
7316
|
+
export type { Archetype, ArchetypeQueryResult, ComponentType$1 as ComponentType, DirtyData, DirtyListener, EventListenerConfig, EventStats, IComponent, IComponentDebugData, IComponentEventData, IComponentIndex, ICoreConfig, IECSDebugConfig, IECSDebugData, IEntityDebugData, IEntityEventData, IEntityHierarchyNode, IEventBus, IEventData, IEventListenerConfig, IEventStats, ILogger, IPerformanceDebugData, IPerformanceEventData, IPoolable, IScene, ISceneConfig, ISceneDebugData, ISceneEventData, ISceneFactory, ISystemBase, ISystemDebugData, ISystemEventData, ITimer, IWorldConfig, IWorldManagerConfig, IndexStats, LoggerConfig, PerformanceData, PerformanceStats, PerformanceThresholds, PerformanceWarning, PoolStats };
|