@esengine/ecs-framework 2.2.11 → 2.2.13
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 +454 -372
- package/index.es5.js +2 -2
- package/index.es5.js.map +1 -1
- package/index.mjs +1 -1
- package/index.mjs.map +1 -1
- package/index.umd.js +2 -2
- 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.2.
|
|
2
|
+
* @esengine/ecs-framework v2.2.13
|
|
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
|
-
|
|
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
|
|
737
|
+
private static idGenerator;
|
|
738
738
|
/**
|
|
739
739
|
* 组件唯一标识符
|
|
740
740
|
*
|
|
@@ -1286,6 +1286,9 @@ declare class LoggerManager {
|
|
|
1286
1286
|
/**
|
|
1287
1287
|
* 设置日志器工厂方法
|
|
1288
1288
|
* @param factory 日志器工厂方法
|
|
1289
|
+
*
|
|
1290
|
+
* 注意: 应该在导入 ECS 模块之前调用此方法。
|
|
1291
|
+
* 设置后, 每次调用 getLogger() 都会通过 factory 创建新的 logger 实例, 由用户侧管理
|
|
1289
1292
|
*/
|
|
1290
1293
|
setLoggerFactory(factory: (name?: string) => ILogger): void;
|
|
1291
1294
|
}
|
|
@@ -1588,222 +1591,18 @@ declare class ComponentStorageManager {
|
|
|
1588
1591
|
/**
|
|
1589
1592
|
* 获取所有存储器的统计信息
|
|
1590
1593
|
*/
|
|
1591
|
-
getAllStats(): Map<string,
|
|
1594
|
+
getAllStats(): Map<string, {
|
|
1595
|
+
totalSlots: number;
|
|
1596
|
+
usedSlots: number;
|
|
1597
|
+
freeSlots: number;
|
|
1598
|
+
fragmentation: number;
|
|
1599
|
+
}>;
|
|
1592
1600
|
/**
|
|
1593
1601
|
* 清空所有存储器
|
|
1594
1602
|
*/
|
|
1595
1603
|
clear(): void;
|
|
1596
1604
|
}
|
|
1597
1605
|
|
|
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
1606
|
/**
|
|
1808
1607
|
* 高性能实体列表管理器
|
|
1809
1608
|
* 管理场景中的所有实体,支持快速查找和批量操作
|
|
@@ -2129,6 +1928,7 @@ interface IService {
|
|
|
2129
1928
|
* 服务类型
|
|
2130
1929
|
*
|
|
2131
1930
|
* 支持任意构造函数签名,以便与依赖注入装饰器配合使用
|
|
1931
|
+
* 使用 any[] 以允许任意参数类型的构造函数
|
|
2132
1932
|
*/
|
|
2133
1933
|
type ServiceType<T extends IService> = new (...args: any[]) => T;
|
|
2134
1934
|
/**
|
|
@@ -2236,7 +2036,7 @@ declare class ServiceContainer {
|
|
|
2236
2036
|
* container.registerInstance(Config, config);
|
|
2237
2037
|
* ```
|
|
2238
2038
|
*/
|
|
2239
|
-
registerInstance<T extends IService>(type:
|
|
2039
|
+
registerInstance<T extends IService>(type: ServiceType<T>, instance: T): void;
|
|
2240
2040
|
/**
|
|
2241
2041
|
* 解析服务
|
|
2242
2042
|
*
|
|
@@ -2425,23 +2225,8 @@ interface PerformanceThresholds {
|
|
|
2425
2225
|
declare class PerformanceMonitor implements IService {
|
|
2426
2226
|
private _systemData;
|
|
2427
2227
|
private _systemStats;
|
|
2428
|
-
private _warnings;
|
|
2429
2228
|
private _isEnabled;
|
|
2430
2229
|
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
2230
|
constructor();
|
|
2446
2231
|
/**
|
|
2447
2232
|
* 启用性能监控
|
|
@@ -2460,7 +2245,7 @@ declare class PerformanceMonitor implements IService {
|
|
|
2460
2245
|
* @param systemName 系统名称
|
|
2461
2246
|
* @returns 开始时间戳
|
|
2462
2247
|
*/
|
|
2463
|
-
startMonitoring(
|
|
2248
|
+
startMonitoring(_systemName: string): number;
|
|
2464
2249
|
/**
|
|
2465
2250
|
* 结束监控并记录性能数据
|
|
2466
2251
|
* @param systemName 系统名称
|
|
@@ -2723,7 +2508,7 @@ declare class EntityProcessorList {
|
|
|
2723
2508
|
*/
|
|
2724
2509
|
private sortProcessors;
|
|
2725
2510
|
/** 获取处理器列表 */
|
|
2726
|
-
get processors(): EntitySystem
|
|
2511
|
+
get processors(): EntitySystem[];
|
|
2727
2512
|
/** 获取处理器数量 */
|
|
2728
2513
|
get count(): number;
|
|
2729
2514
|
}
|
|
@@ -3448,21 +3233,17 @@ declare class ReactiveQuery {
|
|
|
3448
3233
|
* ```
|
|
3449
3234
|
*/
|
|
3450
3235
|
declare class QuerySystem {
|
|
3451
|
-
private _logger;
|
|
3452
|
-
private
|
|
3453
|
-
private
|
|
3236
|
+
private readonly _logger;
|
|
3237
|
+
private _entities;
|
|
3238
|
+
private _entityIndex;
|
|
3454
3239
|
private _version;
|
|
3455
|
-
private
|
|
3456
|
-
private
|
|
3457
|
-
private
|
|
3458
|
-
private
|
|
3459
|
-
private
|
|
3460
|
-
private
|
|
3461
|
-
private resultArrayPool;
|
|
3462
|
-
private poolMaxSize;
|
|
3240
|
+
private _queryCache;
|
|
3241
|
+
private _cacheMaxSize;
|
|
3242
|
+
private _cacheTimeout;
|
|
3243
|
+
private _componentMaskCache;
|
|
3244
|
+
private _archetypeSystem;
|
|
3245
|
+
private _queryStats;
|
|
3463
3246
|
constructor();
|
|
3464
|
-
private acquireResultArray;
|
|
3465
|
-
private releaseResultArray;
|
|
3466
3247
|
/**
|
|
3467
3248
|
* 设置实体列表并重建索引
|
|
3468
3249
|
*
|
|
@@ -3550,16 +3331,6 @@ declare class QuerySystem {
|
|
|
3550
3331
|
* ```
|
|
3551
3332
|
*/
|
|
3552
3333
|
queryAll(...componentTypes: ComponentType[]): QueryResult;
|
|
3553
|
-
/**
|
|
3554
|
-
* 多组件查询算法
|
|
3555
|
-
*
|
|
3556
|
-
* 针对多组件查询场景的高效算法实现。
|
|
3557
|
-
* 通过选择最小的组件集合作为起点,减少需要检查的实体数量。
|
|
3558
|
-
*
|
|
3559
|
-
* @param componentTypes 组件类型列表
|
|
3560
|
-
* @returns 匹配的实体列表
|
|
3561
|
-
*/
|
|
3562
|
-
private queryMultipleComponents;
|
|
3563
3334
|
/**
|
|
3564
3335
|
* 查询包含任意指定组件的实体
|
|
3565
3336
|
*
|
|
@@ -3901,11 +3672,11 @@ declare class QueryBuilder {
|
|
|
3901
3672
|
/**
|
|
3902
3673
|
* 事件处理器函数类型
|
|
3903
3674
|
*/
|
|
3904
|
-
type EventHandler<T
|
|
3675
|
+
type EventHandler<T> = (event: T) => void;
|
|
3905
3676
|
/**
|
|
3906
3677
|
* 异步事件处理器函数类型
|
|
3907
3678
|
*/
|
|
3908
|
-
type AsyncEventHandler<T
|
|
3679
|
+
type AsyncEventHandler<T> = (event: T) => Promise<void>;
|
|
3909
3680
|
/**
|
|
3910
3681
|
* 事件监听器配置
|
|
3911
3682
|
*/
|
|
@@ -3916,8 +3687,8 @@ interface EventListenerConfig {
|
|
|
3916
3687
|
priority?: number;
|
|
3917
3688
|
/** 是否异步执行 */
|
|
3918
3689
|
async?: boolean;
|
|
3919
|
-
/**
|
|
3920
|
-
|
|
3690
|
+
/** 事件处理函数的 this 绑定对象 */
|
|
3691
|
+
thisArg?: object;
|
|
3921
3692
|
}
|
|
3922
3693
|
/**
|
|
3923
3694
|
* 事件统计信息
|
|
@@ -3964,11 +3735,11 @@ declare class TypeSafeEventSystem {
|
|
|
3964
3735
|
/**
|
|
3965
3736
|
* 添加事件监听器
|
|
3966
3737
|
* @param eventType 事件类型
|
|
3967
|
-
* @param handler
|
|
3738
|
+
* @param handler 事件处理器(同步或异步,根据 config.async 决定)
|
|
3968
3739
|
* @param config 监听器配置
|
|
3969
3740
|
* @returns 监听器ID(用于移除)
|
|
3970
3741
|
*/
|
|
3971
|
-
on<T>(eventType: string, handler: EventHandler<T>, config?: EventListenerConfig): string;
|
|
3742
|
+
on<T>(eventType: string, handler: EventHandler<T> | AsyncEventHandler<T>, config?: EventListenerConfig): string;
|
|
3972
3743
|
/**
|
|
3973
3744
|
* 添加一次性事件监听器
|
|
3974
3745
|
* @param eventType 事件类型
|
|
@@ -4158,10 +3929,6 @@ declare class ReferenceTracker {
|
|
|
4158
3929
|
* Entity ID -> 引用该Entity的所有组件记录
|
|
4159
3930
|
*/
|
|
4160
3931
|
private _references;
|
|
4161
|
-
/**
|
|
4162
|
-
* 当前Scene的引用
|
|
4163
|
-
*/
|
|
4164
|
-
private _scene;
|
|
4165
3932
|
/**
|
|
4166
3933
|
* 注册Entity引用
|
|
4167
3934
|
*
|
|
@@ -4207,12 +3974,6 @@ declare class ReferenceTracker {
|
|
|
4207
3974
|
* 遍历所有记录,移除已被GC回收的Component引用。
|
|
4208
3975
|
*/
|
|
4209
3976
|
cleanup(): void;
|
|
4210
|
-
/**
|
|
4211
|
-
* 设置Scene引用
|
|
4212
|
-
*
|
|
4213
|
-
* @param scene Scene实例
|
|
4214
|
-
*/
|
|
4215
|
-
setScene(scene: IScene): void;
|
|
4216
3977
|
/**
|
|
4217
3978
|
* 注册Entity到Scene的映射
|
|
4218
3979
|
*
|
|
@@ -4454,6 +4215,21 @@ declare function queryForAll<T extends readonly ComponentConstructor[]>(...types
|
|
|
4454
4215
|
* 负责组件的序列化和反序列化操作
|
|
4455
4216
|
*/
|
|
4456
4217
|
|
|
4218
|
+
/**
|
|
4219
|
+
* 可序列化的值类型
|
|
4220
|
+
*/
|
|
4221
|
+
type SerializableValue = string | number | boolean | null | undefined | SerializableValue[] | {
|
|
4222
|
+
[key: string]: SerializableValue;
|
|
4223
|
+
} | {
|
|
4224
|
+
__type: 'Date';
|
|
4225
|
+
value: string;
|
|
4226
|
+
} | {
|
|
4227
|
+
__type: 'Map';
|
|
4228
|
+
value: Array<[SerializableValue, SerializableValue]>;
|
|
4229
|
+
} | {
|
|
4230
|
+
__type: 'Set';
|
|
4231
|
+
value: SerializableValue[];
|
|
4232
|
+
};
|
|
4457
4233
|
/**
|
|
4458
4234
|
* 序列化后的组件数据
|
|
4459
4235
|
*/
|
|
@@ -4469,7 +4245,7 @@ interface SerializedComponent {
|
|
|
4469
4245
|
/**
|
|
4470
4246
|
* 组件数据
|
|
4471
4247
|
*/
|
|
4472
|
-
data: Record<string,
|
|
4248
|
+
data: Record<string, SerializableValue>;
|
|
4473
4249
|
}
|
|
4474
4250
|
/**
|
|
4475
4251
|
* 组件序列化器类
|
|
@@ -5175,14 +4951,50 @@ declare class Scene implements IScene {
|
|
|
5175
4951
|
* 场景是否已开始运行
|
|
5176
4952
|
*/
|
|
5177
4953
|
private _didSceneBegin;
|
|
4954
|
+
/**
|
|
4955
|
+
* 系统列表缓存
|
|
4956
|
+
*/
|
|
4957
|
+
private _cachedSystems;
|
|
4958
|
+
/**
|
|
4959
|
+
* 系统顺序脏标记
|
|
4960
|
+
*
|
|
4961
|
+
* 当系统增删或 updateOrder 改变时标记为 true,下次访问 systems 时重新构建缓存
|
|
4962
|
+
*/
|
|
4963
|
+
private _systemsOrderDirty;
|
|
4964
|
+
/**
|
|
4965
|
+
* 系统错误计数器
|
|
4966
|
+
*
|
|
4967
|
+
* 跟踪每个系统的错误次数,用于自动禁用频繁出错的系统
|
|
4968
|
+
*/
|
|
4969
|
+
private _systemErrorCount;
|
|
4970
|
+
/**
|
|
4971
|
+
* 最大允许错误次数
|
|
4972
|
+
*
|
|
4973
|
+
* 系统错误次数超过此阈值后将被自动禁用
|
|
4974
|
+
*/
|
|
4975
|
+
private _maxErrorCount;
|
|
5178
4976
|
/**
|
|
5179
4977
|
* 获取场景中所有已注册的EntitySystem
|
|
5180
4978
|
*
|
|
5181
|
-
* 按updateOrder
|
|
4979
|
+
* 按updateOrder排序。使用缓存机制,仅在系统变化时重新排序。
|
|
5182
4980
|
*
|
|
5183
4981
|
* @returns 系统列表
|
|
5184
4982
|
*/
|
|
5185
4983
|
get systems(): EntitySystem[];
|
|
4984
|
+
/**
|
|
4985
|
+
* 重新构建系统缓存
|
|
4986
|
+
*
|
|
4987
|
+
* 从服务容器中提取所有EntitySystem并排序
|
|
4988
|
+
*/
|
|
4989
|
+
private _rebuildSystemsCache;
|
|
4990
|
+
/**
|
|
4991
|
+
* 从服务列表中过滤出EntitySystem实例
|
|
4992
|
+
*/
|
|
4993
|
+
private _filterEntitySystems;
|
|
4994
|
+
/**
|
|
4995
|
+
* 按updateOrder排序系统
|
|
4996
|
+
*/
|
|
4997
|
+
private _sortSystemsByUpdateOrder;
|
|
5186
4998
|
/**
|
|
5187
4999
|
* 通过类型获取System实例
|
|
5188
5000
|
*
|
|
@@ -5198,6 +5010,12 @@ declare class Scene implements IScene {
|
|
|
5198
5010
|
* ```
|
|
5199
5011
|
*/
|
|
5200
5012
|
getSystem<T extends EntitySystem>(systemType: ServiceType<T>): T | null;
|
|
5013
|
+
/**
|
|
5014
|
+
* 标记系统顺序为脏
|
|
5015
|
+
*
|
|
5016
|
+
* 当系统列表或顺序发生变化时调用,使缓存失效
|
|
5017
|
+
*/
|
|
5018
|
+
markSystemsOrderDirty(): void;
|
|
5201
5019
|
/**
|
|
5202
5020
|
* 获取场景的服务容器
|
|
5203
5021
|
*
|
|
@@ -5222,7 +5040,7 @@ declare class Scene implements IScene {
|
|
|
5222
5040
|
*
|
|
5223
5041
|
* 从 ServiceContainer 获取,如果未注册则创建默认实例(向后兼容)
|
|
5224
5042
|
*/
|
|
5225
|
-
|
|
5043
|
+
get performanceMonitor(): PerformanceMonitor;
|
|
5226
5044
|
/**
|
|
5227
5045
|
* 初始化场景
|
|
5228
5046
|
*
|
|
@@ -5251,12 +5069,32 @@ declare class Scene implements IScene {
|
|
|
5251
5069
|
* 结束场景,清除实体、实体处理器等
|
|
5252
5070
|
*
|
|
5253
5071
|
* 这个方法会结束场景。它将移除所有实体,结束实体处理器等,并调用unload方法。
|
|
5072
|
+
*
|
|
5073
|
+
* 执行顺序:
|
|
5074
|
+
* 1. 调用 unload() - 用户可以在此访问实体和系统进行清理
|
|
5075
|
+
* 2. 清理所有实体
|
|
5076
|
+
* 3. 清空服务容器,触发所有系统的 onDestroy()
|
|
5077
|
+
*
|
|
5078
|
+
* 注意:
|
|
5079
|
+
* - onRemoved 回调不会在 Scene.end() 时触发,因为这是批量销毁场景
|
|
5080
|
+
* - 用户清理:在 Scene.unload() 中处理(可访问实体和系统)
|
|
5081
|
+
* - 系统清理:在 System.onDestroy() 中处理(实体已被清理)
|
|
5254
5082
|
*/
|
|
5255
5083
|
end(): void;
|
|
5256
5084
|
/**
|
|
5257
5085
|
* 更新场景
|
|
5258
5086
|
*/
|
|
5259
5087
|
update(): void;
|
|
5088
|
+
/**
|
|
5089
|
+
* 处理系统执行错误
|
|
5090
|
+
*
|
|
5091
|
+
* 记录错误信息并跟踪错误次数。当系统错误次数超过阈值时自动禁用该系统。
|
|
5092
|
+
*
|
|
5093
|
+
* @param system 出错的系统
|
|
5094
|
+
* @param phase 错误发生的阶段(update 或 lateUpdate)
|
|
5095
|
+
* @param error 错误对象
|
|
5096
|
+
*/
|
|
5097
|
+
private _handleSystemError;
|
|
5260
5098
|
/**
|
|
5261
5099
|
* 将实体添加到此场景,并返回它
|
|
5262
5100
|
* @param name 实体名称
|
|
@@ -5305,12 +5143,16 @@ declare class Scene implements IScene {
|
|
|
5305
5143
|
findEntitiesByTag(tag: number): Entity[];
|
|
5306
5144
|
/**
|
|
5307
5145
|
* 根据名称查找实体(别名方法)
|
|
5146
|
+
*
|
|
5308
5147
|
* @param name 实体名称
|
|
5148
|
+
* @deprecated 请使用 findEntity() 代替此方法
|
|
5309
5149
|
*/
|
|
5310
5150
|
getEntityByName(name: string): Entity | null;
|
|
5311
5151
|
/**
|
|
5312
5152
|
* 根据标签查找实体(别名方法)
|
|
5153
|
+
*
|
|
5313
5154
|
* @param tag 实体标签
|
|
5155
|
+
* @deprecated 请使用 findEntitiesByTag() 代替此方法
|
|
5314
5156
|
*/
|
|
5315
5157
|
getEntitiesByTag(tag: number): Entity[];
|
|
5316
5158
|
/**
|
|
@@ -5328,7 +5170,7 @@ declare class Scene implements IScene {
|
|
|
5328
5170
|
* }
|
|
5329
5171
|
* ```
|
|
5330
5172
|
*/
|
|
5331
|
-
queryAll(...componentTypes:
|
|
5173
|
+
queryAll(...componentTypes: ComponentType[]): {
|
|
5332
5174
|
entities: readonly Entity[];
|
|
5333
5175
|
};
|
|
5334
5176
|
/**
|
|
@@ -5337,7 +5179,7 @@ declare class Scene implements IScene {
|
|
|
5337
5179
|
* @param componentTypes - 组件类型数组
|
|
5338
5180
|
* @returns 查询结果
|
|
5339
5181
|
*/
|
|
5340
|
-
queryAny(...componentTypes:
|
|
5182
|
+
queryAny(...componentTypes: ComponentType[]): {
|
|
5341
5183
|
entities: readonly Entity[];
|
|
5342
5184
|
};
|
|
5343
5185
|
/**
|
|
@@ -5346,7 +5188,7 @@ declare class Scene implements IScene {
|
|
|
5346
5188
|
* @param componentTypes - 组件类型数组
|
|
5347
5189
|
* @returns 查询结果
|
|
5348
5190
|
*/
|
|
5349
|
-
queryNone(...componentTypes:
|
|
5191
|
+
queryNone(...componentTypes: ComponentType[]): {
|
|
5350
5192
|
entities: readonly Entity[];
|
|
5351
5193
|
};
|
|
5352
5194
|
/**
|
|
@@ -5438,7 +5280,7 @@ declare class Scene implements IScene {
|
|
|
5438
5280
|
* 添加系统到场景(addEntityProcessor的别名)
|
|
5439
5281
|
* @param system 系统
|
|
5440
5282
|
*/
|
|
5441
|
-
addSystem(system: EntitySystem): EntitySystem
|
|
5283
|
+
addSystem(system: EntitySystem): EntitySystem;
|
|
5442
5284
|
/**
|
|
5443
5285
|
* 从场景中删除EntitySystem处理器
|
|
5444
5286
|
* @param processor 要删除的处理器
|
|
@@ -5474,7 +5316,12 @@ declare class Scene implements IScene {
|
|
|
5474
5316
|
getStats(): {
|
|
5475
5317
|
entityCount: number;
|
|
5476
5318
|
processorCount: number;
|
|
5477
|
-
componentStorageStats: Map<string,
|
|
5319
|
+
componentStorageStats: Map<string, {
|
|
5320
|
+
totalSlots: number;
|
|
5321
|
+
usedSlots: number;
|
|
5322
|
+
freeSlots: number;
|
|
5323
|
+
fragmentation: number;
|
|
5324
|
+
}>;
|
|
5478
5325
|
};
|
|
5479
5326
|
/**
|
|
5480
5327
|
* 获取场景的调试信息
|
|
@@ -5495,7 +5342,12 @@ declare class Scene implements IScene {
|
|
|
5495
5342
|
updateOrder: number;
|
|
5496
5343
|
entityCount: number;
|
|
5497
5344
|
}>;
|
|
5498
|
-
componentStats: Map<string,
|
|
5345
|
+
componentStats: Map<string, {
|
|
5346
|
+
totalSlots: number;
|
|
5347
|
+
usedSlots: number;
|
|
5348
|
+
freeSlots: number;
|
|
5349
|
+
fragmentation: number;
|
|
5350
|
+
}>;
|
|
5499
5351
|
};
|
|
5500
5352
|
/**
|
|
5501
5353
|
* 序列化场景
|
|
@@ -5610,7 +5462,7 @@ declare class Scene implements IScene {
|
|
|
5610
5462
|
* scene.applyIncremental(binaryData);
|
|
5611
5463
|
* ```
|
|
5612
5464
|
*/
|
|
5613
|
-
applyIncremental(incremental: IncrementalSnapshot | string | Uint8Array, componentRegistry?: Map<string,
|
|
5465
|
+
applyIncremental(incremental: IncrementalSnapshot | string | Uint8Array, componentRegistry?: Map<string, ComponentType>): void;
|
|
5614
5466
|
/**
|
|
5615
5467
|
* 更新增量快照基准
|
|
5616
5468
|
*
|
|
@@ -5691,7 +5543,7 @@ declare class Scene implements IScene {
|
|
|
5691
5543
|
* }
|
|
5692
5544
|
* ```
|
|
5693
5545
|
*/
|
|
5694
|
-
declare abstract class EntitySystem
|
|
5546
|
+
declare abstract class EntitySystem implements ISystemBase, IService {
|
|
5695
5547
|
private _updateOrder;
|
|
5696
5548
|
private _enabled;
|
|
5697
5549
|
private _performanceMonitor;
|
|
@@ -5700,13 +5552,13 @@ declare abstract class EntitySystem<TComponents extends readonly ComponentConstr
|
|
|
5700
5552
|
private _matcher;
|
|
5701
5553
|
private _eventListeners;
|
|
5702
5554
|
private _scene;
|
|
5555
|
+
private _destroyed;
|
|
5703
5556
|
protected logger: ReturnType<typeof createLogger>;
|
|
5704
5557
|
/**
|
|
5705
5558
|
* 实体ID映射缓存
|
|
5706
5559
|
*/
|
|
5707
5560
|
private _entityIdMap;
|
|
5708
5561
|
private _entityIdMapVersion;
|
|
5709
|
-
private _entityIdMapSize;
|
|
5710
5562
|
/**
|
|
5711
5563
|
* 统一的实体缓存管理器
|
|
5712
5564
|
*/
|
|
@@ -5776,6 +5628,10 @@ declare abstract class EntitySystem<TComponents extends readonly ComponentConstr
|
|
|
5776
5628
|
* 重置系统状态
|
|
5777
5629
|
*
|
|
5778
5630
|
* 当系统从场景中移除时调用,重置初始化状态以便重新添加时能正确初始化。
|
|
5631
|
+
*
|
|
5632
|
+
* 注意:此方法由 Scene.removeEntityProcessor 调用,在 unregister(触发dispose)之后调用。
|
|
5633
|
+
* dispose 已经调用了 onDestroy 并设置了 _destroyed 标志,所以这里不需要重置该标志。
|
|
5634
|
+
* 重置 _destroyed 会违反服务容器的语义(dispose 后不应重用)。
|
|
5779
5635
|
*/
|
|
5780
5636
|
reset(): void;
|
|
5781
5637
|
/**
|
|
@@ -5784,6 +5640,14 @@ declare abstract class EntitySystem<TComponents extends readonly ComponentConstr
|
|
|
5784
5640
|
private queryEntities;
|
|
5785
5641
|
/**
|
|
5786
5642
|
* 检查是否为单一条件查询
|
|
5643
|
+
*
|
|
5644
|
+
* 使用位运算优化多条件检测。将每种查询条件映射到不同的位:
|
|
5645
|
+
* - all: 第0位 (1)
|
|
5646
|
+
* - any: 第1位 (2)
|
|
5647
|
+
* - none: 第2位 (4)
|
|
5648
|
+
* - tag: 第3位 (8)
|
|
5649
|
+
* - name: 第4位 (16)
|
|
5650
|
+
* - component: 第5位 (32)
|
|
5787
5651
|
*/
|
|
5788
5652
|
private isSingleCondition;
|
|
5789
5653
|
/**
|
|
@@ -5845,7 +5709,7 @@ declare abstract class EntitySystem<TComponents extends readonly ComponentConstr
|
|
|
5845
5709
|
*
|
|
5846
5710
|
* @param entities 要处理的实体列表
|
|
5847
5711
|
*/
|
|
5848
|
-
protected process(
|
|
5712
|
+
protected process(_entities: readonly Entity[]): void;
|
|
5849
5713
|
/**
|
|
5850
5714
|
* 后期处理实体列表
|
|
5851
5715
|
*
|
|
@@ -5902,7 +5766,7 @@ declare abstract class EntitySystem<TComponents extends readonly ComponentConstr
|
|
|
5902
5766
|
*
|
|
5903
5767
|
* @param entity 被添加的实体
|
|
5904
5768
|
*/
|
|
5905
|
-
protected onAdded(
|
|
5769
|
+
protected onAdded(_entity: Entity): void;
|
|
5906
5770
|
/**
|
|
5907
5771
|
* 当实体从系统中移除时调用
|
|
5908
5772
|
*
|
|
@@ -5910,7 +5774,7 @@ declare abstract class EntitySystem<TComponents extends readonly ComponentConstr
|
|
|
5910
5774
|
*
|
|
5911
5775
|
* @param entity 被移除的实体
|
|
5912
5776
|
*/
|
|
5913
|
-
protected onRemoved(
|
|
5777
|
+
protected onRemoved(_entity: Entity): void;
|
|
5914
5778
|
/**
|
|
5915
5779
|
* 释放系统资源
|
|
5916
5780
|
*
|
|
@@ -5919,6 +5783,7 @@ declare abstract class EntitySystem<TComponents extends readonly ComponentConstr
|
|
|
5919
5783
|
*
|
|
5920
5784
|
* 默认行为:
|
|
5921
5785
|
* - 移除所有事件监听器
|
|
5786
|
+
* - 调用 onDestroy 回调(仅首次)
|
|
5922
5787
|
* - 清空所有缓存
|
|
5923
5788
|
* - 重置初始化状态
|
|
5924
5789
|
*
|
|
@@ -5934,15 +5799,16 @@ declare abstract class EntitySystem<TComponents extends readonly ComponentConstr
|
|
|
5934
5799
|
* @param eventType 事件类型
|
|
5935
5800
|
* @param handler 事件处理函数
|
|
5936
5801
|
* @param config 监听器配置
|
|
5802
|
+
* @returns 监听器引用ID,可用于手动移除监听器
|
|
5937
5803
|
*/
|
|
5938
|
-
protected addEventListener<T
|
|
5804
|
+
protected addEventListener<T>(eventType: string, handler: EventHandler<T>, config?: EventListenerConfig): string | null;
|
|
5939
5805
|
/**
|
|
5940
5806
|
* 移除特定的事件监听器
|
|
5941
5807
|
*
|
|
5942
5808
|
* @param eventType 事件类型
|
|
5943
|
-
* @param
|
|
5809
|
+
* @param listenerRef 监听器引用ID(由 addEventListener 返回)
|
|
5944
5810
|
*/
|
|
5945
|
-
protected removeEventListener
|
|
5811
|
+
protected removeEventListener(eventType: string, listenerRef: string): void;
|
|
5946
5812
|
/**
|
|
5947
5813
|
* 清理手动添加的事件监听器
|
|
5948
5814
|
*/
|
|
@@ -6433,17 +6299,6 @@ declare class Entity {
|
|
|
6433
6299
|
* 实体比较器实例
|
|
6434
6300
|
*/
|
|
6435
6301
|
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
6302
|
/**
|
|
6448
6303
|
* 实体名称
|
|
6449
6304
|
*/
|
|
@@ -6459,7 +6314,7 @@ declare class Entity {
|
|
|
6459
6314
|
/**
|
|
6460
6315
|
* 销毁状态标志
|
|
6461
6316
|
*/
|
|
6462
|
-
_isDestroyed
|
|
6317
|
+
private _isDestroyed;
|
|
6463
6318
|
/**
|
|
6464
6319
|
* 父实体引用
|
|
6465
6320
|
*/
|
|
@@ -6504,6 +6359,15 @@ declare class Entity {
|
|
|
6504
6359
|
* @returns 如果实体已被销毁则返回true
|
|
6505
6360
|
*/
|
|
6506
6361
|
get isDestroyed(): boolean;
|
|
6362
|
+
/**
|
|
6363
|
+
* 设置销毁状态(内部使用)
|
|
6364
|
+
*
|
|
6365
|
+
* 此方法供Scene和批量操作使用,以提高性能。
|
|
6366
|
+
* 不应在普通业务逻辑中调用,应使用destroy()方法。
|
|
6367
|
+
*
|
|
6368
|
+
* @internal
|
|
6369
|
+
*/
|
|
6370
|
+
setDestroyedState(destroyed: boolean): void;
|
|
6507
6371
|
/**
|
|
6508
6372
|
* 获取组件数组(懒加载)
|
|
6509
6373
|
* @returns 只读的组件数组
|
|
@@ -6607,7 +6471,7 @@ declare class Entity {
|
|
|
6607
6471
|
* const health = entity.createComponent(Health, 100);
|
|
6608
6472
|
* ```
|
|
6609
6473
|
*/
|
|
6610
|
-
createComponent<T extends Component>(componentType: ComponentType<T>, ...args:
|
|
6474
|
+
createComponent<T extends Component>(componentType: ComponentType<T>, ...args: ConstructorParameters<ComponentType<T>>): T;
|
|
6611
6475
|
/**
|
|
6612
6476
|
* 内部添加组件方法(不进行重复检查,用于初始化)
|
|
6613
6477
|
*
|
|
@@ -6615,6 +6479,10 @@ declare class Entity {
|
|
|
6615
6479
|
* @returns 添加的组件实例
|
|
6616
6480
|
*/
|
|
6617
6481
|
private addComponentInternal;
|
|
6482
|
+
/**
|
|
6483
|
+
* 通知Scene中的QuerySystem实体组件发生变动
|
|
6484
|
+
*/
|
|
6485
|
+
private notifyQuerySystems;
|
|
6618
6486
|
/**
|
|
6619
6487
|
* 添加组件到实体
|
|
6620
6488
|
*
|
|
@@ -6676,7 +6544,7 @@ declare class Entity {
|
|
|
6676
6544
|
* position.x = 100;
|
|
6677
6545
|
* ```
|
|
6678
6546
|
*/
|
|
6679
|
-
getOrCreateComponent<T extends Component>(type: ComponentType<T>, ...args:
|
|
6547
|
+
getOrCreateComponent<T extends Component>(type: ComponentType<T>, ...args: ConstructorParameters<ComponentType<T>>): T;
|
|
6680
6548
|
/**
|
|
6681
6549
|
* 移除指定的组件
|
|
6682
6550
|
*
|
|
@@ -6993,7 +6861,7 @@ declare abstract class ProcessingSystem extends EntitySystem {
|
|
|
6993
6861
|
* 处理实体,每帧调用processSystem方法进行处理
|
|
6994
6862
|
* @param entities 实体数组,未被使用
|
|
6995
6863
|
*/
|
|
6996
|
-
protected process(
|
|
6864
|
+
protected process(_entities: Entity[]): void;
|
|
6997
6865
|
/**
|
|
6998
6866
|
* 处理实体的具体方法,由子类实现
|
|
6999
6867
|
*/
|
|
@@ -7011,7 +6879,7 @@ declare abstract class PassiveSystem extends EntitySystem {
|
|
|
7011
6879
|
* 不进行任何处理
|
|
7012
6880
|
* @param entities 实体数组,未被使用
|
|
7013
6881
|
*/
|
|
7014
|
-
protected process(
|
|
6882
|
+
protected process(_entities: Entity[]): void;
|
|
7015
6883
|
}
|
|
7016
6884
|
|
|
7017
6885
|
/**
|
|
@@ -8088,6 +7956,13 @@ interface IWorldConfig {
|
|
|
8088
7956
|
* World类 - ECS世界管理器
|
|
8089
7957
|
*
|
|
8090
7958
|
* World是Scene的容器,每个World可以管理多个Scene。
|
|
7959
|
+
* World拥有独立的服务容器,用于管理World级别的全局服务。
|
|
7960
|
+
*
|
|
7961
|
+
* 服务容器层级:
|
|
7962
|
+
* - Core.services: 应用程序全局服务
|
|
7963
|
+
* - World.services: World级别服务(每个World独立)
|
|
7964
|
+
* - Scene.services: Scene级别服务(每个Scene独立)
|
|
7965
|
+
*
|
|
8091
7966
|
* 这种设计允许创建独立的游戏世界,如:
|
|
8092
7967
|
* - 游戏房间(每个房间一个World)
|
|
8093
7968
|
* - 不同的游戏模式
|
|
@@ -8098,10 +7973,16 @@ interface IWorldConfig {
|
|
|
8098
7973
|
* // 创建游戏房间的World
|
|
8099
7974
|
* const roomWorld = new World({ name: 'Room_001' });
|
|
8100
7975
|
*
|
|
7976
|
+
* // 注册World级别的服务
|
|
7977
|
+
* roomWorld.services.registerSingleton(RoomManager);
|
|
7978
|
+
*
|
|
8101
7979
|
* // 在World中创建Scene
|
|
8102
7980
|
* const gameScene = roomWorld.createScene('game', new Scene());
|
|
8103
7981
|
* const uiScene = roomWorld.createScene('ui', new Scene());
|
|
8104
7982
|
*
|
|
7983
|
+
* // 在Scene中使用World级别的服务
|
|
7984
|
+
* const roomManager = roomWorld.services.resolve(RoomManager);
|
|
7985
|
+
*
|
|
8105
7986
|
* // 更新整个World
|
|
8106
7987
|
* roomWorld.update(deltaTime);
|
|
8107
7988
|
* ```
|
|
@@ -8112,9 +7993,15 @@ declare class World {
|
|
|
8112
7993
|
private readonly _scenes;
|
|
8113
7994
|
private readonly _activeScenes;
|
|
8114
7995
|
private readonly _globalSystems;
|
|
7996
|
+
private readonly _services;
|
|
8115
7997
|
private _isActive;
|
|
8116
7998
|
private _createdAt;
|
|
8117
7999
|
constructor(config?: IWorldConfig);
|
|
8000
|
+
/**
|
|
8001
|
+
* World级别的服务容器
|
|
8002
|
+
* 用于管理World范围内的全局服务
|
|
8003
|
+
*/
|
|
8004
|
+
get services(): ServiceContainer;
|
|
8118
8005
|
/**
|
|
8119
8006
|
* 创建并添加Scene到World
|
|
8120
8007
|
*/
|
|
@@ -8267,9 +8154,9 @@ interface IWorldManagerConfig {
|
|
|
8267
8154
|
*/
|
|
8268
8155
|
autoCleanup?: boolean;
|
|
8269
8156
|
/**
|
|
8270
|
-
*
|
|
8157
|
+
* 清理间隔(帧数)
|
|
8271
8158
|
*/
|
|
8272
|
-
|
|
8159
|
+
cleanupFrameInterval?: number;
|
|
8273
8160
|
/**
|
|
8274
8161
|
* 是否启用调试模式
|
|
8275
8162
|
*/
|
|
@@ -8311,9 +8198,8 @@ interface IWorldManagerConfig {
|
|
|
8311
8198
|
declare class WorldManager implements IService {
|
|
8312
8199
|
private readonly _config;
|
|
8313
8200
|
private readonly _worlds;
|
|
8314
|
-
private readonly _activeWorlds;
|
|
8315
|
-
private _cleanupTimer;
|
|
8316
8201
|
private _isRunning;
|
|
8202
|
+
private _framesSinceCleanup;
|
|
8317
8203
|
constructor(config?: IWorldManagerConfig);
|
|
8318
8204
|
/**
|
|
8319
8205
|
* 创建新World
|
|
@@ -8390,22 +8276,10 @@ declare class WorldManager implements IService {
|
|
|
8390
8276
|
memoryUsage: number;
|
|
8391
8277
|
isRunning: boolean;
|
|
8392
8278
|
config: {
|
|
8393
|
-
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
/**
|
|
8398
|
-
* 是否自动清理空World
|
|
8399
|
-
*/
|
|
8400
|
-
autoCleanup?: boolean;
|
|
8401
|
-
/**
|
|
8402
|
-
* 清理间隔(毫秒)
|
|
8403
|
-
*/
|
|
8404
|
-
cleanupInterval?: number;
|
|
8405
|
-
/**
|
|
8406
|
-
* 是否启用调试模式
|
|
8407
|
-
*/
|
|
8408
|
-
debug?: boolean;
|
|
8279
|
+
maxWorlds: number;
|
|
8280
|
+
autoCleanup: boolean;
|
|
8281
|
+
cleanupFrameInterval: number;
|
|
8282
|
+
debug: boolean;
|
|
8409
8283
|
};
|
|
8410
8284
|
worlds: any[];
|
|
8411
8285
|
};
|
|
@@ -8444,22 +8318,10 @@ declare class WorldManager implements IService {
|
|
|
8444
8318
|
memoryUsage: number;
|
|
8445
8319
|
isRunning: boolean;
|
|
8446
8320
|
config: {
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
/**
|
|
8452
|
-
* 是否自动清理空World
|
|
8453
|
-
*/
|
|
8454
|
-
autoCleanup?: boolean;
|
|
8455
|
-
/**
|
|
8456
|
-
* 清理间隔(毫秒)
|
|
8457
|
-
*/
|
|
8458
|
-
cleanupInterval?: number;
|
|
8459
|
-
/**
|
|
8460
|
-
* 是否启用调试模式
|
|
8461
|
-
*/
|
|
8462
|
-
debug?: boolean;
|
|
8321
|
+
maxWorlds: number;
|
|
8322
|
+
autoCleanup: boolean;
|
|
8323
|
+
cleanupFrameInterval: number;
|
|
8324
|
+
debug: boolean;
|
|
8463
8325
|
};
|
|
8464
8326
|
};
|
|
8465
8327
|
/**
|
|
@@ -8475,16 +8337,12 @@ declare class WorldManager implements IService {
|
|
|
8475
8337
|
* 调用 destroy 方法进行清理
|
|
8476
8338
|
*/
|
|
8477
8339
|
dispose(): void;
|
|
8478
|
-
/**
|
|
8479
|
-
* 启动清理定时器
|
|
8480
|
-
*/
|
|
8481
|
-
private startCleanupTimer;
|
|
8482
|
-
/**
|
|
8483
|
-
* 停止清理定时器
|
|
8484
|
-
*/
|
|
8485
|
-
private stopCleanupTimer;
|
|
8486
8340
|
/**
|
|
8487
8341
|
* 判断World是否应该被清理
|
|
8342
|
+
* 清理策略:
|
|
8343
|
+
* 1. World未激活
|
|
8344
|
+
* 2. 没有Scene或所有Scene都是空的
|
|
8345
|
+
* 3. 创建时间超过10分钟
|
|
8488
8346
|
*/
|
|
8489
8347
|
private shouldCleanupWorld;
|
|
8490
8348
|
/**
|
|
@@ -8505,6 +8363,215 @@ declare class WorldManager implements IService {
|
|
|
8505
8363
|
get config(): IWorldManagerConfig;
|
|
8506
8364
|
}
|
|
8507
8365
|
|
|
8366
|
+
/**
|
|
8367
|
+
* 增强的事件总线实现
|
|
8368
|
+
* 基于TypeSafeEventSystem,提供类型安全的事件发布订阅机制
|
|
8369
|
+
*/
|
|
8370
|
+
declare class EventBus implements IEventBus {
|
|
8371
|
+
private static readonly _logger;
|
|
8372
|
+
private eventSystem;
|
|
8373
|
+
private eventIdCounter;
|
|
8374
|
+
private isDebugMode;
|
|
8375
|
+
constructor(debugMode?: boolean);
|
|
8376
|
+
/**
|
|
8377
|
+
* 发射事件
|
|
8378
|
+
* @param eventType 事件类型
|
|
8379
|
+
* @param data 事件数据
|
|
8380
|
+
* @param enhance 是否增强事件数据(添加timestamp、eventId等),默认false提升性能
|
|
8381
|
+
*/
|
|
8382
|
+
emit<T>(eventType: string, data: T, enhance?: boolean): void;
|
|
8383
|
+
/**
|
|
8384
|
+
* 异步发射事件
|
|
8385
|
+
* @param eventType 事件类型
|
|
8386
|
+
* @param data 事件数据
|
|
8387
|
+
* @param enhance 是否增强事件数据(添加timestamp、eventId等),默认false提升性能
|
|
8388
|
+
*/
|
|
8389
|
+
emitAsync<T>(eventType: string, data: T, enhance?: boolean): Promise<void>;
|
|
8390
|
+
/**
|
|
8391
|
+
* 监听事件
|
|
8392
|
+
* @param eventType 事件类型
|
|
8393
|
+
* @param handler 事件处理器
|
|
8394
|
+
* @param config 监听器配置
|
|
8395
|
+
* @returns 监听器ID
|
|
8396
|
+
*/
|
|
8397
|
+
on<T>(eventType: string, handler: (data: T) => void, config?: IEventListenerConfig): string;
|
|
8398
|
+
/**
|
|
8399
|
+
* 监听事件(一次性)
|
|
8400
|
+
* @param eventType 事件类型
|
|
8401
|
+
* @param handler 事件处理器
|
|
8402
|
+
* @param config 监听器配置
|
|
8403
|
+
* @returns 监听器ID
|
|
8404
|
+
*/
|
|
8405
|
+
once<T>(eventType: string, handler: (data: T) => void, config?: IEventListenerConfig): string;
|
|
8406
|
+
/**
|
|
8407
|
+
* 异步监听事件
|
|
8408
|
+
* @param eventType 事件类型
|
|
8409
|
+
* @param handler 异步事件处理器
|
|
8410
|
+
* @param config 监听器配置
|
|
8411
|
+
* @returns 监听器ID
|
|
8412
|
+
*/
|
|
8413
|
+
onAsync<T>(eventType: string, handler: (data: T) => Promise<void>, config?: IEventListenerConfig): string;
|
|
8414
|
+
/**
|
|
8415
|
+
* 移除事件监听器
|
|
8416
|
+
* @param eventType 事件类型
|
|
8417
|
+
* @param listenerId 监听器ID
|
|
8418
|
+
*/
|
|
8419
|
+
off(eventType: string, listenerId: string): boolean;
|
|
8420
|
+
/**
|
|
8421
|
+
* 移除指定事件类型的所有监听器
|
|
8422
|
+
* @param eventType 事件类型
|
|
8423
|
+
*/
|
|
8424
|
+
offAll(eventType: string): void;
|
|
8425
|
+
/**
|
|
8426
|
+
* 检查是否有指定事件的监听器
|
|
8427
|
+
* @param eventType 事件类型
|
|
8428
|
+
*/
|
|
8429
|
+
hasListeners(eventType: string): boolean;
|
|
8430
|
+
/**
|
|
8431
|
+
* 获取事件统计信息
|
|
8432
|
+
* @param eventType 事件类型(可选)
|
|
8433
|
+
*/
|
|
8434
|
+
getStats(eventType?: string): IEventStats | Map<string, IEventStats>;
|
|
8435
|
+
/**
|
|
8436
|
+
* 清空所有监听器
|
|
8437
|
+
*/
|
|
8438
|
+
clear(): void;
|
|
8439
|
+
/**
|
|
8440
|
+
* 启用或禁用事件系统
|
|
8441
|
+
* @param enabled 是否启用
|
|
8442
|
+
*/
|
|
8443
|
+
setEnabled(enabled: boolean): void;
|
|
8444
|
+
/**
|
|
8445
|
+
* 设置调试模式
|
|
8446
|
+
* @param debug 是否启用调试
|
|
8447
|
+
*/
|
|
8448
|
+
setDebugMode(debug: boolean): void;
|
|
8449
|
+
/**
|
|
8450
|
+
* 设置最大监听器数量
|
|
8451
|
+
* @param max 最大数量
|
|
8452
|
+
*/
|
|
8453
|
+
setMaxListeners(max: number): void;
|
|
8454
|
+
/**
|
|
8455
|
+
* 获取监听器数量
|
|
8456
|
+
* @param eventType 事件类型
|
|
8457
|
+
*/
|
|
8458
|
+
getListenerCount(eventType: string): number;
|
|
8459
|
+
/**
|
|
8460
|
+
* 设置事件批处理配置
|
|
8461
|
+
* @param eventType 事件类型
|
|
8462
|
+
* @param batchSize 批处理大小
|
|
8463
|
+
* @param delay 延迟时间(毫秒)
|
|
8464
|
+
*/
|
|
8465
|
+
setBatchConfig(eventType: string, batchSize: number, delay: number): void;
|
|
8466
|
+
/**
|
|
8467
|
+
* 刷新指定事件的批处理队列
|
|
8468
|
+
* @param eventType 事件类型
|
|
8469
|
+
*/
|
|
8470
|
+
flushBatch(eventType: string): void;
|
|
8471
|
+
/**
|
|
8472
|
+
* 重置事件统计
|
|
8473
|
+
* @param eventType 事件类型(可选)
|
|
8474
|
+
*/
|
|
8475
|
+
resetStats(eventType?: string): void;
|
|
8476
|
+
/**
|
|
8477
|
+
* 发射实体创建事件
|
|
8478
|
+
* @param entityData 实体事件数据
|
|
8479
|
+
*/
|
|
8480
|
+
emitEntityCreated(entityData: IEntityEventData): void;
|
|
8481
|
+
/**
|
|
8482
|
+
* 发射实体销毁事件
|
|
8483
|
+
* @param entityData 实体事件数据
|
|
8484
|
+
*/
|
|
8485
|
+
emitEntityDestroyed(entityData: IEntityEventData): void;
|
|
8486
|
+
/**
|
|
8487
|
+
* 发射组件添加事件
|
|
8488
|
+
* @param componentData 组件事件数据
|
|
8489
|
+
*/
|
|
8490
|
+
emitComponentAdded(componentData: IComponentEventData): void;
|
|
8491
|
+
/**
|
|
8492
|
+
* 发射组件移除事件
|
|
8493
|
+
* @param componentData 组件事件数据
|
|
8494
|
+
*/
|
|
8495
|
+
emitComponentRemoved(componentData: IComponentEventData): void;
|
|
8496
|
+
/**
|
|
8497
|
+
* 发射系统添加事件
|
|
8498
|
+
* @param systemData 系统事件数据
|
|
8499
|
+
*/
|
|
8500
|
+
emitSystemAdded(systemData: ISystemEventData): void;
|
|
8501
|
+
/**
|
|
8502
|
+
* 发射系统移除事件
|
|
8503
|
+
* @param systemData 系统事件数据
|
|
8504
|
+
*/
|
|
8505
|
+
emitSystemRemoved(systemData: ISystemEventData): void;
|
|
8506
|
+
/**
|
|
8507
|
+
* 发射场景变化事件
|
|
8508
|
+
* @param sceneData 场景事件数据
|
|
8509
|
+
*/
|
|
8510
|
+
emitSceneChanged(sceneData: ISceneEventData): void;
|
|
8511
|
+
/**
|
|
8512
|
+
* 发射性能警告事件
|
|
8513
|
+
* @param performanceData 性能事件数据
|
|
8514
|
+
*/
|
|
8515
|
+
emitPerformanceWarning(performanceData: IPerformanceEventData): void;
|
|
8516
|
+
/**
|
|
8517
|
+
* 监听实体创建事件
|
|
8518
|
+
* @param handler 事件处理器
|
|
8519
|
+
* @param config 监听器配置
|
|
8520
|
+
*/
|
|
8521
|
+
onEntityCreated(handler: (data: IEntityEventData) => void, config?: IEventListenerConfig): string;
|
|
8522
|
+
/**
|
|
8523
|
+
* 监听组件添加事件
|
|
8524
|
+
* @param handler 事件处理器
|
|
8525
|
+
* @param config 监听器配置
|
|
8526
|
+
*/
|
|
8527
|
+
onComponentAdded(handler: (data: IComponentEventData) => void, config?: IEventListenerConfig): string;
|
|
8528
|
+
/**
|
|
8529
|
+
* 监听系统错误事件
|
|
8530
|
+
* @param handler 事件处理器
|
|
8531
|
+
* @param config 监听器配置
|
|
8532
|
+
*/
|
|
8533
|
+
onSystemError(handler: (data: ISystemEventData) => void, config?: IEventListenerConfig): string;
|
|
8534
|
+
/**
|
|
8535
|
+
* 监听性能警告事件
|
|
8536
|
+
* @param handler 事件处理器
|
|
8537
|
+
* @param config 监听器配置
|
|
8538
|
+
*/
|
|
8539
|
+
onPerformanceWarning(handler: (data: IPerformanceEventData) => void, config?: IEventListenerConfig): string;
|
|
8540
|
+
/**
|
|
8541
|
+
* 验证事件类型(仅在debug模式下执行,提升性能)
|
|
8542
|
+
* @param eventType 事件类型
|
|
8543
|
+
*/
|
|
8544
|
+
private validateEventType;
|
|
8545
|
+
/**
|
|
8546
|
+
* 增强事件数据
|
|
8547
|
+
* @param eventType 事件类型
|
|
8548
|
+
* @param data 原始数据
|
|
8549
|
+
*/
|
|
8550
|
+
private enhanceEventData;
|
|
8551
|
+
/**
|
|
8552
|
+
* 转换EventStats为IEventStats
|
|
8553
|
+
* @param stats EventStats实例
|
|
8554
|
+
*/
|
|
8555
|
+
private convertEventStats;
|
|
8556
|
+
}
|
|
8557
|
+
/**
|
|
8558
|
+
* 全局事件总线实例
|
|
8559
|
+
* 提供全局访问的事件总线
|
|
8560
|
+
*/
|
|
8561
|
+
declare class GlobalEventBus {
|
|
8562
|
+
private static instance;
|
|
8563
|
+
/**
|
|
8564
|
+
* 获取全局事件总线实例
|
|
8565
|
+
* @param debugMode 是否启用调试模式
|
|
8566
|
+
*/
|
|
8567
|
+
static getInstance(debugMode?: boolean): EventBus;
|
|
8568
|
+
/**
|
|
8569
|
+
* 重置全局事件总线实例
|
|
8570
|
+
* @param debugMode 是否启用调试模式
|
|
8571
|
+
*/
|
|
8572
|
+
static reset(debugMode?: boolean): EventBus;
|
|
8573
|
+
}
|
|
8574
|
+
|
|
8508
8575
|
/**
|
|
8509
8576
|
* 组件对象池,用于复用组件实例以减少内存分配
|
|
8510
8577
|
*/
|
|
@@ -8514,9 +8581,8 @@ declare class ComponentPool<T extends Component> {
|
|
|
8514
8581
|
private resetFn?;
|
|
8515
8582
|
private maxSize;
|
|
8516
8583
|
private minSize;
|
|
8517
|
-
private growthFactor;
|
|
8518
8584
|
private stats;
|
|
8519
|
-
constructor(createFn: () => T, resetFn?: (component: T) => void, maxSize?: number, minSize?: number
|
|
8585
|
+
constructor(createFn: () => T, resetFn?: (component: T) => void, maxSize?: number, minSize?: number);
|
|
8520
8586
|
/**
|
|
8521
8587
|
* 获取一个组件实例
|
|
8522
8588
|
*/
|
|
@@ -8559,6 +8625,14 @@ declare class ComponentPool<T extends Component> {
|
|
|
8559
8625
|
utilizationRate: number;
|
|
8560
8626
|
};
|
|
8561
8627
|
}
|
|
8628
|
+
/**
|
|
8629
|
+
* 组件使用追踪
|
|
8630
|
+
*/
|
|
8631
|
+
interface ComponentUsageTracker {
|
|
8632
|
+
createCount: number;
|
|
8633
|
+
releaseCount: number;
|
|
8634
|
+
lastAccessTime: number;
|
|
8635
|
+
}
|
|
8562
8636
|
/**
|
|
8563
8637
|
* 全局组件池管理器
|
|
8564
8638
|
*/
|
|
@@ -8609,7 +8683,11 @@ declare class ComponentPoolManager {
|
|
|
8609
8683
|
/**
|
|
8610
8684
|
* 获取全局统计信息
|
|
8611
8685
|
*/
|
|
8612
|
-
getGlobalStats():
|
|
8686
|
+
getGlobalStats(): Array<{
|
|
8687
|
+
componentName: string;
|
|
8688
|
+
poolStats: ReturnType<ComponentPool<Component>['getStats']>;
|
|
8689
|
+
usage: ComponentUsageTracker | undefined;
|
|
8690
|
+
}>;
|
|
8613
8691
|
/**
|
|
8614
8692
|
* 获取池统计信息
|
|
8615
8693
|
*/
|
|
@@ -8818,7 +8896,7 @@ declare class VersionMigrationManager {
|
|
|
8818
8896
|
* );
|
|
8819
8897
|
* ```
|
|
8820
8898
|
*/
|
|
8821
|
-
static registerComponentMigration(componentType: string, fromVersion: number,
|
|
8899
|
+
static registerComponentMigration(componentType: string, fromVersion: number, _toVersion: number, migration: ComponentMigrationFunction): void;
|
|
8822
8900
|
/**
|
|
8823
8901
|
* 注册场景迁移函数
|
|
8824
8902
|
*
|
|
@@ -8839,7 +8917,7 @@ declare class VersionMigrationManager {
|
|
|
8839
8917
|
* );
|
|
8840
8918
|
* ```
|
|
8841
8919
|
*/
|
|
8842
|
-
static registerSceneMigration(fromVersion: number,
|
|
8920
|
+
static registerSceneMigration(fromVersion: number, _toVersion: number, migration: SceneMigrationFunction): void;
|
|
8843
8921
|
/**
|
|
8844
8922
|
* 迁移组件数据
|
|
8845
8923
|
*
|
|
@@ -9264,9 +9342,7 @@ declare class EntityDataCollector {
|
|
|
9264
9342
|
private collectArchetypeDataWithMemory;
|
|
9265
9343
|
private extractArchetypeStatistics;
|
|
9266
9344
|
private extractArchetypeStatisticsWithMemory;
|
|
9267
|
-
private getArchetypeDistribution;
|
|
9268
9345
|
private getArchetypeDistributionWithMemory;
|
|
9269
|
-
private getTopEntitiesByComponents;
|
|
9270
9346
|
private getTopEntitiesByComponentsWithMemory;
|
|
9271
9347
|
private getEmptyEntityDebugData;
|
|
9272
9348
|
private calculateFallbackEntityStats;
|
|
@@ -9351,7 +9427,6 @@ declare class SystemDataCollector {
|
|
|
9351
9427
|
declare class PerformanceDataCollector {
|
|
9352
9428
|
private frameTimeHistory;
|
|
9353
9429
|
private maxHistoryLength;
|
|
9354
|
-
private lastGCCount;
|
|
9355
9430
|
private gcCollections;
|
|
9356
9431
|
private lastMemoryCheck;
|
|
9357
9432
|
/**
|
|
@@ -9430,7 +9505,6 @@ declare class WebSocketManager {
|
|
|
9430
9505
|
private isConnected;
|
|
9431
9506
|
private reconnectAttempts;
|
|
9432
9507
|
private maxReconnectAttempts;
|
|
9433
|
-
private reconnectInterval;
|
|
9434
9508
|
private url;
|
|
9435
9509
|
private autoReconnect;
|
|
9436
9510
|
private reconnectTimer?;
|
|
@@ -9463,10 +9537,6 @@ declare class WebSocketManager {
|
|
|
9463
9537
|
* 设置最大重连次数
|
|
9464
9538
|
*/
|
|
9465
9539
|
setMaxReconnectAttempts(attempts: number): void;
|
|
9466
|
-
/**
|
|
9467
|
-
* 设置重连间隔
|
|
9468
|
-
*/
|
|
9469
|
-
setReconnectInterval(interval: number): void;
|
|
9470
9540
|
/**
|
|
9471
9541
|
* 计划重连
|
|
9472
9542
|
*/
|
|
@@ -9544,7 +9614,7 @@ declare class DebugManager implements IService, IUpdatable {
|
|
|
9544
9614
|
* 更新配置
|
|
9545
9615
|
*/
|
|
9546
9616
|
updateConfig(config: IECSDebugConfig): void;
|
|
9547
|
-
update(
|
|
9617
|
+
update(_deltaTime?: number): void;
|
|
9548
9618
|
/**
|
|
9549
9619
|
* 场景变更回调
|
|
9550
9620
|
*/
|
|
@@ -10321,7 +10391,7 @@ declare class DebugPlugin implements IPlugin, IService {
|
|
|
10321
10391
|
/**
|
|
10322
10392
|
* 安装插件
|
|
10323
10393
|
*/
|
|
10324
|
-
install(
|
|
10394
|
+
install(_core: Core, services: ServiceContainer): Promise<void>;
|
|
10325
10395
|
/**
|
|
10326
10396
|
* 卸载插件
|
|
10327
10397
|
*/
|
|
@@ -10385,6 +10455,10 @@ declare class DebugPlugin implements IPlugin, IService {
|
|
|
10385
10455
|
* 提供 @Injectable、@Inject 和 @Updatable 装饰器,用于标记可注入的类和依赖注入点
|
|
10386
10456
|
*/
|
|
10387
10457
|
|
|
10458
|
+
/**
|
|
10459
|
+
* 依赖注入元数据存储
|
|
10460
|
+
*/
|
|
10461
|
+
type Constructor = abstract new (...args: unknown[]) => unknown;
|
|
10388
10462
|
/**
|
|
10389
10463
|
* 可注入元数据接口
|
|
10390
10464
|
*/
|
|
@@ -10396,12 +10470,12 @@ interface InjectableMetadata {
|
|
|
10396
10470
|
/**
|
|
10397
10471
|
* 依赖列表
|
|
10398
10472
|
*/
|
|
10399
|
-
dependencies: Array<ServiceType<
|
|
10473
|
+
dependencies: Array<ServiceType<IService> | string | symbol>;
|
|
10400
10474
|
/**
|
|
10401
10475
|
* 属性注入映射
|
|
10402
10476
|
* key: 属性名, value: 服务类型
|
|
10403
10477
|
*/
|
|
10404
|
-
properties?: Map<string | symbol, ServiceType<
|
|
10478
|
+
properties?: Map<string | symbol, ServiceType<IService>>;
|
|
10405
10479
|
}
|
|
10406
10480
|
/**
|
|
10407
10481
|
* 可更新元数据接口
|
|
@@ -10477,7 +10551,7 @@ declare function Updatable(priority?: number): ClassDecorator;
|
|
|
10477
10551
|
*
|
|
10478
10552
|
* @param serviceType 服务类型标识符
|
|
10479
10553
|
*/
|
|
10480
|
-
declare function Inject(serviceType: ServiceType<
|
|
10554
|
+
declare function Inject(serviceType: ServiceType<IService> | string | symbol): ParameterDecorator;
|
|
10481
10555
|
/**
|
|
10482
10556
|
* 创建实例并自动注入依赖
|
|
10483
10557
|
*
|
|
@@ -10497,14 +10571,14 @@ declare function createInstance<T>(constructor: new (...args: any[]) => T, conta
|
|
|
10497
10571
|
* @param target 目标类
|
|
10498
10572
|
* @returns 是否可更新
|
|
10499
10573
|
*/
|
|
10500
|
-
declare function isUpdatable(target:
|
|
10574
|
+
declare function isUpdatable(target: Constructor): boolean;
|
|
10501
10575
|
/**
|
|
10502
10576
|
* 获取类的可更新元数据
|
|
10503
10577
|
*
|
|
10504
10578
|
* @param target 目标类
|
|
10505
10579
|
* @returns 可更新元数据
|
|
10506
10580
|
*/
|
|
10507
|
-
declare function getUpdatableMetadata(target:
|
|
10581
|
+
declare function getUpdatableMetadata(target: Constructor): UpdatableMetadata | undefined;
|
|
10508
10582
|
/**
|
|
10509
10583
|
* 注册可注入的服务到容器
|
|
10510
10584
|
*
|
|
@@ -10885,15 +10959,23 @@ declare class Time {
|
|
|
10885
10959
|
|
|
10886
10960
|
/**
|
|
10887
10961
|
* 二进制序列化器
|
|
10888
|
-
*
|
|
10962
|
+
* 将对象转换为UTF8字节数组
|
|
10889
10963
|
*/
|
|
10890
10964
|
declare class BinarySerializer {
|
|
10891
10965
|
/**
|
|
10892
|
-
*
|
|
10966
|
+
* 将字符串编码为UTF8字节数组
|
|
10967
|
+
*/
|
|
10968
|
+
private static stringToUtf8;
|
|
10969
|
+
/**
|
|
10970
|
+
* 将UTF8字节数组解码为字符串
|
|
10971
|
+
*/
|
|
10972
|
+
private static utf8ToString;
|
|
10973
|
+
/**
|
|
10974
|
+
* 将对象编码为二进制数据
|
|
10893
10975
|
*/
|
|
10894
10976
|
static encode(value: any): Uint8Array;
|
|
10895
10977
|
/**
|
|
10896
|
-
*
|
|
10978
|
+
* 将二进制数据解码为对象
|
|
10897
10979
|
*/
|
|
10898
10980
|
static decode(bytes: Uint8Array): any;
|
|
10899
10981
|
}
|