@esengine/ecs-framework 2.2.1 → 2.2.3

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.1
2
+ * @esengine/ecs-framework v2.2.3
3
3
  * TypeScript definitions
4
4
  */
5
5
  /**
@@ -4466,17 +4466,17 @@ declare class SceneSerializer {
4466
4466
  *
4467
4467
  * @param scene 要序列化的场景
4468
4468
  * @param options 序列化选项
4469
- * @returns 序列化后的数据(JSON字符串或二进制Buffer
4469
+ * @returns 序列化后的数据(JSON字符串或二进制Uint8Array
4470
4470
  */
4471
- static serialize(scene: IScene, options?: SceneSerializationOptions): string | Buffer;
4471
+ static serialize(scene: IScene, options?: SceneSerializationOptions): string | Uint8Array;
4472
4472
  /**
4473
4473
  * 反序列化场景
4474
4474
  *
4475
4475
  * @param scene 目标场景
4476
- * @param saveData 序列化的数据(JSON字符串或二进制Buffer
4476
+ * @param saveData 序列化的数据(JSON字符串或二进制Uint8Array
4477
4477
  * @param options 反序列化选项
4478
4478
  */
4479
- static deserialize(scene: IScene, saveData: string | Buffer, options?: SceneDeserializationOptions): void;
4479
+ static deserialize(scene: IScene, saveData: string | Uint8Array, options?: SceneDeserializationOptions): void;
4480
4480
  /**
4481
4481
  * 序列化场景自定义数据
4482
4482
  *
@@ -4729,7 +4729,7 @@ declare class IncrementalSerializer {
4729
4729
  *
4730
4730
  * @param incremental 增量快照
4731
4731
  * @param options 序列化选项
4732
- * @returns 序列化后的数据(JSON字符串或二进制Buffer
4732
+ * @returns 序列化后的数据(JSON字符串或二进制Uint8Array
4733
4733
  *
4734
4734
  * @example
4735
4735
  * ```typescript
@@ -4751,11 +4751,11 @@ declare class IncrementalSerializer {
4751
4751
  static serializeIncremental(incremental: IncrementalSnapshot, options?: {
4752
4752
  format?: IncrementalSerializationFormat;
4753
4753
  pretty?: boolean;
4754
- }): string | Buffer;
4754
+ }): string | Uint8Array;
4755
4755
  /**
4756
4756
  * 反序列化增量快照
4757
4757
  *
4758
- * @param data 序列化的数据(JSON字符串或二进制Buffer
4758
+ * @param data 序列化的数据(JSON字符串或二进制Uint8Array
4759
4759
  * @returns 增量快照
4760
4760
  *
4761
4761
  * @example
@@ -4767,7 +4767,7 @@ declare class IncrementalSerializer {
4767
4767
  * const snapshot = IncrementalSerializer.deserializeIncremental(buffer);
4768
4768
  * ```
4769
4769
  */
4770
- static deserializeIncremental(data: string | Buffer): IncrementalSnapshot;
4770
+ static deserializeIncremental(data: string | Uint8Array): IncrementalSnapshot;
4771
4771
  /**
4772
4772
  * 计算增量快照的大小(字节)
4773
4773
  *
@@ -5195,10 +5195,10 @@ declare class Scene implements IScene {
5195
5195
  /**
5196
5196
  * 序列化场景
5197
5197
  *
5198
- * 将场景及其所有实体、组件序列化为JSON字符串或二进制Buffer
5198
+ * 将场景及其所有实体、组件序列化为JSON字符串或二进制Uint8Array
5199
5199
  *
5200
5200
  * @param options 序列化选项
5201
- * @returns 序列化后的数据(JSON字符串或二进制Buffer
5201
+ * @returns 序列化后的数据(JSON字符串或二进制Uint8Array
5202
5202
  *
5203
5203
  * @example
5204
5204
  * ```typescript
@@ -5214,13 +5214,13 @@ declare class Scene implements IScene {
5214
5214
  * });
5215
5215
  * ```
5216
5216
  */
5217
- serialize(options?: SceneSerializationOptions): string | Buffer;
5217
+ serialize(options?: SceneSerializationOptions): string | Uint8Array;
5218
5218
  /**
5219
5219
  * 反序列化场景
5220
5220
  *
5221
5221
  * 从序列化数据恢复场景状态
5222
5222
  *
5223
- * @param saveData 序列化的数据(JSON字符串或二进制Buffer
5223
+ * @param saveData 序列化的数据(JSON字符串或二进制Uint8Array
5224
5224
  * @param options 反序列化选项
5225
5225
  *
5226
5226
  * @example
@@ -5236,7 +5236,7 @@ declare class Scene implements IScene {
5236
5236
  * });
5237
5237
  * ```
5238
5238
  */
