@esengine/ecs-framework 2.1.46 → 2.1.48
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 +3 -1
- package/index.cjs.map +1 -1
- package/index.d.ts +147 -17
- package/index.es5.js +4 -0
- package/index.es5.js.map +1 -0
- package/index.mjs +3 -1
- package/index.mjs.map +1 -1
- package/index.umd.js +3 -1
- package/index.umd.js.map +1 -1
- package/package.json +3 -1
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @esengine/ecs-framework v2.1.
|
|
2
|
+
* @esengine/ecs-framework v2.1.48
|
|
3
3
|
* TypeScript definitions
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -1353,6 +1353,41 @@ interface ILogger {
|
|
|
1353
1353
|
error(message: string, ...args: unknown[]): void;
|
|
1354
1354
|
fatal(message: string, ...args: unknown[]): void;
|
|
1355
1355
|
}
|
|
1356
|
+
/**
|
|
1357
|
+
* 日志颜色配置接口
|
|
1358
|
+
*/
|
|
1359
|
+
interface LoggerColorConfig {
|
|
1360
|
+
debug?: string;
|
|
1361
|
+
info?: string;
|
|
1362
|
+
warn?: string;
|
|
1363
|
+
error?: string;
|
|
1364
|
+
fatal?: string;
|
|
1365
|
+
reset?: string;
|
|
1366
|
+
}
|
|
1367
|
+
/**
|
|
1368
|
+
* 预定义的颜色常量
|
|
1369
|
+
*/
|
|
1370
|
+
declare const Colors: {
|
|
1371
|
+
readonly BLACK: "\u001B[30m";
|
|
1372
|
+
readonly RED: "\u001B[31m";
|
|
1373
|
+
readonly GREEN: "\u001B[32m";
|
|
1374
|
+
readonly YELLOW: "\u001B[33m";
|
|
1375
|
+
readonly BLUE: "\u001B[34m";
|
|
1376
|
+
readonly MAGENTA: "\u001B[35m";
|
|
1377
|
+
readonly CYAN: "\u001B[36m";
|
|
1378
|
+
readonly WHITE: "\u001B[37m";
|
|
1379
|
+
readonly BRIGHT_BLACK: "\u001B[90m";
|
|
1380
|
+
readonly BRIGHT_RED: "\u001B[91m";
|
|
1381
|
+
readonly BRIGHT_GREEN: "\u001B[92m";
|
|
1382
|
+
readonly BRIGHT_YELLOW: "\u001B[93m";
|
|
1383
|
+
readonly BRIGHT_BLUE: "\u001B[94m";
|
|
1384
|
+
readonly BRIGHT_MAGENTA: "\u001B[95m";
|
|
1385
|
+
readonly BRIGHT_CYAN: "\u001B[96m";
|
|
1386
|
+
readonly BRIGHT_WHITE: "\u001B[97m";
|
|
1387
|
+
readonly RESET: "\u001B[0m";
|
|
1388
|
+
readonly BOLD: "\u001B[1m";
|
|
1389
|
+
readonly UNDERLINE: "\u001B[4m";
|
|
1390
|
+
};
|
|
1356
1391
|
/**
|
|
1357
1392
|
* 日志配置
|
|
1358
1393
|
*/
|
|
@@ -1367,6 +1402,8 @@ interface LoggerConfig {
|
|
|
1367
1402
|
prefix?: string;
|
|
1368
1403
|
/** 自定义输出函数 */
|
|
1369
1404
|
output?: (level: LogLevel, message: string) => void;
|
|
1405
|
+
/** 自定义颜色配置 */
|
|
1406
|
+
colors?: LoggerColorConfig;
|
|
1370
1407
|
}
|
|
1371
1408
|
/**
|
|
1372
1409
|
* 默认控制台日志实现
|
|
@@ -1409,6 +1446,11 @@ declare class ConsoleLogger implements ILogger {
|
|
|
1409
1446
|
* @param level 日志级别
|
|
1410
1447
|
*/
|
|
1411
1448
|
setLevel(level: LogLevel): void;
|
|
1449
|
+
/**
|
|
1450
|
+
* 设置颜色配置
|
|
1451
|
+
* @param colors 颜色配置
|
|
1452
|
+
*/
|
|
1453
|
+
setColors(colors: LoggerColorConfig): void;
|
|
1412
1454
|
/**
|
|
1413
1455
|
* 设置日志前缀
|
|
1414
1456
|
* @param prefix 前缀字符串
|
|
@@ -1441,6 +1483,7 @@ declare class LoggerManager {
|
|
|
1441
1483
|
private static _instance;
|
|
1442
1484
|
private _loggers;
|
|
1443
1485
|
private _defaultLogger;
|
|
1486
|
+
private _defaultLevel;
|
|
1444
1487
|
private constructor();
|
|
1445
1488
|
/**
|
|
1446
1489
|
* 获取日志管理器实例
|
|
@@ -1471,6 +1514,15 @@ declare class LoggerManager {
|
|
|
1471
1514
|
* @returns 子日志器实例
|
|
1472
1515
|
*/
|
|
1473
1516
|
createChildLogger(parentName: string, childName: string): ILogger;
|
|
1517
|
+
/**
|
|
1518
|
+
* 设置全局颜色配置
|
|
1519
|
+
* @param colors 颜色配置
|
|
1520
|
+
*/
|
|
1521
|
+
setGlobalColors(colors: LoggerColorConfig): void;
|
|
1522
|
+
/**
|
|
1523
|
+
* 重置为默认颜色配置
|
|
1524
|
+
*/
|
|
1525
|
+
resetColors(): void;
|
|
1474
1526
|
}
|
|
1475
1527
|
/**
|
|
1476
1528
|
* 默认日志器实例
|
|
@@ -1482,6 +1534,15 @@ declare const Logger: ILogger;
|
|
|
1482
1534
|
* @returns 日志器实例
|
|
1483
1535
|
*/
|
|
1484
1536
|
declare function createLogger(name: string): ILogger;
|
|
1537
|
+
/**
|
|
1538
|
+
* 设置全局日志颜色配置
|
|
1539
|
+
* @param colors 颜色配置
|
|
1540
|
+
*/
|
|
1541
|
+
declare function setLoggerColors(colors: LoggerColorConfig): void;
|
|
1542
|
+
/**
|
|
1543
|
+
* 重置日志颜色为默认配置
|
|
1544
|
+
*/
|
|
1545
|
+
declare function resetLoggerColors(): void;
|
|
1485
1546
|
/**
|
|
1486
1547
|
* 设置全局日志级别
|
|
1487
1548
|
* @param level 日志级别
|
|
@@ -3370,6 +3431,7 @@ declare abstract class EntitySystem implements ISystemBase {
|
|
|
3370
3431
|
private _initialized;
|
|
3371
3432
|
private _matcher;
|
|
3372
3433
|
private _trackedEntities;
|
|
3434
|
+
private _eventListeners;
|
|
3373
3435
|
/**
|
|
3374
3436
|
* 获取系统处理的实体列表(动态查询)
|
|
3375
3437
|
*/
|
|
@@ -3494,7 +3556,7 @@ declare abstract class EntitySystem implements ISystemBase {
|
|
|
3494
3556
|
*
|
|
3495
3557
|
* @param entities 要处理的实体列表
|
|
3496
3558
|
*/
|
|
3497
|
-
protected process(
|
|
3559
|
+
protected process(entities: Entity[]): void;
|
|
3498
3560
|
/**
|
|
3499
3561
|
* 后期处理实体列表
|
|
3500
3562
|
*
|
|
@@ -3551,7 +3613,7 @@ declare abstract class EntitySystem implements ISystemBase {
|
|
|
3551
3613
|
*
|
|
3552
3614
|
* @param entity 被添加的实体
|
|
3553
3615
|
*/
|
|
3554
|
-
protected onAdded(
|
|
3616
|
+
protected onAdded(entity: Entity): void;
|
|
3555
3617
|
/**
|
|
3556
3618
|
* 当实体从系统中移除时调用
|
|
3557
3619
|
*
|
|
@@ -3559,7 +3621,38 @@ declare abstract class EntitySystem implements ISystemBase {
|
|
|
3559
3621
|
*
|
|
3560
3622
|
* @param entity 被移除的实体
|
|
3561
3623
|
*/
|
|
3562
|
-
protected onRemoved(
|
|
3624
|
+
protected onRemoved(entity: Entity): void;
|
|
3625
|
+
/**
|
|
3626
|
+
* 添加事件监听器
|
|
3627
|
+
*
|
|
3628
|
+
* 推荐使用此方法而不是直接调用eventSystem.on(),
|
|
3629
|
+
* 这样可以确保系统移除时自动清理监听器,避免内存泄漏。
|
|
3630
|
+
*
|
|
3631
|
+
* @param eventType 事件类型
|
|
3632
|
+
* @param handler 事件处理函数
|
|
3633
|
+
* @param config 监听器配置
|
|
3634
|
+
*/
|
|
3635
|
+
protected addEventListener<T = any>(eventType: string, handler: EventHandler<T>, config?: EventListenerConfig): void;
|
|
3636
|
+
/**
|
|
3637
|
+
* 移除特定的事件监听器
|
|
3638
|
+
*
|
|
3639
|
+
* @param eventType 事件类型
|
|
3640
|
+
* @param handler 事件处理函数
|
|
3641
|
+
*/
|
|
3642
|
+
protected removeEventListener<T = any>(eventType: string, handler: EventHandler<T>): void;
|
|
3643
|
+
/**
|
|
3644
|
+
* 清理所有事件监听器
|
|
3645
|
+
*
|
|
3646
|
+
* 系统移除时自动调用,清理所有通过addEventListener添加的监听器。
|
|
3647
|
+
*/
|
|
3648
|
+
private cleanupEventListeners;
|
|
3649
|
+
/**
|
|
3650
|
+
* 系统销毁时的回调
|
|
3651
|
+
*
|
|
3652
|
+
* 当系统从场景中移除时调用,子类可以重写此方法进行清理操作。
|
|
3653
|
+
* 注意:事件监听器会被框架自动清理,无需手动处理。
|
|
3654
|
+
*/
|
|
3655
|
+
protected onDestroy(): void;
|
|
3563
3656
|
}
|
|
3564
3657
|
|
|
3565
3658
|
/**
|
|
@@ -4959,8 +5052,16 @@ declare class WorldManager {
|
|
|
4959
5052
|
* 实体数据收集器
|
|
4960
5053
|
*/
|
|
4961
5054
|
declare class EntityDataCollector {
|
|
4962
|
-
|
|
4963
|
-
|
|
5055
|
+
/**
|
|
5056
|
+
* 收集实体数据
|
|
5057
|
+
* @param scene 场景实例
|
|
5058
|
+
*/
|
|
5059
|
+
collectEntityData(scene?: IScene | null): IEntityDebugData;
|
|
5060
|
+
/**
|
|
5061
|
+
* 获取原始实体列表
|
|
5062
|
+
* @param scene 场景实例
|
|
5063
|
+
*/
|
|
5064
|
+
getRawEntityList(scene?: IScene | null): Array<{
|
|
4964
5065
|
id: number;
|
|
4965
5066
|
name: string;
|
|
4966
5067
|
active: boolean;
|
|
@@ -4974,9 +5075,18 @@ declare class EntityDataCollector {
|
|
|
4974
5075
|
tag: number;
|
|
4975
5076
|
updateOrder: number;
|
|
4976
5077
|
}>;
|
|
4977
|
-
|
|
5078
|
+
/**
|
|
5079
|
+
* 获取实体详细信息
|
|
5080
|
+
* @param entityId 实体ID
|
|
5081
|
+
* @param scene 场景实例
|
|
5082
|
+
*/
|
|
5083
|
+
getEntityDetails(entityId: number, scene?: IScene | null): any;
|
|
4978
5084
|
private getSceneInfo;
|
|
4979
|
-
|
|
5085
|
+
/**
|
|
5086
|
+
* 收集实体数据(包含内存信息)
|
|
5087
|
+
* @param scene 场景实例
|
|
5088
|
+
*/
|
|
5089
|
+
collectEntityDataWithMemory(scene?: IScene | null): IEntityDebugData;
|
|
4980
5090
|
private collectArchetypeData;
|
|
4981
5091
|
private getArchetypeDistributionFast;
|
|
4982
5092
|
private getTopEntitiesByComponentsFast;
|
|
@@ -5013,8 +5123,11 @@ declare class EntityDataCollector {
|
|
|
5013
5123
|
}>;
|
|
5014
5124
|
/**
|
|
5015
5125
|
* 获取组件的完整属性信息(仅在需要时调用)
|
|
5126
|
+
* @param entityId 实体ID
|
|
5127
|
+
* @param componentIndex 组件索引
|
|
5128
|
+
* @param scene 场景实例
|
|
5016
5129
|
*/
|
|
5017
|
-
getComponentProperties(entityId: number, componentIndex: number): Record<string, any>;
|
|
5130
|
+
getComponentProperties(entityId: number, componentIndex: number, scene?: IScene | null): Record<string, any>;
|
|
5018
5131
|
/**
|
|
5019
5132
|
* 格式化属性值
|
|
5020
5133
|
*/
|
|
@@ -5037,8 +5150,12 @@ declare class EntityDataCollector {
|
|
|
5037
5150
|
private generateObjectId;
|
|
5038
5151
|
/**
|
|
5039
5152
|
* 展开懒加载对象(供调试面板调用)
|
|
5153
|
+
* @param entityId 实体ID
|
|
5154
|
+
* @param componentIndex 组件索引
|
|
5155
|
+
* @param propertyPath 属性路径
|
|
5156
|
+
* @param scene 场景实例
|
|
5040
5157
|
*/
|
|
5041
|
-
expandLazyObject(entityId: number, componentIndex: number, propertyPath: string): any;
|
|
5158
|
+
expandLazyObject(entityId: number, componentIndex: number, propertyPath: string, scene?: IScene | null): any;
|
|
5042
5159
|
/**
|
|
5043
5160
|
* 根据路径获取对象
|
|
5044
5161
|
*/
|
|
@@ -5051,8 +5168,10 @@ declare class EntityDataCollector {
|
|
|
5051
5168
|
declare class SystemDataCollector {
|
|
5052
5169
|
/**
|
|
5053
5170
|
* 收集系统数据
|
|
5171
|
+
* @param performanceMonitor 性能监视器实例
|
|
5172
|
+
* @param scene 场景实例
|
|
5054
5173
|
*/
|
|
5055
|
-
collectSystemData(performanceMonitor: any): ISystemDebugData;
|
|
5174
|
+
collectSystemData(performanceMonitor: any, scene?: IScene | null): ISystemDebugData;
|
|
5056
5175
|
}
|
|
5057
5176
|
|
|
5058
5177
|
/**
|
|
@@ -5093,8 +5212,9 @@ declare class ComponentDataCollector {
|
|
|
5093
5212
|
private static componentSizeCache;
|
|
5094
5213
|
/**
|
|
5095
5214
|
* 收集组件数据(轻量版,不计算实际内存大小)
|
|
5215
|
+
* @param scene 场景实例
|
|
5096
5216
|
*/
|
|
5097
|
-
collectComponentData(): IComponentDebugData;
|
|
5217
|
+
collectComponentData(scene?: IScene | null): IComponentDebugData;
|
|
5098
5218
|
/**
|
|
5099
5219
|
* 获取组件类型的估算内存大小(基于预设值,不进行实际计算)
|
|
5100
5220
|
*/
|
|
@@ -5103,8 +5223,10 @@ declare class ComponentDataCollector {
|
|
|
5103
5223
|
/**
|
|
5104
5224
|
* 为内存快照功能提供的详细内存计算
|
|
5105
5225
|
* 只在用户主动请求内存快照时调用
|
|
5226
|
+
* @param typeName 组件类型名称
|
|
5227
|
+
* @param scene 场景实例
|
|
5106
5228
|
*/
|
|
5107
|
-
calculateDetailedComponentMemory(typeName: string): number;
|
|
5229
|
+
calculateDetailedComponentMemory(typeName: string, scene?: IScene | null): number;
|
|
5108
5230
|
/**
|
|
5109
5231
|
* 估算对象内存大小(仅用于内存快照)
|
|
5110
5232
|
* 优化版本:减少递归深度,提高性能
|
|
@@ -5120,8 +5242,9 @@ declare class SceneDataCollector {
|
|
|
5120
5242
|
private sceneStartTime;
|
|
5121
5243
|
/**
|
|
5122
5244
|
* 收集场景数据
|
|
5245
|
+
* @param scene 场景实例
|
|
5123
5246
|
*/
|
|
5124
|
-
collectSceneData(): ISceneDebugData;
|
|
5247
|
+
collectSceneData(scene?: IScene | null): ISceneDebugData;
|
|
5125
5248
|
/**
|
|
5126
5249
|
* 设置场景开始时间
|
|
5127
5250
|
*/
|
|
@@ -5200,11 +5323,18 @@ declare class DebugManager {
|
|
|
5200
5323
|
private performanceCollector;
|
|
5201
5324
|
private componentCollector;
|
|
5202
5325
|
private sceneCollector;
|
|
5326
|
+
private sceneProvider;
|
|
5327
|
+
private performanceMonitorProvider;
|
|
5203
5328
|
private frameCounter;
|
|
5204
5329
|
private lastSendTime;
|
|
5205
5330
|
private sendInterval;
|
|
5206
5331
|
private isRunning;
|
|
5207
|
-
|
|
5332
|
+
/**
|
|
5333
|
+
* 构造调试管理器
|
|
5334
|
+
* @param core Core实例
|
|
5335
|
+
* @param config 调试配置
|
|
5336
|
+
*/
|
|
5337
|
+
constructor(core: any, config: IECSDebugConfig);
|
|
5208
5338
|
/**
|
|
5209
5339
|
* 启动调试管理器
|
|
5210
5340
|
*/
|
|
@@ -7217,5 +7347,5 @@ declare class Time {
|
|
|
7217
7347
|
static checkEvery(interval: number, lastTime: number): boolean;
|
|
7218
7348
|
}
|
|
7219
7349
|
|
|
7220
|
-
export { ArchetypeSystem, AsyncEventHandler$1 as AsyncEventHandler, BitMask64Utils, Bits, COMPONENT_TYPE_NAME, Component, ComponentDataCollector, ComponentIndex, ComponentIndexManager, ComponentPool, ComponentPoolManager, ComponentRegistry, ComponentSparseSet, ComponentStorage, ComponentTypeManager, ConsoleLogger, Core, DebugManager, DirtyFlag, DirtyTrackingSystem, ECSComponent, ECSEventType, ECSFluentAPI, ECSSystem, EVENT_TYPES, Emitter, EnableSoA, Entity, EntityDataCollector, EntityList, EntityManager, EntityProcessorList, EntityQueryBuilder, EntitySystem, EventBus, EventHandler$1 as EventHandler, EventPriority, EventTypeValidator, Float32, Float64, FuncPack, GlobalEventBus, GlobalManager, HighPrecision, IdentifierPool, Int32, IntervalSystem, LogLevel, Logger, LoggerManager, Matcher, NumberExtension, PassiveSystem, PerformanceDataCollector, PerformanceMonitor, PerformanceWarningType, Pool, PoolManager, ProcessingSystem, QuerySystem, SYSTEM_TYPE_NAME, Scene, SceneDataCollector, SerializeMap, SoAStorage, SparseSet, SystemDataCollector, Time, Timer, TimerManager, TypeSafeEventSystem, TypeUtils, WebSocketManager, World, WorldManager, createECSAPI, createLogger, getComponentInstanceTypeName, getComponentTypeName, getSystemInstanceTypeName, getSystemTypeName, setGlobalLogLevel };
|
|
7221
|
-
export type { Archetype, ArchetypeQueryResult, BitMask64Data, ComponentType$1 as ComponentType, DirtyData, DirtyListener, EventListenerConfig, EventStats, IComponent, IComponentDebugData, IComponentEventData, IComponentIndex, ICoreConfig, IECSDebugConfig, IECSDebugData, IEntityDebugData, IEntityEventData, IEntityHierarchyNode, IEventBus, IEventData, IEventListenerConfig, IEventStats, ILogger, IPerformanceDebugData, IPerformanceEventData, IPoolable, IScene, ISceneConfig, ISceneDebugData, ISceneEventData, ISceneFactory, ISystemBase, ISystemDebugData, ISystemEventData, ITimer, IWorldConfig, IWorldManagerConfig, IndexStats, LoggerConfig, PerformanceData, PerformanceStats, PerformanceThresholds, PerformanceWarning, PoolStats };
|
|
7350
|
+
export { ArchetypeSystem, AsyncEventHandler$1 as AsyncEventHandler, BitMask64Utils, Bits, COMPONENT_TYPE_NAME, Colors, Component, ComponentDataCollector, ComponentIndex, ComponentIndexManager, ComponentPool, ComponentPoolManager, ComponentRegistry, ComponentSparseSet, ComponentStorage, ComponentTypeManager, ConsoleLogger, Core, DebugManager, DirtyFlag, DirtyTrackingSystem, ECSComponent, ECSEventType, ECSFluentAPI, ECSSystem, EVENT_TYPES, Emitter, EnableSoA, Entity, EntityDataCollector, EntityList, EntityManager, EntityProcessorList, EntityQueryBuilder, EntitySystem, EventBus, EventHandler$1 as EventHandler, EventPriority, EventTypeValidator, Float32, Float64, FuncPack, GlobalEventBus, GlobalManager, HighPrecision, IdentifierPool, Int32, IntervalSystem, LogLevel, Logger, LoggerManager, Matcher, NumberExtension, PassiveSystem, PerformanceDataCollector, PerformanceMonitor, PerformanceWarningType, Pool, PoolManager, ProcessingSystem, QuerySystem, SYSTEM_TYPE_NAME, Scene, SceneDataCollector, SerializeMap, SoAStorage, SparseSet, SystemDataCollector, Time, Timer, TimerManager, TypeSafeEventSystem, TypeUtils, WebSocketManager, World, WorldManager, createECSAPI, createLogger, getComponentInstanceTypeName, getComponentTypeName, getSystemInstanceTypeName, getSystemTypeName, resetLoggerColors, setGlobalLogLevel, setLoggerColors };
|
|
7351
|
+
export type { Archetype, ArchetypeQueryResult, BitMask64Data, ComponentType$1 as ComponentType, DirtyData, DirtyListener, EventListenerConfig, EventStats, IComponent, IComponentDebugData, IComponentEventData, IComponentIndex, ICoreConfig, IECSDebugConfig, IECSDebugData, IEntityDebugData, IEntityEventData, IEntityHierarchyNode, IEventBus, IEventData, IEventListenerConfig, IEventStats, ILogger, IPerformanceDebugData, IPerformanceEventData, IPoolable, IScene, ISceneConfig, ISceneDebugData, ISceneEventData, ISceneFactory, ISystemBase, ISystemDebugData, ISystemEventData, ITimer, IWorldConfig, IWorldManagerConfig, IndexStats, LoggerColorConfig, LoggerConfig, PerformanceData, PerformanceStats, PerformanceThresholds, PerformanceWarning, PoolStats };
|