@esengine/ecs-framework 2.2.20 → 2.2.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @esengine/ecs-framework v2.2.20
2
+ * @esengine/ecs-framework v2.2.21
3
3
  * TypeScript definitions
4
4
  */
5
5
  /**
@@ -1323,6 +1323,13 @@ declare class ComponentRegistry {
1323
1323
  private static componentNameToId;
1324
1324
  private static maskCache;
1325
1325
  private static nextBitIndex;
1326
+ /**
1327
+ * 热更新模式标志,默认禁用
1328
+ * Hot reload mode flag, disabled by default
1329
+ * 编辑器环境应启用此选项以支持脚本热更新
1330
+ * Editor environment should enable this to support script hot reload
1331
+ */
1332
+ private static hotReloadEnabled;
1326
1333
  /**
1327
1334
  * 注册组件类型并分配位掩码
1328
1335
  * @param componentType 组件类型
@@ -1402,6 +1409,23 @@ declare class ComponentRegistry {
1402
1409
  * 清除掩码缓存
1403
1410
  */
1404
1411
  static clearMaskCache(): void;
1412
+ /**
1413
+ * 启用热更新模式
1414
+ * Enable hot reload mode
1415
+ * 在编辑器环境中调用以支持脚本热更新
1416
+ * Call in editor environment to support script hot reload
1417
+ */
1418
+ static enableHotReload(): void;
1419
+ /**
1420
+ * 禁用热更新模式
1421
+ * Disable hot reload mode
1422
+ */
1423
+ static disableHotReload(): void;
1424
+ /**
1425
+ * 检查热更新模式是否启用
1426
+ * Check if hot reload mode is enabled
1427
+ */
1428
+ static isHotReloadEnabled(): boolean;
1405
1429
  /**
1406
1430
  * 重置注册表(用于测试)
1407
1431
  */
