@esengine/ecs-framework 2.2.10 → 2.2.12

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.2.10
2
+ * @esengine/ecs-framework v2.2.12
3
3
  * TypeScript definitions
4
4
  */
5
5
  /**
@@ -355,8 +355,8 @@ interface IEventListenerConfig {
355
355
  priority?: number;
356
356
  /** 是否异步执行 */
357
357
  async?: boolean;
358
- /** 执行上下文 */
359
- context?: unknown;
358
+ /** 事件处理函数的 this 绑定对象 */
359
+ thisArg?: object;
360
360
  }
361
361
  /**
362
362
  * 事件统计信息接口
@@ -734,7 +734,7 @@ declare abstract class Component implements IComponent {
734
734
  *
735
735
  * 用于为每个组件分配唯一的ID。
736
736
  */
737
- static _idGenerator: number;
737
+ private static idGenerator;
738
738
  /**
739
739
  * 组件唯一标识符
740
740
  *
@@ -1588,222 +1588,18 @@ declare class ComponentStorageManager {
1588
1588
  /**
1589
1589
  * 获取所有存储器的统计信息
1590
1590
  */
1591
- getAllStats(): Map<string, any>;
1591
+ getAllStats(): Map<string, {
1592
+ totalSlots: number;
1593
+ usedSlots: number;
1594
+ freeSlots: number;
1595
+ fragmentation: number;
1596
+ }>;
1592
1597
  /**
1593
1598
  * 清空所有存储器
1594
1599
  */
1595
1600
  clear(): void;
1596
1601
  }
1597
1602
 
1598
- /**
1599
- * 增强的事件总线实现
1600
- * 基于TypeSafeEventSystem,提供类型安全的事件发布订阅机制
1601
- */
1602
- declare class EventBus implements IEventBus {
1603
- private static readonly _logger;
1604
- private eventSystem;
1605
- private eventIdCounter;
1606
- private isDebugMode;
1607
- constructor(debugMode?: boolean);
1608
- /**
1609
- * 发射事件
1610
- * @param eventType 事件类型
1611
- * @param data 事件数据
1612
- * @param enhance 是否增强事件数据(添加timestamp、eventId等),默认false提升性能
1613
- */
1614
- emit<T>(eventType: string, data: T, enhance?: boolean): void;
1615
- /**
1616
- * 异步发射事件
1617
- * @param eventType 事件类型
1618
- * @param data 事件数据
1619
- * @param enhance 是否增强事件数据(添加timestamp、eventId等),默认false提升性能
1620
- */
1621
- emitAsync<T>(eventType: string, data: T, enhance?: boolean): Promise<void>;
1622
- /**
1623
- * 监听事件
1624
- * @param eventType 事件类型
1625
- * @param handler 事件处理器
1626
- * @param config 监听器配置
1627
- * @returns 监听器ID
1628
- */
1629
- on<T>(eventType: string, handler: (data: T) => void, config?: IEventListenerConfig): string;
1630
- /**
1631
- * 监听事件(一次性)
1632
- * @param eventType 事件类型
1633
- * @param handler 事件处理器
1634
- * @param config 监听器配置
1635
- * @returns 监听器ID
1636
- */
1637
- once<T>(eventType: string, handler: (data: T) => void, config?: IEventListenerConfig): string;
1638
- /**
1639
- * 异步监听事件
1640
- * @param eventType 事件类型
1641
- * @param handler 异步事件处理器
1642
- * @param config 监听器配置
1643
- * @returns 监听器ID
1644
- */
1645
- onAsync<T>(eventType: string, handler: (data: T) => Promise<void>, config?: IEventListenerConfig): string;
1646
- /**
1647
- * 移除事件监听器
1648
- * @param eventType 事件类型
1649
- * @param listenerId 监听器ID
1650
- */
1651
- off(eventType: string, listenerId: string): boolean;
1652
- /**
1653
- * 移除指定事件类型的所有监听器
1654
- * @param eventType 事件类型
1655
- */
1656
- offAll(eventType: string): void;
1657
- /**
1658
- * 检查是否有指定事件的监听器
1659
- * @param eventType 事件类型
1660
- */
1661
- hasListeners(eventType: string): boolean;
1662
- /**
1663
- * 获取事件统计信息
1664
- * @param eventType 事件类型(可选)
1665
- */
1666
- getStats(eventType?: string): IEventStats | Map<string, IEventStats>;
1667
- /**
1668
- * 清空所有监听器
1669
- */
1670
- clear(): void;
1671
- /**
1672
- * 启用或禁用事件系统
1673
- * @param enabled 是否启用
1674
- */
1675
- setEnabled(enabled: boolean): void;
1676
- /**
1677
- * 设置调试模式
1678
- * @param debug 是否启用调试
1679
- */
1680
- setDebugMode(debug: boolean): void;
1681
- /**
1682
- * 设置最大监听器数量
1683
- * @param max 最大数量
1684
- */
1685
- setMaxListeners(max: number): void;
1686
- /**
1687
- * 获取监听器数量
1688
- * @param eventType 事件类型
1689
- */
1690
- getListenerCount(eventType: string): number;
1691
- /**
1692
- * 设置事件批处理配置
1693
- * @param eventType 事件类型
1694
- * @param batchSize 批处理大小
1695
- * @param delay 延迟时间(毫秒)
1696
- */
1697
- setBatchConfig(eventType: string, batchSize: number, delay: number): void;
1698
- /**
1699
- * 刷新指定事件的批处理队列
1700
- * @param eventType 事件类型
1701
- */
1702
- flushBatch(eventType: string): void;
1703
- /**
1704
- * 重置事件统计
1705
- * @param eventType 事件类型(可选)
1706
- */
1707
- resetStats(eventType?: string): void;
1708
- /**
1709
- * 发射实体创建事件
1710
- * @param entityData 实体事件数据
1711
- */
1712
- emitEntityCreated(entityData: IEntityEventData): void;
1713
- /**
1714
- * 发射实体销毁事件
1715
- * @param entityData 实体事件数据
1716
- */
1717
- emitEntityDestroyed(entityData: IEntityEventData): void;
1718
- /**
1719
- * 发射组件添加事件
1720
- * @param componentData 组件事件数据
1721
- */
1722
- emitComponentAdded(componentData: IComponentEventData): void;
1723
- /**
1724
- * 发射组件移除事件
1725
- * @param componentData 组件事件数据
1726
- */
1727
- emitComponentRemoved(componentData: IComponentEventData): void;
1728
- /**
1729
- * 发射系统添加事件
1730
- * @param systemData 系统事件数据
1731
- */
1732
- emitSystemAdded(systemData: ISystemEventData): void;
1733
- /**
1734
- * 发射系统移除事件
1735
- * @param systemData 系统事件数据
1736
- */
1737
- emitSystemRemoved(systemData: ISystemEventData): void;
1738
- /**
1739
- * 发射场景变化事件
1740
- * @param sceneData 场景事件数据
1741
- */
1742
- emitSceneChanged(sceneData: ISceneEventData): void;
1743
- /**
1744
- * 发射性能警告事件
1745
- * @param performanceData 性能事件数据
1746
- */
1747
- emitPerformanceWarning(performanceData: IPerformanceEventData): void;
1748
- /**
1749
- * 监听实体创建事件
1750
- * @param handler 事件处理器
1751
- * @param config 监听器配置
1752
- */
1753
- onEntityCreated(handler: (data: IEntityEventData) => void, config?: IEventListenerConfig): string;
1754
- /**
1755
- * 监听组件添加事件
1756
- * @param handler 事件处理器
1757
- * @param config 监听器配置
1758
- */
1759
- onComponentAdded(handler: (data: IComponentEventData) => void, config?: IEventListenerConfig): string;
1760
- /**
1761
- * 监听系统错误事件
1762
- * @param handler 事件处理器
1763
- * @param config 监听器配置
1764
- */
1765
- onSystemError(handler: (data: ISystemEventData) => void, config?: IEventListenerConfig): string;
1766
- /**
1767
- * 监听性能警告事件
1768
- * @param handler 事件处理器
1769
- * @param config 监听器配置
1770
- */
1771
- onPerformanceWarning(handler: (data: IPerformanceEventData) => void, config?: IEventListenerConfig): string;
1772
- /**
1773
- * 验证事件类型(仅在debug模式下执行,提升性能)
1774
- * @param eventType 事件类型
1775
- */
1776
- private validateEventType;
1777
- /**
1778
- * 增强事件数据
1779
- * @param eventType 事件类型
1780
- * @param data 原始数据
1781
- */
1782
- private enhanceEventData;
1783
- /**
1784
- * 转换EventStats为IEventStats
1785
- * @param stats EventStats实例
1786
- */
1787
- private convertEventStats;
1788
- }
1789
- /**
1790
- * 全局事件总线实例
1791
- * 提供全局访问的事件总线
1792
- */
1793
- declare class GlobalEventBus {
1794
- private static instance;
1795
- /**
1796
- * 获取全局事件总线实例
1797
- * @param debugMode 是否启用调试模式
1798
- */
1799
- static getInstance(debugMode?: boolean): EventBus;
1800
- /**
1801
- * 重置全局事件总线实例
1802
- * @param debugMode 是否启用调试模式
1803
- */
1804
- static reset(debugMode?: boolean): EventBus;
1805
- }
1806
-
1807
1603
  /**
1808
1604
  * 高性能实体列表管理器
1809
1605
  * 管理场景中的所有实体,支持快速查找和批量操作
@@ -2129,6 +1925,7 @@ interface IService {
2129
1925
  * 服务类型
2130
1926
  *
2131
1927
  * 支持任意构造函数签名,以便与依赖注入装饰器配合使用
1928
+ * 使用 any[] 以允许任意参数类型的构造函数
2132
1929
  */