5239
- deserialize(saveData: string | Buffer, options?: SceneDeserializationOptions): void;
5239
+ deserialize(saveData: string | Uint8Array, options?: SceneDeserializationOptions): void;
5240
5240
  /** 增量序列化的基础快照 */
5241
5241
  private _incrementalBaseSnapshot?;
5242
5242
  /**
@@ -5288,7 +5288,7 @@ declare class Scene implements IScene {
5288
5288
  /**
5289
5289
  * 应用增量变更到场景
5290
5290
  *
5291
- * @param incremental 增量快照数据(IncrementalSnapshot对象、JSON字符串或二进制Buffer
5291
+ * @param incremental 增量快照数据(IncrementalSnapshot对象、JSON字符串或二进制Uint8Array
5292
5292
  * @param componentRegistry 组件类型注册表(可选,默认使用全局注册表)
5293
5293
  *
5294
5294
  * @example
@@ -5300,12 +5300,12 @@ declare class Scene implements IScene {
5300
5300
  * const jsonData = IncrementalSerializer.serializeIncremental(snapshot, { format: 'json' });
5301
5301
  * scene.applyIncremental(jsonData);
5302
5302
  *
5303
- * // 从二进制Buffer应用
5303
+ * // 从二进制Uint8Array应用
5304
5304
  * const binaryData = IncrementalSerializer.serializeIncremental(snapshot, { format: 'binary' });
5305
5305
  * scene.applyIncremental(binaryData);
5306
5306
  * ```
5307
5307
  */
5308
- applyIncremental(incremental: IncrementalSnapshot | string | Buffer, componentRegistry?: Map<string, any>): void;
5308
+ applyIncremental(incremental: IncrementalSnapshot | string | Uint8Array, componentRegistry?: Map<string, any>): void;
5309
5309
  /**
5310
5310
  * 更新增量快照基准
5311
5311
  *
@@ -7461,9 +7461,9 @@ declare function createECSAPI(scene: IScene, querySystem: QuerySystem, eventSyst
7461
7461
  */
7462
7462
  declare class SceneManager implements IService {
7463
7463
  /**
7464
- * 当前活跃场景
7464
+ * 内部默认World
7465
7465
  */
7466
- private _currentScene;
7466
+ private _defaultWorld;
7467
7467
  /**
7468
7468
  * 待切换的下一个场景(延迟切换用)
7469
7469
  */
@@ -7480,6 +7480,11 @@ declare class SceneManager implements IService {
7480
7480
  * 场景切换回调函数
7481
7481
  */
7482
7482
  private _onSceneChangedCallback?;
7483
+ /**
7484
+ * 默认场景ID
7485
+ */
7486
+ private static readonly DEFAULT_SCENE_ID;
7487
+ constructor();
7483
7488
  /**
7484
7489
  * 设置场景切换回调
7485
7490
  *
@@ -7688,6 +7693,10 @@ declare class World {
7688
7693
  * 获取所有Scene
7689
7694
  */
7690
7695
  getAllScenes(): IScene[];
7696
+ /**
7697
+ * 移除所有Scene
7698
+ */
7699
+ removeAllScenes(): void;
7691
7700
  /**
7692
7701
  * 设置Scene激活状态
7693
7702
  */
@@ -9396,6 +9405,24 @@ declare class Core {
9396
9405
  * ```
9397
9406
  */
9398
9407
  static get services(): ServiceContainer;
9408
+ /**
9409
+ * 获取World管理器
9410
+ *
9411
+ * 用于管理多个独立的World实例(高级用户)。
9412
+ *
9413
+ * @returns WorldManager实例
9414
+ * @throws 如果Core实例未创建
9415
+ *
9416
+ * @example
9417
+ * ```typescript
9418
+ * // 创建多个游戏房间
9419
+ * const wm = Core.worldManager;
9420
+ * const room1 = wm.createWorld('room_001');
9421
+ * room1.createScene('game', new GameScene());
9422
+ * room1.start();
9423
+ * ```
9424
+ */
9425
+ static get worldManager(): WorldManager;
9399
9426
  /**
9400
9427
  * 创建Core实例
9401
9428
  *