@@ -4368,12 +4392,17 @@ declare class ComponentSerializer {
4368
4392
  */
4369
4393
  declare class HierarchySystem extends EntitySystem {
4370
4394
  private static readonly MAX_DEPTH;
4395
+ /**
4396
+ * 脏实体集合 - 只有这些实体需要在 process() 中更新缓存
4397
+ * Dirty entity set - only these entities need cache update in process()
4398
+ */
4399
+ private dirtyEntities;
4371
4400
  constructor();
4372
4401
  /**
4373
4402
  * 系统优先级,确保在其他系统之前更新层级缓存
4374
4403
  */
4375
4404
  get updateOrder(): number;
4376
- protected process(): void;
4405
+ protected process(_entities: readonly Entity[]): void;
4377
4406
  /**
4378
4407
  * 设置实体的父级
4379
4408
  *
@@ -4474,17 +4503,24 @@ declare class HierarchySystem extends EntitySystem {
4474
4503
  bIsExpanded: boolean;
4475
4504
  }>;
4476
4505
  /**
4477
- * 标记缓存为脏
4506
+ * 标记缓存为脏,并添加到脏实体集合
4507
+ * Mark cache as dirty and add to dirty entity set
4478
4508
  */
4479
4509
  private markCacheDirty;
4480
4510
  /**
4481
4511
  * 更新层级缓存
4482
4512
  */
4483
4513
  private updateHierarchyCache;
4514
+ /**
4515
+ * 当实体被添加到系统时,将其加入脏集合
4516
+ * When entity is added to system, add it to dirty set
4517
+ */
4518
+ protected onAdded(entity: Entity): void;
4484
4519
  /**
4485
4520
  * 当实体被移除时清理层级关系
4521
+ * When entity is removed, clean up hierarchy relationships
4486
4522
  */
4487
- protected onEntityRemoved(entity: Entity): void;
4523
+ protected onRemoved(entity: Entity): void;
4488
4524
  dispose(): void;
4489
4525
  }
4490
4526
 
@@ -5137,6 +5173,28 @@ declare class Scene implements IScene {
5137
5173
  * 场景是否已开始运行
5138
5174
  */
5139
5175
  private _didSceneBegin;
5176
+ /**
5177
+ * 编辑器模式标志
5178
+ *
5179
+ * 当为 true 时,组件的生命周期回调(如 onAddedToEntity)会被延迟,
5180
+ * 直到调用 begin() 开始运行场景时才会触发。
5181
+ *
5182
+ * Editor mode flag.
5183
+ * When true, component lifecycle callbacks (like onAddedToEntity) are deferred
5184
+ * until begin() is called to start running the scene.
5185
+ */
5186
+ isEditorMode: boolean;
5187
+ /**
5188
+ * 延迟的组件生命周期回调队列
5189
+ *
5190
+ * 在编辑器模式下,组件的 onAddedToEntity 回调会被加入此队列,
5191
+ * 等到 begin() 调用时统一执行。
5192
+ *
5193
+ * Deferred component lifecycle callback queue.
5194
+ * In editor mode, component's onAddedToEntity callbacks are queued here,
5195
+ * and will be executed when begin() is called.
5196
+ */
5197
+ private _deferredComponentCallbacks;
5140
5198
  /**
5141
5199
  * 系统列表缓存
5142
5200
  */
@@ -5275,10 +5333,25 @@ declare class Scene implements IScene {
5275
5333
  * 在场景被销毁时调用,可以在此方法中执行清理工作。
5276
5334
  */
5277
5335
  unload(): void;
5336
+ /**
5337
+ * 添加延迟的组件生命周期回调
5338
+ *
5339
+ * 在编辑器模式下,组件的 onAddedToEntity 回调会通过此方法加入队列。
5340
+ *
5341
+ * Queue a deferred component lifecycle callback.
5342
+ * In editor mode, component's onAddedToEntity callbacks are queued via this method.
5343
+ *
5344
+ * @param callback 要延迟执行的回调 | The callback to defer
5345
+ */
5346
+ queueDeferredComponentCallback(callback: () => void): void;
5278
5347
  /**
5279
5348
  * 开始场景,启动实体处理器等
5280
5349
  *
5281
5350
  * 这个方法会启动场景。它将启动实体处理器等,并调用onStart方法。
5351
+ * 在编辑器模式下,此方法还会执行所有延迟的组件生命周期回调。
5352
+ *
5353
+ * This method starts the scene. It will start entity processors and call onStart.
5354
+ * In editor mode, this method also executes all deferred component lifecycle callbacks.
5282
5355
  */
5283
5356
  begin(): void;
5284
5357
  /**
@@ -6374,6 +6447,17 @@ interface IScene {
6374
6447
  * 场景级别的依赖注入容器,用于管理服务的生命周期。
6375
6448
  */
6376
6449
  readonly services: ServiceContainer;
6450
+ /**
6451
+ * 编辑器模式标志
6452
+ *
6453
+ * 当为 true 时,组件的生命周期回调(如 onAddedToEntity)会被延迟,
6454
+ * 直到调用 begin() 开始运行场景时才会触发。
6455
+ *
6456
+ * Editor mode flag.
6457
+ * When true, component lifecycle callbacks (like onAddedToEntity) are deferred
6458
+ * until begin() is called to start running the scene.
6459
+ */
6460
+ isEditorMode: boolean;
6377
6461
  /**
6378
6462
  * 获取系统列表
6379
6463
  */
@@ -6390,6 +6474,14 @@ interface IScene {
6390
6474
  * 场景卸载时的回调
6391
6475
  */
6392
6476
  unload(): void;
6477
+ /**
6478
+ * 添加延迟的组件生命周期回调
6479
+ *
6480
+ * Queue a deferred component lifecycle callback.
6481
+ *
6482
+ * @param callback 要延迟执行的回调 | The callback to defer
6483
+ */
6484
+ queueDeferredComponentCallback(callback: () => void): void;
6393
6485
  /**
6394
6486
  * 开始场景
6395
6487
  */
@@ -12946,6 +13038,22 @@ declare class PlatformDetector {
12946
13038
  * 检测是否为浏览器环境
12947
13039
  */
12948
13040
  private static isBrowser;
13041
+ /**
13042
+ * 检测是否在 Tauri 桌面环境中运行
13043
+ * Check if running in Tauri desktop environment
13044
+ *
13045
+ * 同时支持 Tauri v1 (__TAURI__) 和 v2 (__TAURI_INTERNALS__)
13046
+ * Supports both Tauri v1 (__TAURI__) and v2 (__TAURI_INTERNALS__)
13047
+ */
13048
+ static isTauriEnvironment(): boolean;
13049
+ /**
13050
+ * 检测是否在编辑器环境中运行
13051
+ * Check if running in editor environment
13052
+ *
13053
+ * 包括 Tauri 桌面应用或带 __ESENGINE_EDITOR__ 标记的环境
13054
+ * Includes Tauri desktop app or environments marked with __ESENGINE_EDITOR__
13055
+ */
13056
+ static isEditorEnvironment(): boolean;
12949
13057
  /**
12950
13058
  * 获取详细的环境信息(用于调试)
12951
13059
  */