2133
1930
  type ServiceType<T extends IService> = new (...args: any[]) => T;
2134
1931
  /**
@@ -2236,7 +2033,7 @@ declare class ServiceContainer {
2236
2033
  * container.registerInstance(Config, config);
2237
2034
  * ```
2238
2035
  */
2239
- registerInstance<T extends IService>(type: new (...args: any[]) => T, instance: T): void;
2036
+ registerInstance<T extends IService>(type: ServiceType<T>, instance: T): void;
2240
2037
  /**
2241
2038
  * 解析服务
2242
2039
  *
@@ -2425,23 +2222,8 @@ interface PerformanceThresholds {
2425
2222
  declare class PerformanceMonitor implements IService {
2426
2223
  private _systemData;
2427
2224
  private _systemStats;
2428
- private _warnings;
2429
2225
  private _isEnabled;
2430
2226
  private _maxRecentSamples;
2431
- private _maxWarnings;
2432
- private _thresholds;
2433
- private _fpsHistory;
2434
- private _lastFrameTime;
2435
- private _frameCount;
2436
- private _fpsUpdateInterval;
2437
- private _lastFpsUpdate;
2438
- private _currentFps;
2439
- private _memoryCheckInterval;
2440
- private _lastMemoryCheck;
2441
- private _memoryHistory;
2442
- private _gcCount;
2443
- private _lastGcCheck;
2444
- private _gcCheckInterval;
2445
2227
  constructor();
2446
2228
  /**
2447
2229
  * 启用性能监控
@@ -2460,7 +2242,7 @@ declare class PerformanceMonitor implements IService {
2460
2242
  * @param systemName 系统名称
2461
2243
  * @returns 开始时间戳
2462
2244
  */
2463
- startMonitoring(systemName: string): number;
2245
+ startMonitoring(_systemName: string): number;
2464
2246
  /**
2465
2247
  * 结束监控并记录性能数据
2466
2248
  * @param systemName 系统名称
@@ -2723,7 +2505,7 @@ declare class EntityProcessorList {
2723
2505
  */
2724
2506
  private sortProcessors;
2725
2507
  /** 获取处理器列表 */
2726
- get processors(): EntitySystem<[]>[];
2508
+ get processors(): EntitySystem[];
2727
2509
  /** 获取处理器数量 */
2728
2510
  get count(): number;
2729
2511
  }
@@ -3448,21 +3230,17 @@ declare class ReactiveQuery {
3448
3230
  * ```
3449
3231
  */
3450
3232
  declare class QuerySystem {
3451
- private _logger;
3452
- private entities;
3453
- private entityIndex;
3233
+ private readonly _logger;
3234
+ private _entities;
3235
+ private _entityIndex;
3454
3236
  private _version;
3455
- private queryCache;
3456
- private cacheMaxSize;
3457
- private cacheTimeout;
3458
- private componentMaskCache;
3459
- private archetypeSystem;
3460
- private queryStats;
3461
- private resultArrayPool;
3462
- private poolMaxSize;
3237
+ private _queryCache;
3238
+ private _cacheMaxSize;
3239
+ private _cacheTimeout;
3240
+ private _componentMaskCache;
3241
+ private _archetypeSystem;
3242
+ private _queryStats;
3463
3243
  constructor();
3464
- private acquireResultArray;
3465
- private releaseResultArray;
3466
3244
  /**
3467
3245
  * 设置实体列表并重建索引
3468
3246
  *
@@ -3550,16 +3328,6 @@ declare class QuerySystem {
3550
3328
  * ```
3551
3329
  */
3552
3330
  queryAll(...componentTypes: ComponentType[]): QueryResult;
3553
- /**
3554
- * 多组件查询算法
3555
- *
3556
- * 针对多组件查询场景的高效算法实现。
3557
- * 通过选择最小的组件集合作为起点,减少需要检查的实体数量。
3558
- *
3559
- * @param componentTypes 组件类型列表
3560
- * @returns 匹配的实体列表
3561
- */
3562
- private queryMultipleComponents;
3563
3331
  /**
3564
3332
  * 查询包含任意指定组件的实体
3565
3333
  *
@@ -3901,11 +3669,11 @@ declare class QueryBuilder {
3901
3669
  /**
3902
3670
  * 事件处理器函数类型
3903
3671
  */
3904
- type EventHandler<T = any> = (event: T) => void;
3672
+ type EventHandler<T> = (event: T) => void;
3905
3673
  /**
3906
3674
  * 异步事件处理器函数类型
3907
3675
  */
3908
- type AsyncEventHandler<T = any> = (event: T) => Promise<void>;
3676
+ type AsyncEventHandler<T> = (event: T) => Promise<void>;
3909
3677
  /**
3910
3678
  * 事件监听器配置
3911
3679
  */
@@ -3916,8 +3684,8 @@ interface EventListenerConfig {
3916
3684
  priority?: number;
3917
3685
  /** 是否异步执行 */
3918
3686
  async?: boolean;
3919
- /** 执行上下文 */
3920
- context?: any;
3687
+ /** 事件处理函数的 this 绑定对象 */
3688
+ thisArg?: object;
3921
3689
  }
3922
3690
  /**
3923
3691
  * 事件统计信息
@@ -3964,11 +3732,11 @@ declare class TypeSafeEventSystem {
3964
3732
  /**
3965
3733
  * 添加事件监听器
3966
3734
  * @param eventType 事件类型
3967
- * @param handler 事件处理器
3735
+ * @param handler 事件处理器(同步或异步,根据 config.async 决定)
3968
3736
  * @param config 监听器配置
3969
3737
  * @returns 监听器ID(用于移除)
3970
3738
  */
3971
- on<T>(eventType: string, handler: EventHandler<T>, config?: EventListenerConfig): string;
3739
+ on<T>(eventType: string, handler: EventHandler<T> | AsyncEventHandler<T>, config?: EventListenerConfig): string;
3972
3740
  /**
3973
3741
  * 添加一次性事件监听器
3974
3742
  * @param eventType 事件类型
@@ -4158,10 +3926,6 @@ declare class ReferenceTracker {
4158
3926
  * Entity ID -> 引用该Entity的所有组件记录
4159
3927
  */
4160
3928
  private _references;
4161
- /**
4162
- * 当前Scene的引用
4163
- */
4164
- private _scene;
4165
3929
  /**
4166
3930
  * 注册Entity引用
4167
3931
  *
@@ -4207,12 +3971,6 @@ declare class ReferenceTracker {
4207
3971
  * 遍历所有记录,移除已被GC回收的Component引用。
4208
3972
  */
4209
3973
  cleanup(): void;
4210
- /**
4211
- * 设置Scene引用
4212
- *
4213
- * @param scene Scene实例
4214
- */
4215
- setScene(scene: IScene): void;
4216
3974
  /**
4217
3975
  * 注册Entity到Scene的映射
4218
3976
  *
@@ -4454,6 +4212,21 @@ declare function queryForAll<T extends readonly ComponentConstructor[]>(...types
4454
4212
  * 负责组件的序列化和反序列化操作
4455
4213
  */
4456
4214
 
4215
+ /**
4216
+ * 可序列化的值类型
4217
+ */
4218
+ type SerializableValue = string | number | boolean | null | undefined | SerializableValue[] | {
4219
+ [key: string]: SerializableValue;
4220
+ } | {
4221
+ __type: 'Date';
4222
+ value: string;
4223
+ } | {
4224
+ __type: 'Map';
4225
+ value: Array<[SerializableValue, SerializableValue]>;
4226
+ } | {
4227
+ __type: 'Set';
4228
+ value: SerializableValue[];
4229
+ };
4457
4230
  /**
4458
4231
  * 序列化后的组件数据
4459
4232
  */
@@ -4469,7 +4242,7 @@ interface SerializedComponent {
4469
4242
  /**
4470
4243
  * 组件数据
4471
4244
  */
4472
- data: Record<string, any>;
4245
+ data: Record<string, SerializableValue>;
4473
4246
  }
4474
4247
  /**
4475
4248
  * 组件序列化器类
@@ -4975,8 +4748,8 @@ interface IncrementalSerializationOptions {
4975
4748
  compressSnapshot?: boolean;
4976
4749
  /**
4977
4750
  * 序列化格式
4978
- * - 'json': JSON格式(可读性好,方便调试)
4979
- * - 'binary': MessagePack二进制格式(体积小,性能高)
4751
+ * - 'json': JSON格式
4752
+ * - 'binary': 二进制格式
4980
4753
  * 默认 'json'
4981
4754
  */
4982
4755
  format?: IncrementalSerializationFormat;
@@ -5175,14 +4948,50 @@ declare class Scene implements IScene {
5175
4948
  * 场景是否已开始运行
5176
4949
  */
5177
4950
  private _didSceneBegin;
4951
+ /**
4952
+ * 系统列表缓存
4953
+ */
4954
+ private _cachedSystems;
4955
+ /**
4956
+ * 系统顺序脏标记
4957
+ *
4958
+ * 当系统增删或 updateOrder 改变时标记为 true,下次访问 systems 时重新构建缓存
4959
+ */
4960
+ private _systemsOrderDirty;
4961
+ /**
4962
+ * 系统错误计数器
4963
+ *
4964
+ * 跟踪每个系统的错误次数,用于自动禁用频繁出错的系统
4965
+ */
4966
+ private _systemErrorCount;
4967
+ /**
4968
+ * 最大允许错误次数
4969
+ *
4970
+ * 系统错误次数超过此阈值后将被自动禁用
4971
+ */
4972
+ private _maxErrorCount;
5178
4973
  /**
5179
4974
  * 获取场景中所有已注册的EntitySystem
5180
4975
  *
5181
- * 按updateOrder排序。
4976
+ * 按updateOrder排序。使用缓存机制,仅在系统变化时重新排序。
5182
4977
  *
5183
4978
  * @returns 系统列表
5184
4979
  */
5185
4980
  get systems(): EntitySystem[];
4981
+ /**
4982
+ * 重新构建系统缓存
4983
+ *
4984
+ * 从服务容器中提取所有EntitySystem并排序
4985
+ */
4986
+ private _rebuildSystemsCache;
4987
+ /**
4988
+ * 从服务列表中过滤出EntitySystem实例
4989
+ */
4990
+ private _filterEntitySystems;
4991
+ /**
4992
+ * 按updateOrder排序系统
4993
+ */
4994
+ private _sortSystemsByUpdateOrder;
5186
4995
  /**
5187
4996
  * 通过类型获取System实例
5188
4997
  *
@@ -5198,6 +5007,12 @@ declare class Scene implements IScene {
5198
5007
  * ```
5199
5008
  */
5200
5009
  getSystem<T extends EntitySystem>(systemType: ServiceType<T>): T | null;
5010
+ /**
5011
+ * 标记系统顺序为脏
5012
+ *
5013
+ * 当系统列表或顺序发生变化时调用,使缓存失效
5014
+ */
5015
+ markSystemsOrderDirty(): void;
5201
5016
  /**
5202
5017
  * 获取场景的服务容器
5203
5018
  *
@@ -5257,6 +5072,16 @@ declare class Scene implements IScene {
5257
5072
  * 更新场景
5258
5073
  */
5259
5074
  update(): void;
5075
+ /**
5076
+ * 处理系统执行错误
5077
+ *
5078
+ * 记录错误信息并跟踪错误次数。当系统错误次数超过阈值时自动禁用该系统。
5079
+ *
5080
+ * @param system 出错的系统
5081
+ * @param phase 错误发生的阶段(update 或 lateUpdate)
5082
+ * @param error 错误对象
5083
+ */
5084
+ private _handleSystemError;
5260
5085
  /**
5261
5086
  * 将实体添加到此场景,并返回它
5262
5087
  * @param name 实体名称
@@ -5305,12 +5130,16 @@ declare class Scene implements IScene {
5305
5130
  findEntitiesByTag(tag: number): Entity[];
5306
5131
  /**
5307
5132
  * 根据名称查找实体(别名方法)
5133
+ *
5308
5134
  * @param name 实体名称
5135
+ * @deprecated 请使用 findEntity() 代替此方法
5309
5136
  */
5310
5137
  getEntityByName(name: string): Entity | null;
5311
5138
  /**
5312
5139
  * 根据标签查找实体(别名方法)
5140
+ *
5313
5141
  * @param tag 实体标签
5142
+ * @deprecated 请使用 findEntitiesByTag() 代替此方法
5314
5143
  */
5315
5144
  getEntitiesByTag(tag: number): Entity[];
5316
5145
  /**
@@ -5328,7 +5157,7 @@ declare class Scene implements IScene {
5328
5157
  * }
5329
5158
  * ```
5330
5159
  */
5331
- queryAll(...componentTypes: any[]): {
5160
+ queryAll(...componentTypes: ComponentType[]): {
5332
5161
  entities: readonly Entity[];
5333
5162
  };
5334
5163
  /**
@@ -5337,7 +5166,7 @@ declare class Scene implements IScene {
5337
5166
  * @param componentTypes - 组件类型数组
5338
5167
  * @returns 查询结果
5339
5168
  */
5340
- queryAny(...componentTypes: any[]): {
5169
+ queryAny(...componentTypes: ComponentType[]): {
5341
5170
  entities: readonly Entity[];
5342
5171
  };
5343
5172
  /**
@@ -5346,7 +5175,7 @@ declare class Scene implements IScene {
5346
5175
  * @param componentTypes - 组件类型数组
5347
5176
  * @returns 查询结果
5348
5177
  */
5349
- queryNone(...componentTypes: any[]): {
5178
+ queryNone(...componentTypes: ComponentType[]): {
5350
5179
  entities: readonly Entity[];
5351
5180
  };
5352
5181
  /**
@@ -5438,7 +5267,7 @@ declare class Scene implements IScene {
5438
5267
  * 添加系统到场景(addEntityProcessor的别名)
5439
5268
  * @param system 系统
5440
5269
  */
5441
- addSystem(system: EntitySystem): EntitySystem<[]>;
5270
+ addSystem(system: EntitySystem): EntitySystem;
5442
5271
  /**
5443
5272
  * 从场景中删除EntitySystem处理器
5444
5273
  * @param processor 要删除的处理器
@@ -5474,7 +5303,12 @@ declare class Scene implements IScene {
5474
5303
  getStats(): {
5475
5304
  entityCount: number;
5476
5305
  processorCount: number;
5477
- componentStorageStats: Map<string, any>;
5306
+ componentStorageStats: Map<string, {
5307
+ totalSlots: number;
5308
+ usedSlots: number;
5309
+ freeSlots: number;
5310
+ fragmentation: number;
5311
+ }>;
5478
5312
  };
5479
5313
  /**
5480
5314
  * 获取场景的调试信息
@@ -5495,7 +5329,12 @@ declare class Scene implements IScene {
5495
5329
  updateOrder: number;
5496
5330
  entityCount: number;
5497
5331
  }>;
5498
- componentStats: Map<string, any>;
5332
+ componentStats: Map<string, {
5333
+ totalSlots: number;
5334
+ usedSlots: number;
5335
+ freeSlots: number;
5336
+ fragmentation: number;
5337
+ }>;
5499
5338
  };
5500
5339
  /**
5501
5340
  * 序列化场景
@@ -5610,7 +5449,7 @@ declare class Scene implements IScene {
5610
5449
  * scene.applyIncremental(binaryData);
5611
5450
  * ```
5612
5451
  */
5613
- applyIncremental(incremental: IncrementalSnapshot | string | Uint8Array, componentRegistry?: Map<string, any>): void;
5452
+ applyIncremental(incremental: IncrementalSnapshot | string | Uint8Array, componentRegistry?: Map<string, ComponentType>): void;
5614
5453
  /**
5615
5454
  * 更新增量快照基准
5616
5455
  *
@@ -5691,7 +5530,7 @@ declare class Scene implements IScene {
5691
5530
  * }
5692
5531
  * ```
5693
5532
  */
5694
- declare abstract class EntitySystem<TComponents extends readonly ComponentConstructor[] = []> implements ISystemBase, IService {
5533
+ declare abstract class EntitySystem implements ISystemBase, IService {
5695
5534
  private _updateOrder;
5696
5535
  private _enabled;
5697
5536
  private _performanceMonitor;
@@ -5706,7 +5545,6 @@ declare abstract class EntitySystem<TComponents extends readonly ComponentConstr
5706
5545
  */
5707
5546
  private _entityIdMap;
5708
5547
  private _entityIdMapVersion;
5709
- private _entityIdMapSize;
5710
5548
  /**
5711
5549
  * 统一的实体缓存管理器
5712
5550
  */
@@ -5784,6 +5622,14 @@ declare abstract class EntitySystem<TComponents extends readonly ComponentConstr
5784
5622
  private queryEntities;
5785
5623
  /**
5786
5624
  * 检查是否为单一条件查询
5625
+ *
5626
+ * 使用位运算优化多条件检测。将每种查询条件映射到不同的位:
5627
+ * - all: 第0位 (1)
5628
+ * - any: 第1位 (2)
5629
+ * - none: 第2位 (4)
5630
+ * - tag: 第3位 (8)
5631
+ * - name: 第4位 (16)
5632
+ * - component: 第5位 (32)
5787
5633
  */
5788
5634
  private isSingleCondition;
5789
5635
  /**
@@ -5845,7 +5691,7 @@ declare abstract class EntitySystem<TComponents extends readonly ComponentConstr
5845
5691
  *
5846
5692
  * @param entities 要处理的实体列表
5847
5693
  */
5848
- protected process(entities: readonly Entity[]): void;
5694
+ protected process(_entities: readonly Entity[]): void;
5849
5695
  /**
5850
5696
  * 后期处理实体列表
5851
5697
  *
@@ -5902,7 +5748,7 @@ declare abstract class EntitySystem<TComponents extends readonly ComponentConstr
5902
5748
  *
5903
5749
  * @param entity 被添加的实体
5904
5750
  */
5905
- protected onAdded(entity: Entity): void;
5751
+ protected onAdded(_entity: Entity): void;
5906
5752
  /**
5907
5753
  * 当实体从系统中移除时调用
5908
5754
  *
@@ -5910,7 +5756,7 @@ declare abstract class EntitySystem<TComponents extends readonly ComponentConstr
5910
5756
  *
5911
5757
  * @param entity 被移除的实体
5912
5758
  */
5913
- protected onRemoved(entity: Entity): void;
5759
+ protected onRemoved(_entity: Entity): void;
5914
5760
  /**
5915
5761
  * 释放系统资源
5916
5762
  *
@@ -5934,15 +5780,16 @@ declare abstract class EntitySystem<TComponents extends readonly ComponentConstr
5934
5780
  * @param eventType 事件类型
5935
5781
  * @param handler 事件处理函数
5936
5782
  * @param config 监听器配置
5783
+ * @returns 监听器引用ID,可用于手动移除监听器
5937
5784
  */
5938
- protected addEventListener<T = any>(eventType: string, handler: EventHandler<T>, config?: EventListenerConfig): void;
5785
+ protected addEventListener<T>(eventType: string, handler: EventHandler<T>, config?: EventListenerConfig): string | null;
5939
5786
  /**
5940
5787
  * 移除特定的事件监听器
5941
5788
  *
5942
5789
  * @param eventType 事件类型
5943
- * @param handler 事件处理函数
5790
+ * @param listenerRef 监听器引用ID(由 addEventListener 返回)
5944
5791
  */
5945
- protected removeEventListener<T = any>(eventType: string, handler: EventHandler<T>): void;
5792
+ protected removeEventListener(eventType: string, listenerRef: string): void;
5946
5793
  /**
5947
5794
  * 清理手动添加的事件监听器
5948
5795
  */
@@ -6433,17 +6280,6 @@ declare class Entity {
6433
6280
  * 实体比较器实例
6434
6281
  */
6435
6282
  static entityComparer: EntityComparer;
6436
- /**
6437
- * 全局事件总线实例
6438
- * 用于发射组件相关事件
6439
- */
6440
- static eventBus: EventBus | null;
6441
- /**
6442
- * 通知Scene中的QuerySystem实体组件发生变动
6443
- *
6444
- * @param entity 发生组件变动的实体
6445
- */
6446
- private static notifyQuerySystems;
6447
6283
  /**
6448
6284
  * 实体名称
6449
6285
  */
@@ -6459,7 +6295,7 @@ declare class Entity {
6459
6295
  /**
6460
6296
  * 销毁状态标志
6461
6297
  */
6462
- _isDestroyed: boolean;
6298
+ private _isDestroyed;
6463
6299
  /**
6464
6300
  * 父实体引用
6465
6301
  */
@@ -6504,6 +6340,15 @@ declare class Entity {
6504
6340
  * @returns 如果实体已被销毁则返回true
6505
6341
  */
6506
6342
  get isDestroyed(): boolean;
6343
+ /**
6344
+ * 设置销毁状态(内部使用)
6345
+ *
6346
+ * 此方法供Scene和批量操作使用,以提高性能。
6347
+ * 不应在普通业务逻辑中调用,应使用destroy()方法。
6348
+ *
6349
+ * @internal
6350
+ */
6351
+ setDestroyedState(destroyed: boolean): void;
6507
6352
  /**
6508
6353
  * 获取组件数组(懒加载)
6509
6354
  * @returns 只读的组件数组
@@ -6607,7 +6452,7 @@ declare class Entity {
6607
6452
  * const health = entity.createComponent(Health, 100);
6608
6453
  * ```
6609
6454
  */
6610
- createComponent<T extends Component>(componentType: ComponentType<T>, ...args: any[]): T;
6455
+ createComponent<T extends Component>(componentType: ComponentType<T>, ...args: ConstructorParameters<ComponentType<T>>): T;
6611
6456
  /**
6612
6457
  * 内部添加组件方法(不进行重复检查,用于初始化)
6613
6458
  *
@@ -6615,6 +6460,10 @@ declare class Entity {
6615
6460
  * @returns 添加的组件实例
6616
6461
  */
6617
6462
  private addComponentInternal;
6463
+ /**
6464
+ * 通知Scene中的QuerySystem实体组件发生变动
6465
+ */
6466
+ private notifyQuerySystems;
6618
6467
  /**
6619
6468
  * 添加组件到实体
6620
6469
  *
@@ -6676,7 +6525,7 @@ declare class Entity {
6676
6525
  * position.x = 100;
6677
6526
  * ```
6678
6527
  */
6679
- getOrCreateComponent<T extends Component>(type: ComponentType<T>, ...args: any[]): T;
6528
+ getOrCreateComponent<T extends Component>(type: ComponentType<T>, ...args: ConstructorParameters<ComponentType<T>>): T;
6680
6529
  /**
6681
6530
  * 移除指定的组件
6682
6531
  *
@@ -6993,7 +6842,7 @@ declare abstract class ProcessingSystem extends EntitySystem {
6993
6842
  * 处理实体,每帧调用processSystem方法进行处理
6994
6843
  * @param entities 实体数组,未被使用
6995
6844
  */
6996
- protected process(entities: Entity[]): void;
6845
+ protected process(_entities: Entity[]): void;
6997
6846
  /**
6998
6847
  * 处理实体的具体方法,由子类实现
6999
6848
  */
@@ -7011,7 +6860,7 @@ declare abstract class PassiveSystem extends EntitySystem {
7011
6860
  * 不进行任何处理
7012
6861
  * @param entities 实体数组,未被使用
7013
6862
  */
7014
- protected process(entities: Entity[]): void;
6863
+ protected process(_entities: Entity[]): void;
7015
6864
  }
7016
6865
 
7017
6866
  /**
@@ -8505,6 +8354,215 @@ declare class WorldManager implements IService {
8505
8354
  get config(): IWorldManagerConfig;
8506
8355
  }
8507
8356
 
8357
+ /**
8358
+ * 增强的事件总线实现
8359
+ * 基于TypeSafeEventSystem,提供类型安全的事件发布订阅机制
8360
+ */
8361
+ declare class EventBus implements IEventBus {
8362
+ private static readonly _logger;
8363
+ private eventSystem;
8364
+ private eventIdCounter;
8365
+ private isDebugMode;
8366
+ constructor(debugMode?: boolean);
8367
+ /**
8368
+ * 发射事件
8369
+ * @param eventType 事件类型
8370
+ * @param data 事件数据
8371
+ * @param enhance 是否增强事件数据(添加timestamp、eventId等),默认false提升性能
8372
+ */
8373
+ emit<T>(eventType: string, data: T, enhance?: boolean): void;
8374
+ /**
8375
+ * 异步发射事件
8376
+ * @param eventType 事件类型
8377
+ * @param data 事件数据
8378
+ * @param enhance 是否增强事件数据(添加timestamp、eventId等),默认false提升性能
8379
+ */
8380
+ emitAsync<T>(eventType: string, data: T, enhance?: boolean): Promise<void>;
8381
+ /**
8382
+ * 监听事件
8383
+ * @param eventType 事件类型
8384
+ * @param handler 事件处理器
8385
+ * @param config 监听器配置
8386
+ * @returns 监听器ID
8387
+ */
8388
+ on<T>(eventType: string, handler: (data: T) => void, config?: IEventListenerConfig): string;
8389
+ /**
8390
+ * 监听事件(一次性)
8391
+ * @param eventType 事件类型
8392
+ * @param handler 事件处理器
8393
+ * @param config 监听器配置
8394
+ * @returns 监听器ID
8395
+ */
8396
+ once<T>(eventType: string, handler: (data: T) => void, config?: IEventListenerConfig): string;
8397
+ /**
8398
+ * 异步监听事件
8399
+ * @param eventType 事件类型
8400
+ * @param handler 异步事件处理器
8401
+ * @param config 监听器配置
8402
+ * @returns 监听器ID
8403
+ */
8404
+ onAsync<T>(eventType: string, handler: (data: T) => Promise<void>, config?: IEventListenerConfig): string;
8405
+ /**
8406
+ * 移除事件监听器
8407
+ * @param eventType 事件类型
8408
+ * @param listenerId 监听器ID
8409
+ */
8410
+ off(eventType: string, listenerId: string): boolean;
8411
+ /**
8412
+ * 移除指定事件类型的所有监听器
8413
+ * @param eventType 事件类型
8414
+ */
8415
+ offAll(eventType: string): void;
8416
+ /**
8417
+ * 检查是否有指定事件的监听器
8418
+ * @param eventType 事件类型
8419
+ */
8420
+ hasListeners(eventType: string): boolean;
8421
+ /**
8422
+ * 获取事件统计信息
8423
+ * @param eventType 事件类型(可选)
8424
+ */
8425
+ getStats(eventType?: string): IEventStats | Map<string, IEventStats>;
8426
+ /**
8427
+ * 清空所有监听器
8428
+ */
8429
+ clear(): void;
8430
+ /**
8431
+ * 启用或禁用事件系统
8432
+ * @param enabled 是否启用
8433
+ */
8434
+ setEnabled(enabled: boolean): void;
8435
+ /**
8436
+ * 设置调试模式
8437
+ * @param debug 是否启用调试
8438
+ */
8439
+ setDebugMode(debug: boolean): void;
8440
+ /**
8441
+ * 设置最大监听器数量
8442
+ * @param max 最大数量
8443
+ */
8444
+ setMaxListeners(max: number): void;
8445
+ /**
8446
+ * 获取监听器数量
8447
+ * @param eventType 事件类型
8448
+ */
8449
+ getListenerCount(eventType: string): number;
8450
+ /**
8451
+ * 设置事件批处理配置
8452
+ * @param eventType 事件类型
8453
+ * @param batchSize 批处理大小
8454
+ * @param delay 延迟时间(毫秒)
8455
+ */
8456
+ setBatchConfig(eventType: string, batchSize: number, delay: number): void;
8457
+ /**
8458
+ * 刷新指定事件的批处理队列
8459
+ * @param eventType 事件类型
8460
+ */
8461
+ flushBatch(eventType: string): void;
8462
+ /**
8463
+ * 重置事件统计
8464
+ * @param eventType 事件类型(可选)
8465
+ */
8466
+ resetStats(eventType?: string): void;
8467
+ /**
8468
+ * 发射实体创建事件
8469
+ * @param entityData 实体事件数据
8470
+ */
8471
+ emitEntityCreated(entityData: IEntityEventData): void;
8472
+ /**
8473
+ * 发射实体销毁事件
8474
+ * @param entityData 实体事件数据
8475
+ */
8476
+ emitEntityDestroyed(entityData: IEntityEventData): void;
8477
+ /**
8478
+ * 发射组件添加事件
8479
+ * @param componentData 组件事件数据
8480
+ */
8481
+ emitComponentAdded(componentData: IComponentEventData): void;
8482
+ /**
8483
+ * 发射组件移除事件
8484
+ * @param componentData 组件事件数据
8485
+ */
8486
+ emitComponentRemoved(componentData: IComponentEventData): void;
8487
+ /**
8488
+ * 发射系统添加事件
8489
+ * @param systemData 系统事件数据
8490
+ */
8491
+ emitSystemAdded(systemData: ISystemEventData): void;
8492
+ /**
8493
+ * 发射系统移除事件
8494
+ * @param systemData 系统事件数据
8495
+ */
8496
+ emitSystemRemoved(systemData: ISystemEventData): void;
8497
+ /**
8498
+ * 发射场景变化事件
8499
+ * @param sceneData 场景事件数据
8500
+ */
8501
+ emitSceneChanged(sceneData: ISceneEventData): void;
8502
+ /**
8503
+ * 发射性能警告事件
8504
+ * @param performanceData 性能事件数据
8505
+ */
8506
+ emitPerformanceWarning(performanceData: IPerformanceEventData): void;
8507
+ /**
8508
+ * 监听实体创建事件
8509
+ * @param handler 事件处理器
8510
+ * @param config 监听器配置
8511
+ */
8512
+ onEntityCreated(handler: (data: IEntityEventData) => void, config?: IEventListenerConfig): string;
8513
+ /**
8514
+ * 监听组件添加事件
8515
+ * @param handler 事件处理器
8516
+ * @param config 监听器配置
8517
+ */
8518
+ onComponentAdded(handler: (data: IComponentEventData) => void, config?: IEventListenerConfig): string;
8519
+ /**
8520
+ * 监听系统错误事件
8521
+ * @param handler 事件处理器
8522
+ * @param config 监听器配置
8523
+ */
8524
+ onSystemError(handler: (data: ISystemEventData) => void, config?: IEventListenerConfig): string;
8525
+ /**
8526
+ * 监听性能警告事件
8527
+ * @param handler 事件处理器
8528
+ * @param config 监听器配置
8529
+ */
8530
+ onPerformanceWarning(handler: (data: IPerformanceEventData) => void, config?: IEventListenerConfig): string;
8531
+ /**
8532
+ * 验证事件类型(仅在debug模式下执行,提升性能)
8533
+ * @param eventType 事件类型
8534
+ */
8535
+ private validateEventType;
8536
+ /**
8537
+ * 增强事件数据
8538
+ * @param eventType 事件类型
8539
+ * @param data 原始数据
8540
+ */
8541
+ private enhanceEventData;
8542
+ /**
8543
+ * 转换EventStats为IEventStats
8544
+ * @param stats EventStats实例
8545
+ */
8546
+ private convertEventStats;
8547
+ }
8548
+ /**
8549
+ * 全局事件总线实例
8550
+ * 提供全局访问的事件总线
8551
+ */
8552
+ declare class GlobalEventBus {
8553
+ private static instance;
8554
+ /**
8555
+ * 获取全局事件总线实例
8556
+ * @param debugMode 是否启用调试模式
8557
+ */
8558
+ static getInstance(debugMode?: boolean): EventBus;
8559
+ /**
8560
+ * 重置全局事件总线实例
8561
+ * @param debugMode 是否启用调试模式
8562
+ */
8563
+ static reset(debugMode?: boolean): EventBus;
8564
+ }
8565
+
8508
8566
  /**
8509
8567
  * 组件对象池,用于复用组件实例以减少内存分配
8510
8568
  */
@@ -8514,9 +8572,8 @@ declare class ComponentPool<T extends Component> {
8514
8572
  private resetFn?;
8515
8573
  private maxSize;
8516
8574
  private minSize;
8517
- private growthFactor;
8518
8575
  private stats;
8519
- constructor(createFn: () => T, resetFn?: (component: T) => void, maxSize?: number, minSize?: number, growthFactor?: number);
8576
+ constructor(createFn: () => T, resetFn?: (component: T) => void, maxSize?: number, minSize?: number);
8520
8577
  /**
8521
8578
  * 获取一个组件实例
8522
8579
  */
@@ -8559,6 +8616,14 @@ declare class ComponentPool<T extends Component> {
8559
8616
  utilizationRate: number;
8560
8617
  };
8561
8618
  }
8619
+ /**
8620
+ * 组件使用追踪
8621
+ */
8622
+ interface ComponentUsageTracker {
8623
+ createCount: number;
8624
+ releaseCount: number;
8625
+ lastAccessTime: number;
8626
+ }
8562
8627
  /**
8563
8628
  * 全局组件池管理器
8564
8629
  */
@@ -8609,7 +8674,11 @@ declare class ComponentPoolManager {
8609
8674
  /**
8610
8675
  * 获取全局统计信息
8611
8676
  */
8612
- getGlobalStats(): any[];
8677
+ getGlobalStats(): Array<{
8678
+ componentName: string;
8679
+ poolStats: ReturnType<ComponentPool<Component>['getStats']>;
8680
+ usage: ComponentUsageTracker | undefined;
8681
+ }>;
8613
8682
  /**
8614
8683
  * 获取池统计信息
8615
8684
  */
@@ -8818,7 +8887,7 @@ declare class VersionMigrationManager {
8818
8887
  * );
8819
8888
  * ```
8820
8889
  */
8821
- static registerComponentMigration(componentType: string, fromVersion: number, toVersion: number, migration: ComponentMigrationFunction): void;
8890
+ static registerComponentMigration(componentType: string, fromVersion: number, _toVersion: number, migration: ComponentMigrationFunction): void;
8822
8891
  /**
8823
8892
  * 注册场景迁移函数
8824
8893
  *
@@ -8839,7 +8908,7 @@ declare class VersionMigrationManager {
8839
8908
  * );
8840
8909
  * ```
8841
8910
  */
8842
- static registerSceneMigration(fromVersion: number, toVersion: number, migration: SceneMigrationFunction): void;
8911
+ static registerSceneMigration(fromVersion: number, _toVersion: number, migration: SceneMigrationFunction): void;
8843
8912
  /**
8844
8913
  * 迁移组件数据
8845
8914
  *
@@ -9264,9 +9333,7 @@ declare class EntityDataCollector {
9264
9333
  private collectArchetypeDataWithMemory;
9265
9334
  private extractArchetypeStatistics;
9266
9335
  private extractArchetypeStatisticsWithMemory;
9267
- private getArchetypeDistribution;
9268
9336
  private getArchetypeDistributionWithMemory;
9269
- private getTopEntitiesByComponents;
9270
9337
  private getTopEntitiesByComponentsWithMemory;
9271
9338
  private getEmptyEntityDebugData;
9272
9339
  private calculateFallbackEntityStats;
@@ -9351,7 +9418,6 @@ declare class SystemDataCollector {
9351
9418
  declare class PerformanceDataCollector {
9352
9419
  private frameTimeHistory;
9353
9420
  private maxHistoryLength;
9354
- private lastGCCount;
9355
9421
  private gcCollections;
9356
9422
  private lastMemoryCheck;
9357
9423
  /**
@@ -9430,7 +9496,6 @@ declare class WebSocketManager {
9430
9496
  private isConnected;
9431
9497
  private reconnectAttempts;
9432
9498
  private maxReconnectAttempts;
9433
- private reconnectInterval;
9434
9499
  private url;
9435
9500
  private autoReconnect;
9436
9501
  private reconnectTimer?;
@@ -9463,10 +9528,6 @@ declare class WebSocketManager {
9463
9528
  * 设置最大重连次数
9464
9529
  */
9465
9530
  setMaxReconnectAttempts(attempts: number): void;
9466
- /**
9467
- * 设置重连间隔
9468
- */
9469
- setReconnectInterval(interval: number): void;
9470
9531
  /**
9471
9532
  * 计划重连
9472
9533
  */
@@ -9544,7 +9605,7 @@ declare class DebugManager implements IService, IUpdatable {
9544
9605
  * 更新配置
9545
9606
  */
9546
9607
  updateConfig(config: IECSDebugConfig): void;
9547
- update(deltaTime?: number): void;
9608
+ update(_deltaTime?: number): void;
9548
9609
  /**
9549
9610
  * 场景变更回调
9550
9611
  */
@@ -10321,7 +10382,7 @@ declare class DebugPlugin implements IPlugin, IService {
10321
10382
  /**
10322
10383
  * 安装插件
10323
10384
  */
10324
- install(core: Core, services: ServiceContainer): Promise<void>;
10385
+ install(_core: Core, services: ServiceContainer): Promise<void>;
10325
10386
  /**
10326
10387
  * 卸载插件
10327
10388
  */
@@ -10385,6 +10446,10 @@ declare class DebugPlugin implements IPlugin, IService {
10385
10446
  * 提供 @Injectable、@Inject 和 @Updatable 装饰器,用于标记可注入的类和依赖注入点
10386
10447
  */
10387
10448
 
10449
+ /**
10450
+ * 依赖注入元数据存储
10451
+ */
10452
+ type Constructor = abstract new (...args: unknown[]) => unknown;
10388
10453
  /**
10389
10454
  * 可注入元数据接口
10390
10455
  */
@@ -10396,12 +10461,12 @@ interface InjectableMetadata {
10396
10461
  /**
10397
10462
  * 依赖列表
10398
10463
  */
10399
- dependencies: Array<ServiceType<any> | string | symbol>;
10464
+ dependencies: Array<ServiceType<IService> | string | symbol>;
10400
10465
  /**
10401
10466
  * 属性注入映射
10402
10467
  * key: 属性名, value: 服务类型
10403
10468
  */
10404
- properties?: Map<string | symbol, ServiceType<any>>;
10469
+ properties?: Map<string | symbol, ServiceType<IService>>;
10405
10470
  }
10406
10471
  /**
10407
10472
  * 可更新元数据接口
@@ -10477,7 +10542,7 @@ declare function Updatable(priority?: number): ClassDecorator;
10477
10542
  *
10478
10543
  * @param serviceType 服务类型标识符
10479
10544
  */
10480
- declare function Inject(serviceType: ServiceType<any> | string | symbol): ParameterDecorator;
10545
+ declare function Inject(serviceType: ServiceType<IService> | string | symbol): ParameterDecorator;
10481
10546
  /**
10482
10547
  * 创建实例并自动注入依赖
10483
10548
  *
@@ -10497,14 +10562,14 @@ declare function createInstance<T>(constructor: new (...args: any[]) => T, conta
10497
10562
  * @param target 目标类
10498
10563
  * @returns 是否可更新
10499
10564
  */
10500
- declare function isUpdatable(target: any): boolean;
10565
+ declare function isUpdatable(target: Constructor): boolean;
10501
10566
  /**
10502
10567
  * 获取类的可更新元数据
10503
10568
  *
10504
10569
  * @param target 目标类
10505
10570
  * @returns 可更新元数据
10506
10571
  */
10507
- declare function getUpdatableMetadata(target: any): UpdatableMetadata | undefined;
10572
+ declare function getUpdatableMetadata(target: Constructor): UpdatableMetadata | undefined;
10508
10573
  /**
10509
10574
  * 注册可注入的服务到容器
10510
10575
  *
@@ -10883,6 +10948,29 @@ declare class Time {
10883
10948
  static checkEvery(interval: number, lastTime: number): boolean;
10884
10949
  }
10885
10950
 
10951
+ /**
10952
+ * 二进制序列化器
10953
+ * 将对象转换为UTF8字节数组
10954
+ */
10955
+ declare class BinarySerializer {
10956
+ /**
10957
+ * 将字符串编码为UTF8字节数组
10958
+ */
10959
+ private static stringToUtf8;
10960
+ /**
10961
+ * 将UTF8字节数组解码为字符串
10962
+ */
10963
+ private static utf8ToString;
10964
+ /**
10965
+ * 将对象编码为二进制数据
10966
+ */
10967
+ static encode(value: any): Uint8Array;
10968
+ /**
10969
+ * 将二进制数据解码为对象
10970
+ */
10971
+ static decode(bytes: Uint8Array): any;
10972
+ }
10973
+
10886
10974
  /**
10887
10975
  * 平台适配器接口
10888
10976
  * 用于适配不同的运行环境(浏览器、微信小游戏、字节跳动小游戏等)
@@ -11156,5 +11244,5 @@ declare function getFullPlatformConfig(): Promise<any>;
11156
11244
  declare function supportsFeature(feature: 'worker' | 'shared-array-buffer' | 'transferable-objects' | 'module-worker'): boolean;
11157
11245
  declare function hasAdapter(): boolean;
11158
11246
 
11159
- export { AutoTyped, BitMask64Utils, Bits, COMPONENT_TYPE_NAME, ChangeOperation, Colors, Component, ComponentDataCollector, ComponentPool, ComponentPoolManager, ComponentRegistry, ComponentSerializer, ComponentSparseSet, ComponentStorage, ConsoleLogger, Core, DebugConfigService, DebugManager, DebugPlugin, DeepCopy, ECSComponent, ECSEventType, ECSFluentAPI, ECSSystem, ENTITY_REF_METADATA, EVENT_TYPES, Emitter, EnableSoA, Entity, EntityDataCollector, EntityList, EntityProcessorList, EntityRef, EntitySerializer, EntitySystem, EventBus, EventPriority, EventTypeValidator, Float32, Float64, FuncPack, GlobalEventBus, GlobalManager, HighPrecision, IdentifierPool, IgnoreSerialization, IncrementalSerializer, Inject, Injectable, Int16, Int32, Int8, IntervalSystem, LogLevel, Logger, LoggerManager, Matcher, MigrationBuilder, NumberExtension, PassiveSystem, PerformanceDataCollector, PerformanceMonitor, PerformanceWarningType, PlatformDetector, PlatformManager, PluginManager, PluginState, Pool, PoolManager, ProcessingSystem, QuerySystem, ReactiveQuery, ReactiveQueryChangeType, ReferenceTracker, SERIALIZABLE_METADATA, SERIALIZE_FIELD, SERIALIZE_OPTIONS, SYSTEM_TYPE_NAME, Scene, SceneDataCollector, SceneManager, SceneSerializer, Serializable, Serialize, SerializeArray, SerializeAsMap, SerializeAsSet, SerializeMap, SerializeSet, ServiceContainer, ServiceLifetime, SoAStorage, SparseSet, SystemDataCollector, Time, Timer, TimerManager, TypeInference, TypeSafeEventSystem, TypeUtils, TypedEntityBuilder, TypedQueryBuilder, TypedQueryResult, Uint16, Uint32, Uint8, Uint8Clamped, Updatable, VersionMigrationManager, WebSocketManager, WorkerEntitySystem, World, WorldManager, addAndConfigure, buildEntity, createECSAPI, createInstance, createLogger, createQuery, getBasicWorkerConfig, getComponentInstanceTypeName, getComponentTypeName, getComponents, getCurrentAdapter, getEntityRefMetadata, getFullPlatformConfig, getOrAddComponent, getSceneByEntityId, getSerializationMetadata, getSystemInstanceTypeName, getSystemMetadata, getSystemTypeName, getUpdatableMetadata, hasAdapter, hasAnyComponent, hasComponents, hasEntityRef, isComponentArray, isComponentType, isSerializable, isUpdatable, queryFor, queryForAll, registerInjectable, registerPlatformAdapter, requireComponent, resetLoggerColors, setGlobalLogLevel, setLoggerColors, setLoggerFactory, supportsFeature, tryGetComponent, updateComponent };
11247
+ export { AutoTyped, BinarySerializer, BitMask64Utils, Bits, COMPONENT_TYPE_NAME, ChangeOperation, Colors, Component, ComponentDataCollector, ComponentPool, ComponentPoolManager, ComponentRegistry, ComponentSerializer, ComponentSparseSet, ComponentStorage, ConsoleLogger, Core, DebugConfigService, DebugManager, DebugPlugin, DeepCopy, ECSComponent, ECSEventType, ECSFluentAPI, ECSSystem, ENTITY_REF_METADATA, EVENT_TYPES, Emitter, EnableSoA, Entity, EntityDataCollector, EntityList, EntityProcessorList, EntityRef, EntitySerializer, EntitySystem, EventBus, EventPriority, EventTypeValidator, Float32, Float64, FuncPack, GlobalEventBus, GlobalManager, HighPrecision, IdentifierPool, IgnoreSerialization, IncrementalSerializer, Inject, Injectable, Int16, Int32, Int8, IntervalSystem, LogLevel, Logger, LoggerManager, Matcher, MigrationBuilder, NumberExtension, PassiveSystem, PerformanceDataCollector, PerformanceMonitor, PerformanceWarningType, PlatformDetector, PlatformManager, PluginManager, PluginState, Pool, PoolManager, ProcessingSystem, QuerySystem, ReactiveQuery, ReactiveQueryChangeType, ReferenceTracker, SERIALIZABLE_METADATA, SERIALIZE_FIELD, SERIALIZE_OPTIONS, SYSTEM_TYPE_NAME, Scene, SceneDataCollector, SceneManager, SceneSerializer, Serializable, Serialize, SerializeArray, SerializeAsMap, SerializeAsSet, SerializeMap, SerializeSet, ServiceContainer, ServiceLifetime, SoAStorage, SparseSet, SystemDataCollector, Time, Timer, TimerManager, TypeInference, TypeSafeEventSystem, TypeUtils, TypedEntityBuilder, TypedQueryBuilder, TypedQueryResult, Uint16, Uint32, Uint8, Uint8Clamped, Updatable, VersionMigrationManager, WebSocketManager, WorkerEntitySystem, World, WorldManager, addAndConfigure, buildEntity, createECSAPI, createInstance, createLogger, createQuery, getBasicWorkerConfig, getComponentInstanceTypeName, getComponentTypeName, getComponents, getCurrentAdapter, getEntityRefMetadata, getFullPlatformConfig, getOrAddComponent, getSceneByEntityId, getSerializationMetadata, getSystemInstanceTypeName, getSystemMetadata, getSystemTypeName, getUpdatableMetadata, hasAdapter, hasAnyComponent, hasComponents, hasEntityRef, isComponentArray, isComponentType, isSerializable, isUpdatable, queryFor, queryForAll, registerInjectable, registerPlatformAdapter, requireComponent, resetLoggerColors, setGlobalLogLevel, setLoggerColors, setLoggerFactory, supportsFeature, tryGetComponent, updateComponent };
11160
11248
  export type { AnyComponentConstructor, BitMask64Data, ComponentChange, ComponentConstructor, ComponentDebugInfo, ComponentInstance, ComponentMigrationFunction, ComponentType$1 as ComponentType, ComponentTypeMap, ComponentTypeName, ComponentTypeNames, DataOnly, DeepPartial, DeepReadonly, DeserializationStrategy, ECSDebugStats, EntityChange, EntityDebugInfo, EntityRefMetadata, EntityRefRecord, EntityWithComponents, EventListenerConfig, EventStats, ExtractComponents, FieldSerializeOptions, IComponent, IComponentDebugData, IComponentEventData, ICoreConfig, IECSDebugConfig, IECSDebugData, IEntityDebugData, IEntityEventData, IEntityHierarchyNode, IEventBus, IEventData, IEventListenerConfig, IEventStats, ILogger, IPerformanceDebugData, IPerformanceEventData, IPlatformAdapter, IPlugin, IPluginMetadata, IPoolable, IScene, ISceneConfig, ISceneDebugData, ISceneEventData, ISceneFactory, IService, ISystemBase, ISystemDebugData, ISystemEventData, ITimer, IUpdatable, IWorldConfig, IWorldManagerConfig, IncrementalSerializationFormat, IncrementalSerializationOptions, IncrementalSnapshot, InjectableMetadata, LoggerColorConfig, LoggerConfig, MigrationFunction, PartialComponent, PerformanceData, PerformanceStats, PerformanceThresholds, PerformanceWarning, PlatformConfig, PlatformDetectionResult, PlatformWorker, PoolStats, QueryResult$1 as QueryResult, ReactiveQueryChange, ReactiveQueryConfig, ReactiveQueryListener, ReadonlyComponent, SceneDataChange, SceneDebugInfo, SceneDeserializationOptions, SceneMigrationFunction, SceneSerializationOptions, SerializableComponent, SerializableFields, SerializableOptions, SerializationFormat, SerializationMetadata, SerializedComponent, SerializedEntity, SerializedScene, ServiceType, SharedArrayBufferProcessFunction, SupportedTypedArray, SystemDebugInfo, SystemEntityType, SystemLifecycleHooks, SystemMetadata, TypeSafeBuilder, TypedEventHandler, TypedQueryCondition, UpdatableMetadata, ValidComponent, ValidComponentArray, WorkerCreationOptions, WorkerProcessFunction, WorkerSystemConfig };