@esengine/ecs-framework 2.4.1 → 2.4.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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @esengine/ecs-framework v2.4.1
2
+ * @esengine/ecs-framework v2.4.3
3
3
  * TypeScript definitions
4
4
  */
5
5
  /**
@@ -233,6 +233,125 @@ type IUpdatable = {
233
233
  update(deltaTime?: number): void;
234
234
  };
235
235
 
236
+ /**
237
+ * @zh 全局类型声明 - 用于减少 as any 的使用
238
+ * @en Global type declarations - to reduce as any usage
239
+ */
240
+ /**
241
+ * @zh 小游戏平台基础 API 接口
242
+ * @en Base interface for mini-game platform APIs
243
+ */
244
+ interface IMiniGamePlatformAPI {
245
+ getSystemInfo?: (options?: {
246
+ success?: (res: unknown) => void;
247
+ }) => void;
248
+ getSystemInfoSync?: () => Record<string, unknown>;
249
+ createCanvas?: () => HTMLCanvasElement;
250
+ createImage?: () => HTMLImageElement;
251
+ }
252
+ /**
253
+ * @zh 微信小游戏 API
254
+ * @en WeChat Mini Game API
255
+ */
256
+ interface IWeChatMiniGameAPI extends IMiniGamePlatformAPI {
257
+ env?: {
258
+ USER_DATA_PATH?: string;
259
+ };
260
+ getFileSystemManager?: () => unknown;
261
+ createInnerAudioContext?: () => unknown;
262
+ }
263
+ /**
264
+ * @zh 字节跳动小游戏 API
265
+ * @en ByteDance Mini Game API
266
+ */
267
+ type IByteDanceMiniGameAPI = IMiniGamePlatformAPI;
268
+ /**
269
+ * @zh 支付宝小游戏 API
270
+ * @en Alipay Mini Game API
271
+ */
272
+ type IAlipayMiniGameAPI = IMiniGamePlatformAPI;
273
+ /**
274
+ * @zh 百度小游戏 API
275
+ * @en Baidu Mini Game API
276
+ */
277
+ type IBaiduMiniGameAPI = IMiniGamePlatformAPI;
278
+ /**
279
+ * @zh 扩展的 globalThis 类型,包含小游戏平台
280
+ * @en Extended globalThis type with mini-game platforms
281
+ */
282
+ interface IGlobalThisWithMiniGame {
283
+ wx?: IWeChatMiniGameAPI;
284
+ tt?: IByteDanceMiniGameAPI;
285
+ my?: IAlipayMiniGameAPI;
286
+ swan?: IBaiduMiniGameAPI;
287
+ }
288
+ /**
289
+ * @zh Chrome 内存信息接口
290
+ * @en Chrome memory info interface
291
+ */
292
+ interface IChromeMemoryInfo {
293
+ jsHeapSizeLimit: number;
294
+ totalJSHeapSize: number;
295
+ usedJSHeapSize: number;
296
+ }
297
+ /**
298
+ * @zh 扩展的 Performance 接口,包含 Chrome 特有 API
299
+ * @en Extended Performance interface with Chrome-specific APIs
300
+ */
301
+ interface IPerformanceWithMemory extends Performance {
302
+ memory?: IChromeMemoryInfo;
303
+ measureUserAgentSpecificMemory?: () => Promise<{
304
+ bytes: number;
305
+ breakdown: Array<{
306
+ bytes: number;
307
+ types: string[];
308
+ attribution: Array<{
309
+ scope: string;
310
+ container?: unknown;
311
+ }>;
312
+ }>;
313
+ }>;
314
+ }
315
+ /**
316
+ * @zh SoA 组件类型元数据接口
317
+ * @en SoA component type metadata interface
318
+ *
319
+ * @zh 用于 SoA 存储装饰器附加的元数据
320
+ * @en Used for metadata attached by SoA storage decorators
321
+ */
322
+ interface IComponentTypeMetadata {
323
+ __enableSoA?: boolean;
324
+ __float64Fields?: Set<string>;
325
+ __float32Fields?: Set<string>;
326
+ __int32Fields?: Set<string>;
327
+ __uint32Fields?: Set<string>;
328
+ __int16Fields?: Set<string>;
329
+ __uint16Fields?: Set<string>;
330
+ __int8Fields?: Set<string>;
331
+ __uint8Fields?: Set<string>;
332
+ __uint8ClampedFields?: Set<string>;
333
+ __highPrecisionFields?: Set<string>;
334
+ __serializeMapFields?: Set<string>;
335
+ __serializeSetFields?: Set<string>;
336
+ __serializeArrayFields?: Set<string>;
337
+ __deepCopyFields?: Set<string>;
338
+ }
339
+ /**
340
+ * @zh 带元数据的组件构造函数类型
341
+ * @en Component constructor type with metadata
342
+ */
343
+ type ComponentTypeWithMetadata<T> = (new () => T) & IComponentTypeMetadata;
344
+ /**
345
+ * @zh 获取全局小游戏平台对象
346
+ * @en Get global mini-game platform objects
347
+ */
348
+ declare function getGlobalWithMiniGame(): IGlobalThisWithMiniGame;
349
+ /**
350
+ * @zh 获取带内存 API 的 performance 对象
351
+ * @en Get performance object with memory API
352
+ */
353
+ declare function getPerformanceWithMemory(): IPerformanceWithMemory;
354
+
236
355
  /**
237
356
  * 框架核心类型定义
238
357
  */
@@ -705,13 +824,17 @@ type ISceneDebugData = {
705
824
  };
706
825
 
707
826
  /**
708
- * 游戏组件基类
827
+ * @zh 游戏组件基类
828
+ * @en Base class for game components
709
829
  *
710
- * ECS架构中的组件(Component)应该是纯数据容器。
830
+ * @zh ECS架构中的组件(Component)应该是纯数据容器。
711
831
  * 所有游戏逻辑应该在 EntitySystem 中实现,而不是在组件内部。
832
+ * @en Components in ECS architecture should be pure data containers.
833
+ * All game logic should be implemented in EntitySystem, not inside components.
712
834
  *
713
835
  * @example
714
- * 推荐做法:纯数据组件
836
+ * @zh 推荐做法:纯数据组件
837
+ * @en Recommended: Pure data component
715
838
  * ```typescript
716
839
  * class HealthComponent extends Component {
717
840
  * public health: number = 100;
@@ -720,7 +843,8 @@ type ISceneDebugData = {
720
843
  * ```
721
844
  *
722
845
  * @example
723
- * 推荐做法:在 System 中处理逻辑
846
+ * @zh 推荐做法:在 System 中处理逻辑
847
+ * @en Recommended: Handle logic in System
724
848
  * ```typescript
725
849
  * class HealthSystem extends EntitySystem {
726
850
  * process(entities: Entity[]): void {
@@ -736,97 +860,94 @@ type ISceneDebugData = {
736
860
  */
737
861
  declare abstract class Component implements IComponent {
738
862
  /**
739
- * 组件ID生成器
740
- *
741
- * 用于为每个组件分配唯一的ID。
742
- *
743
- * Component ID generator.
744
- * Used to assign unique IDs to each component.
863
+ * @zh 组件ID生成器,用于为每个组件分配唯一的ID
864
+ * @en Component ID generator, used to assign unique IDs to each component
745
865
  */
746
- private static idGenerator;
866
+ private static _idGenerator;
747
867
  /**
748
- * 组件唯一标识符
749
- *
750
- * 在整个游戏生命周期中唯一的数字ID。
868
+ * @zh 组件唯一标识符,在整个游戏生命周期中唯一
869
+ * @en Unique identifier for the component, unique throughout the game lifecycle
751
870
  */
752
871
  readonly id: number;
753
872
  /**
754
- * 所属实体ID
873
+ * @zh 所属实体ID
874
+ * @en Owner entity ID
755
875
  *
756
- * 存储实体ID而非引用,避免循环引用,符合ECS数据导向设计。
876
+ * @zh 存储实体ID而非引用,避免循环引用,符合ECS数据导向设计
877
+ * @en Stores entity ID instead of reference to avoid circular references, following ECS data-oriented design
757
878
  */
758
879
  entityId: number | null;
759
880
  /**
760
- * 最后写入的 epoch
761
- *
762
- * 用于帧级变更检测,记录组件最后一次被修改时的 epoch。
763
- * 0 表示从未被标记为已修改。
881
+ * @zh 最后写入的 epoch,用于帧级变更检测
882
+ * @en Last write epoch, used for frame-level change detection
764
883
  *
765
- * Last write epoch.
766
- * Used for frame-level change detection, records the epoch when component was last modified.
767
- * 0 means never marked as modified.
884
+ * @zh 记录组件最后一次被修改时的 epoch,0 表示从未被标记为已修改
885
+ * @en Records the epoch when component was last modified, 0 means never marked as modified
768
886
  */
769
887
  private _lastWriteEpoch;
770
888
  /**
771
- * 获取最后写入的 epoch
772
- *
773
- * Get last write epoch.
889
+ * @zh 获取最后写入的 epoch
890
+ * @en Get last write epoch
774
891
  */
775
892
  get lastWriteEpoch(): number;
776
893
  /**
777
- * 创建组件实例
778
- *
779
- * 自动分配唯一ID给组件。
894
+ * @zh 创建组件实例,自动分配唯一ID
895
+ * @en Create component instance, automatically assigns unique ID
780
896
  */
781
897
  constructor();
782
898
  /**
783
- * 标记组件为已修改
899
+ * @zh 标记组件为已修改
900
+ * @en Mark component as modified
784
901
  *
785
- * 调用此方法会更新组件的 lastWriteEpoch 为当前帧的 epoch。
902
+ * @zh 调用此方法会更新组件的 lastWriteEpoch 为当前帧的 epoch。
786
903
  * 系统可以通过比较 lastWriteEpoch 和上次检查的 epoch 来判断组件是否发生变更。
787
- *
788
- * Mark component as modified.
789
- * Calling this method updates the component's lastWriteEpoch to the current frame's epoch.
904
+ * @en Calling this method updates the component's lastWriteEpoch to the current frame's epoch.
790
905
  * Systems can compare lastWriteEpoch with their last checked epoch to detect changes.
791
906
  *
792
- * @param epoch 当前帧的 epoch | Current frame's epoch
907
+ * @param epoch - @zh 当前帧的 epoch @en Current frame's epoch
793
908
  *
794
909
  * @example
795
910
  * ```typescript
796
- * // 在修改组件数据后调用
911
+ * // @zh 在修改组件数据后调用 | @en Call after modifying component data
797
912
  * velocity.x = 10;
798
913
  * velocity.markDirty(scene.epochManager.current);
799
914
  * ```
800
915
  */
801
916
  markDirty(epoch: number): void;
802
917
  /**
803
- * 组件添加到实体时的回调
804
- *
805
- * 当组件被添加到实体时调用,可以在此方法中进行初始化操作。
918
+ * @zh 组件添加到实体时的回调
919
+ * @en Callback when component is added to an entity
806
920
  *
807
- * @remarks
921
+ * @zh 当组件被添加到实体时调用,可以在此方法中进行初始化操作。
808
922
  * 这是一个生命周期钩子,用于组件的初始化逻辑。
809
923
  * 虽然保留此方法,但建议将复杂的初始化逻辑放在 System 中处理。
924
+ * @en Called when component is added to an entity, can perform initialization here.
925
+ * This is a lifecycle hook for component initialization logic.
926
+ * While this method is available, complex initialization logic should be handled in System.
810
927
  */
811
928
  onAddedToEntity(): void;
812
929
  /**
813
- * 组件从实体移除时的回调
930
+ * @zh 组件从实体移除时的回调
931
+ * @en Callback when component is removed from an entity
814
932
  *
815
- * 当组件从实体中移除时调用,可以在此方法中进行清理操作。
816
- *
817
- * @remarks
933
+ * @zh 当组件从实体中移除时调用,可以在此方法中进行清理操作。
818
934
  * 这是一个生命周期钩子,用于组件的清理逻辑。
819
935
  * 虽然保留此方法,但建议将复杂的清理逻辑放在 System 中处理。
936
+ * @en Called when component is removed from an entity, can perform cleanup here.
937
+ * This is a lifecycle hook for component cleanup logic.
938
+ * While this method is available, complex cleanup logic should be handled in System.
820
939
  */
821
940
  onRemovedFromEntity(): void;
822
941
  /**
823
- * 组件反序列化后的回调
824
- *
825
- * 当组件从场景文件加载或快照恢复后调用,可以在此方法中恢复运行时数据。
942
+ * @zh 组件反序列化后的回调
943
+ * @en Callback after component deserialization
826
944
  *
827
- * @remarks
945
+ * @zh 当组件从场景文件加载或快照恢复后调用,可以在此方法中恢复运行时数据。
828
946
  * 这是一个生命周期钩子,用于恢复无法序列化的运行时数据。
829
947
  * 例如:从图片路径重新加载图片尺寸信息,重建缓存等。
948
+ * @en Called after component is loaded from scene file or restored from snapshot.
949
+ * This is a lifecycle hook for restoring runtime data that cannot be serialized.
950
+ * For example: reloading image dimensions from image path, rebuilding caches, etc.
830
951
  *
831
952
  * @example
832
953
  * ```typescript
@@ -836,7 +957,8 @@ declare abstract class Component implements IComponent {
836
957
  *
837
958
  * public async onDeserialized(): Promise<void> {
838
959
  * if (this.tilesetImage) {
839
- * // 重新加载 tileset 图片并恢复运行时数据
960
+ * // @zh 重新加载 tileset 图片并恢复运行时数据
961
+ * // @en Reload tileset image and restore runtime data
840
962
  * const img = await loadImage(this.tilesetImage);
841
963
  * this.setTilesetInfo(img.width, img.height, ...);
842
964
  * }
@@ -997,75 +1119,99 @@ declare class BitMask64Utils {
997
1119
  type SupportedTypedArray = Float32Array | Float64Array | Int32Array | Uint32Array | Int16Array | Uint16Array | Int8Array | Uint8Array | Uint8ClampedArray;
998
1120
 
999
1121
  /**
1000
- * 启用SoA优化装饰器
1001
- * 默认关闭SoA,只有在大规模批量操作场景下才建议开启
1122
+ * @zh SoA 字段统计信息
1123
+ * @en SoA field statistics
1124
+ */
1125
+ interface ISoAFieldStats {
1126
+ size: number;
1127
+ capacity: number;
1128
+ type: string;
1129
+ memory: number;
1130
+ }
1131
+ /**
1132
+ * @zh SoA 存储统计信息
1133
+ * @en SoA storage statistics
1134
+ */
1135
+ interface ISoAStorageStats {
1136
+ size: number;
1137
+ capacity: number;
1138
+ totalSlots: number;
1139
+ usedSlots: number;
1140
+ freeSlots: number;
1141
+ fragmentation: number;
1142
+ memoryUsage: number;
1143
+ fieldStats: Map<string, ISoAFieldStats>;
1144
+ }
1145
+ /**
1146
+ * @zh 启用 SoA 优化装饰器 - 默认关闭,只在大规模批量操作场景下建议开启
1147
+ * @en Enable SoA optimization decorator - disabled by default, recommended only for large-scale batch operations
1002
1148
  */
1003
1149
  declare function EnableSoA<T extends ComponentType>(target: T): T;
1004
1150
  /**
1005
- * 64位浮点数装饰器
1006
- * 标记字段使用Float64Array存储(更高精度但更多内存)
1151
+ * @zh 64位浮点数装饰器 - 标记字段使用 Float64Array 存储(更高精度但更多内存)
1152
+ * @en Float64 decorator - marks field to use Float64Array storage (higher precision but more memory)
1007
1153
  */
1008
- declare function Float64(target: any, propertyKey: string | symbol): void;
1154
+ declare function Float64(target: object, propertyKey: string | symbol): void;
1009
1155
  /**
1010
- * 32位浮点数装饰器
1011
- * 标记字段使用Float32Array存储(默认类型,平衡性能和精度)
1156
+ * @zh 32位浮点数装饰器 - 标记字段使用 Float32Array 存储(默认类型,平衡性能和精度)
1157
+ * @en Float32 decorator - marks field to use Float32Array storage (default, balanced performance and precision)
1012
1158
  */
1013
- declare function Float32(target: any, propertyKey: string | symbol): void;
1159
+ declare function Float32(target: object, propertyKey: string | symbol): void;
1014
1160
  /**
1015
- * 32位整数装饰器
1016
- * 标记字段使用Int32Array存储(适用于整数值)
1161
+ * @zh 32位整数装饰器 - 标记字段使用 Int32Array 存储(适用于整数值)
1162
+ * @en Int32 decorator - marks field to use Int32Array storage (for integer values)
1017
1163
  */
1018
- declare function Int32(target: any, propertyKey: string | symbol): void;
1164
+ declare function Int32(target: object, propertyKey: string | symbol): void;
1019
1165
  /**
1020
- * 32位无符号整数装饰器
1021
- * 标记字段使用Uint32Array存储(适用于无符号整数,如ID、标志位等)
1166
+ * @zh 32位无符号整数装饰器 - 标记字段使用 Uint32Array 存储
1167
+ * @en Uint32 decorator - marks field to use Uint32Array storage
1022
1168
  */
1023
- declare function Uint32(target: any, propertyKey: string | symbol): void;
1169
+ declare function Uint32(target: object, propertyKey: string | symbol): void;
1024
1170
  /**
1025
- * 16位整数装饰器
1026
- * 标记字段使用Int16Array存储(适用于小范围整数)
1171
+ * @zh 16位整数装饰器 - 标记字段使用 Int16Array 存储
1172
+ * @en Int16 decorator - marks field to use Int16Array storage
1027
1173
  */
1028
- declare function Int16(target: any, propertyKey: string | symbol): void;
1174
+ declare function Int16(target: object, propertyKey: string | symbol): void;
1029
1175
  /**
1030
- * 16位无符号整数装饰器
1031
- * 标记字段使用Uint16Array存储(适用于小范围无符号整数)
1176
+ * @zh 16位无符号整数装饰器 - 标记字段使用 Uint16Array 存储
1177
+ * @en Uint16 decorator - marks field to use Uint16Array storage
1032
1178
  */
1033
- declare function Uint16(target: any, propertyKey: string | symbol): void;
1179
+ declare function Uint16(target: object, propertyKey: string | symbol): void;
1034
1180
  /**
1035
- * 8位整数装饰器
1036
- * 标记字段使用Int8Array存储(适用于很小的整数值)
1181
+ * @zh 8位整数装饰器 - 标记字段使用 Int8Array 存储
1182
+ * @en Int8 decorator - marks field to use Int8Array storage
1037
1183
  */
1038
- declare function Int8(target: any, propertyKey: string | symbol): void;
1184
+ declare function Int8(target: object, propertyKey: string | symbol): void;
1039
1185
  /**
1040
- * 8位无符号整数装饰器
1041
- * 标记字段使用Uint8Array存储(适用于字节值、布尔标志等)
1186
+ * @zh 8位无符号整数装饰器 - 标记字段使用 Uint8Array 存储
1187
+ * @en Uint8 decorator - marks field to use Uint8Array storage
1042
1188
  */
1043
- declare function Uint8(target: any, propertyKey: string | symbol): void;
1189
+ declare function Uint8(target: object, propertyKey: string | symbol): void;
1044
1190
  /**
1045
- * 8位夹紧整数装饰器
1046
- * 标记字段使用Uint8ClampedArray存储(适用于颜色值等需要夹紧的数据)
1191
+ * @zh 8位夹紧整数装饰器 - 标记字段使用 Uint8ClampedArray 存储(适用于颜色值)
1192
+ * @en Uint8Clamped decorator - marks field to use Uint8ClampedArray storage (for color values)
1047
1193
  */
1048
- declare function Uint8Clamped(target: any, propertyKey: string | symbol): void;
1194
+ declare function Uint8Clamped(target: object, propertyKey: string | symbol): void;
1049
1195
  /**
1050
- * 序列化Map装饰器
1051
- * 标记Map字段需要序列化/反序列化存储
1196
+ * @zh 序列化 Map 装饰器 - 标记 Map 字段需要序列化/反序列化存储
1197
+ * @en SerializeMap decorator - marks Map field for serialization/deserialization
1052
1198
  */
1053
- declare function SerializeMap(target: any, propertyKey: string | symbol): void;
1199
+ declare function SerializeMap(target: object, propertyKey: string | symbol): void;
1054
1200
  /**
1055
- * 序列化Set装饰器
1056
- * 标记Set字段需要序列化/反序列化存储
1201
+ * @zh 序列化 Set 装饰器 - 标记 Set 字段需要序列化/反序列化存储
1202
+ * @en SerializeSet decorator - marks Set field for serialization/deserialization
1057
1203
  */
1058
- declare function SerializeSet(target: any, propertyKey: string | symbol): void;
1204
+ declare function SerializeSet(target: object, propertyKey: string | symbol): void;
1059
1205
  /**
1060
- * 序列化Array装饰器
1061
- * 标记Array字段需要序列化/反序列化存储
1206
+ * @zh 序列化 Array 装饰器 - 标记 Array 字段需要序列化/反序列化存储
1207
+ * @en SerializeArray decorator - marks Array field for serialization/deserialization
1062
1208
  */
1063
- declare function SerializeArray(target: any, propertyKey: string | symbol): void;
1209
+ declare function SerializeArray(target: object, propertyKey: string | symbol): void;
1064
1210
  /**
1065
- * 深拷贝装饰器
1066
- * 标记字段需要深拷贝处理(适用于嵌套对象)
1211
+ * @zh 深拷贝装饰器 - 标记字段需要深拷贝处理(适用于嵌套对象)
1212
+ * @en DeepCopy decorator - marks field for deep copy handling (for nested objects)
1067
1213
  */
1068
- declare function DeepCopy(target: any, propertyKey: string | symbol): void;
1214
+ declare function DeepCopy(target: object, propertyKey: string | symbol): void;
1069
1215
  /**
1070
1216
  * SoA存储器(需要装饰器启用)
1071
1217
  * 使用Structure of Arrays存储模式,在大规模批量操作时提供优异性能
@@ -1096,7 +1242,8 @@ declare class SoAStorage<T extends Component> {
1096
1242
  */
1097
1243
  private createProxyView;
1098
1244
  /**
1099
- * 获取组件的快照副本(用于序列化等需要独立副本的场景)
1245
+ * @zh 获取组件的快照副本(用于序列化等需要独立副本的场景)
1246
+ * @en Get a snapshot copy of the component (for serialization scenarios)
1100
1247
  */
1101
1248
  getComponentSnapshot(entityId: number): T | null;
1102
1249
  private getFieldType;
@@ -1111,7 +1258,11 @@ declare class SoAStorage<T extends Component> {
1111
1258
  size(): number;
1112
1259
  clear(): void;
1113
1260
  compact(): void;
1114
- getStats(): any;
1261
+ /**
1262
+ * @zh 获取 SoA 存储统计信息
1263
+ * @en Get SoA storage statistics
1264
+ */
1265
+ getStats(): ISoAStorageStats;
1115
1266
  /**
1116
1267
  * 执行向量化批量操作
1117
1268
  * @param operation 操作函数,接收字段数组和活跃索引
@@ -1569,6 +1720,13 @@ declare class PerformanceMonitor implements IService {
1569
1720
  private _isEnabled;
1570
1721
  private _maxRecentSamples;
1571
1722
  constructor();
1723
+ /**
1724
+ * @zh 更新FPS统计(可选功能,子类可重写)
1725
+ * @en Update FPS statistics (optional, can be overridden by subclasses)
1726
+ *
1727
+ * @param _deltaTime - @zh 帧时间间隔(秒)@en Frame delta time in seconds
1728
+ */
1729
+ updateFPS(_deltaTime: number): void;
1572
1730
  /**
1573
1731
  * 启用性能监控
1574
1732
  */
@@ -4877,184 +5035,251 @@ declare class SceneSerializer {
4877
5035
  }
4878
5036
 
4879
5037
  /**
4880
- * 增量序列化器
5038
+ * @zh 增量序列化器
5039
+ * @en Incremental Serializer
4881
5040
  *
4882
- * 提供高性能的增量序列化支持,只序列化变更的数据
4883
- * 适用于网络同步、大场景存档、时间回溯等场景
5041
+ * @zh 提供高性能的增量序列化支持,只序列化变更的数据。
5042
+ * 适用于网络同步、大场景存档、时间回溯等场景。
5043
+ * @en Provides high-performance incremental serialization, serializing only changed data.
5044
+ * Suitable for network sync, large scene archiving, and time rewind scenarios.
4884
5045
  */
4885
5046
 
4886
5047
  /**
4887
- * 变更操作类型
5048
+ * @zh 变更操作类型
5049
+ * @en Change operation type
4888
5050
  */
4889
5051
  declare enum ChangeOperation {
4890
- /** 添加新实体 */
5052
+ /** @zh 添加新实体 @en Entity added */
4891
5053
  EntityAdded = "entity_added",
4892
- /** 删除实体 */
5054
+ /** @zh 删除实体 @en Entity removed */
4893
5055
  EntityRemoved = "entity_removed",
4894
- /** 实体属性更新 */
5056
+ /** @zh 实体属性更新 @en Entity updated */
4895
5057
  EntityUpdated = "entity_updated",
4896
- /** 添加组件 */
5058
+ /** @zh 添加组件 @en Component added */
4897
5059
  ComponentAdded = "component_added",
4898
- /** 删除组件 */
5060
+ /** @zh 删除组件 @en Component removed */
4899
5061
  ComponentRemoved = "component_removed",
4900
- /** 组件数据更新 */
5062
+ /** @zh 组件数据更新 @en Component updated */
4901
5063
  ComponentUpdated = "component_updated",
4902
- /** 场景数据更新 */
5064
+ /** @zh 场景数据更新 @en Scene data updated */
4903
5065
  SceneDataUpdated = "scene_data_updated"
4904
5066
  }
4905
5067
  /**
4906
- * 实体变更记录
4907
- */
4908
- type EntityChange = {
4909
- /** 操作类型 */
4910
- operation: ChangeOperation;
4911
- /** 实体ID */
4912
- entityId: number;
4913
- /** 实体名称(用于Added操作) */
4914
- entityName?: string;
4915
- /** 实体数据(用于Added/Updated操作) */
4916
- entityData?: Partial<SerializedEntity>;
4917
- };
4918
- /**
4919
- * 组件变更记录
5068
+ * @zh 实体变更记录
5069
+ * @en Entity change record
4920
5070
  */
4921
- type ComponentChange = {
4922
- /** 操作类型 */
4923
- operation: ChangeOperation;
4924
- /** 实体ID */
4925
- entityId: number;
4926
- /** 组件类型名称 */
4927
- componentType: string;
4928
- /** 组件数据(用于Added/Updated操作) */
4929
- componentData?: SerializedComponent;
4930
- };
5071
+ interface EntityChange {
5072
+ /** @zh 操作类型 @en Operation type */
5073
+ readonly operation: ChangeOperation;
5074
+ /** @zh 实体ID @en Entity ID */
5075
+ readonly entityId: number;
5076
+ /** @zh 实体名称(用于Added操作)@en Entity name (for Added operation) */
5077
+ readonly entityName?: string;
5078
+ /** @zh 实体数据(用于Added/Updated操作)@en Entity data (for Added/Updated operation) */
5079
+ readonly entityData?: Partial<SerializedEntity>;
5080
+ }
4931
5081
  /**
4932
- * 场景数据变更记录
5082
+ * @zh 组件变更记录
5083
+ * @en Component change record
4933
5084
  */
4934
- type SceneDataChange = {
4935
- /** 操作类型 */
4936
- operation: ChangeOperation;
4937
- /** 变更的键 */
4938
- key: string;
4939
- /** 新值 */
4940
- value: any;
4941
- /** 是否删除 */
4942
- deleted?: boolean;
4943
- };
5085
+ interface ComponentChange {
5086
+ /** @zh 操作类型 @en Operation type */
5087
+ readonly operation: ChangeOperation;
5088
+ /** @zh 实体ID @en Entity ID */
5089
+ readonly entityId: number;
5090
+ /** @zh 组件类型名称 @en Component type name */
5091
+ readonly componentType: string;
5092
+ /** @zh 组件数据(用于Added/Updated操作)@en Component data (for Added/Updated operation) */
5093
+ readonly componentData?: SerializedComponent;
5094
+ }
4944
5095
  /**
4945
- * 增量序列化数据
5096
+ * @zh 场景数据变更记录
5097
+ * @en Scene data change record
4946
5098
  */
4947
- type IncrementalSnapshot = {
4948
- /** 快照版本号 */
4949
- version: number;
4950
- /** 时间戳 */
4951
- timestamp: number;
4952
- /** 场景名称 */
4953
- sceneName: string;
4954
- /** 基础版本号(相对于哪个快照的增量) */
4955
- baseVersion: number;
4956
- /** 实体变更列表 */
4957
- entityChanges: EntityChange[];
4958
- /** 组件变更列表 */
4959
- componentChanges: ComponentChange[];
4960
- /** 场景数据变更列表 */
4961
- sceneDataChanges: SceneDataChange[];
4962
- };
5099
+ interface SceneDataChange {
5100
+ /** @zh 操作类型 @en Operation type */
5101
+ readonly operation: ChangeOperation;
5102
+ /** @zh 变更的键 @en Changed key */
5103
+ readonly key: string;
5104
+ /** @zh 新值 @en New value */
5105
+ readonly value: unknown;
5106
+ /** @zh 是否删除 @en Whether deleted */
5107
+ readonly deleted?: boolean;
5108
+ }
5109
+ /**
5110
+ * @zh 增量序列化数据
5111
+ * @en Incremental snapshot data
5112
+ */
5113
+ interface IncrementalSnapshot {
5114
+ /** @zh 快照版本号 @en Snapshot version */
5115
+ readonly version: number;
5116
+ /** @zh 时间戳 @en Timestamp */
5117
+ readonly timestamp: number;
5118
+ /** @zh 场景名称 @en Scene name */
5119
+ readonly sceneName: string;
5120
+ /** @zh 基础版本号(相对于哪个快照的增量)@en Base version (incremental from which snapshot) */
5121
+ readonly baseVersion: number;
5122
+ /** @zh 实体变更列表 @en Entity changes list */
5123
+ readonly entityChanges: EntityChange[];
5124
+ /** @zh 组件变更列表 @en Component changes list */
5125
+ readonly componentChanges: ComponentChange[];
5126
+ /** @zh 场景数据变更列表 @en Scene data changes list */
5127
+ readonly sceneDataChanges: SceneDataChange[];
5128
+ }
5129
+ /**
5130
+ * @zh 实体快照数据
5131
+ * @en Entity snapshot data
5132
+ */
5133
+ interface EntitySnapshotData {
5134
+ readonly name: string;
5135
+ readonly tag: number;
5136
+ readonly active: boolean;
5137
+ readonly enabled: boolean;
5138
+ readonly updateOrder: number;
5139
+ readonly parentId?: number;
5140
+ }
4963
5141
  /**
4964
- * 场景快照(用于对比)
5142
+ * @zh 场景快照(用于对比)
5143
+ * @en Scene snapshot (for comparison)
4965
5144
  */
4966
5145
  interface SceneSnapshot {
4967
- /** 快照版本号 */
4968
- version: number;
4969
- /** 实体ID集合 */
4970
- entityIds: Set<number>;
4971
- /** 实体数据映射 */
4972
- entities: Map<number, {
4973
- name: string;
4974
- tag: number;
4975
- active: boolean;
4976
- enabled: boolean;
4977
- updateOrder: number;
4978
- parentId?: number;
4979
- }>;
4980
- /** 组件数据映射 (entityId -> componentType -> serializedData) */
4981
- components: Map<number, Map<string, string>>;
4982
- /** 场景自定义数据 */
4983
- sceneData: Map<string, string>;
5146
+ /** @zh 快照版本号 @en Snapshot version */
5147
+ readonly version: number;
5148
+ /** @zh 实体ID集合 @en Entity ID set */
5149
+ readonly entityIds: Set<number>;
5150
+ /** @zh 实体数据映射 @en Entity data map */
5151
+ readonly entities: Map<number, EntitySnapshotData>;
5152
+ /** @zh 组件数据映射 (entityId -> componentType -> serializedData JSON) @en Component data map */
5153
+ readonly components: Map<number, Map<string, string>>;
5154
+ /** @zh 场景自定义数据 @en Scene custom data */
5155
+ readonly sceneData: Map<string, string>;
4984
5156
  }
4985
5157
  /**
4986
- * 增量序列化格式
5158
+ * @zh 增量序列化格式
5159
+ * @en Incremental serialization format
4987
5160
  */
4988
5161
  type IncrementalSerializationFormat = 'json' | 'binary';
4989
5162
  /**
4990
- * 增量序列化选项
4991
- */
4992
- type IncrementalSerializationOptions = {
5163
+ * @zh 增量快照统计信息
5164
+ * @en Incremental snapshot statistics
5165
+ */
5166
+ interface IIncrementalStats {
5167
+ /** @zh 总变更数 @en Total changes */
5168
+ readonly totalChanges: number;
5169
+ /** @zh 实体变更数 @en Entity changes count */
5170
+ readonly entityChanges: number;
5171
+ /** @zh 组件变更数 @en Component changes count */
5172
+ readonly componentChanges: number;
5173
+ /** @zh 场景数据变更数 @en Scene data changes count */
5174
+ readonly sceneDataChanges: number;
5175
+ /** @zh 新增实体数 @en Added entities count */
5176
+ readonly addedEntities: number;
5177
+ /** @zh 删除实体数 @en Removed entities count */
5178
+ readonly removedEntities: number;
5179
+ /** @zh 更新实体数 @en Updated entities count */
5180
+ readonly updatedEntities: number;
5181
+ /** @zh 新增组件数 @en Added components count */
5182
+ readonly addedComponents: number;
5183
+ /** @zh 删除组件数 @en Removed components count */
5184
+ readonly removedComponents: number;
5185
+ /** @zh 更新组件数 @en Updated components count */
5186
+ readonly updatedComponents: number;
5187
+ }
5188
+ /**
5189
+ * @zh 增量序列化选项
5190
+ * @en Incremental serialization options
5191
+ */
5192
+ interface IncrementalSerializationOptions {
5193
+ /**
5194
+ * @zh 实体过滤器 - 只快照符合条件的实体
5195
+ * @en Entity filter - only snapshot entities that match the condition
5196
+ *
5197
+ * @example
5198
+ * ```typescript
5199
+ * // 只快照玩家实体
5200
+ * const snapshot = IncrementalSerializer.createSnapshot(scene, {
5201
+ * entityFilter: (entity) => entity.tag === PLAYER_TAG
5202
+ * });
5203
+ *
5204
+ * // 只快照有特定组件的实体
5205
+ * const snapshot = IncrementalSerializer.createSnapshot(scene, {
5206
+ * entityFilter: (entity) => entity.hasComponent(PlayerMarker)
5207
+ * });
5208
+ * ```
5209
+ */
5210
+ entityFilter?: (entity: Entity) => boolean;
4993
5211
  /**
4994
- * 是否包含组件数据的深度对比
4995
- * 默认true,设为false可提升性能但可能漏掉组件内部字段变更
5212
+ * @zh 是否包含组件数据的深度对比,默认true
5213
+ * @en Whether to deep compare component data, default true
4996
5214
  */
4997
5215
  deepComponentComparison?: boolean;
4998
5216
  /**
4999
- * 是否跟踪场景数据变更
5000
- * 默认true
5217
+ * @zh 是否跟踪场景数据变更,默认true
5218
+ * @en Whether to track scene data changes, default true
5001
5219
  */
5002
5220
  trackSceneData?: boolean;
5003
5221
  /**
5004
- * 是否压缩快照(使用JSON序列化)
5005
- * 默认false,设为true可减少内存占用但增加CPU开销
5222
+ * @zh 是否压缩快照,默认false
5223
+ * @en Whether to compress snapshot, default false
5006
5224
  */
5007
5225
  compressSnapshot?: boolean;
5008
5226
  /**
5009
- * 序列化格式
5010
- * - 'json': JSON格式
5011
- * - 'binary': 二进制格式
5012
- * 默认 'json'
5227
+ * @zh 序列化格式,默认 'json'
5228
+ * @en Serialization format, default 'json'
5013
5229
  */
5014
5230
  format?: IncrementalSerializationFormat;
5015
5231
  /**
5016
- * 是否美化JSON输出(仅在format='json'时有效)
5017
- * 默认false
5232
+ * @zh 是否美化JSON输出(仅在format='json'时有效),默认false
5233
+ * @en Whether to prettify JSON output (only for format='json'), default false
5018
5234
  */
5019
5235
  pretty?: boolean;
5020
- };
5236
+ }
5021
5237
  /**
5022
- * 增量序列化器类
5238
+ * @zh 增量序列化器类
5239
+ * @en Incremental serializer class
5240
+ *
5241
+ * @zh 提供场景快照创建、增量计算、应用和序列化功能
5242
+ * @en Provides scene snapshot creation, incremental computation, application and serialization
5023
5243
  */
5024
5244
  declare class IncrementalSerializer {
5025
- /** 当前快照版本号 */
5245
+ /** @zh 当前快照版本号 @en Current snapshot version */
5026
5246
  private static snapshotVersion;
5027
5247
  /**
5028
- * 创建场景快照
5248
+ * @zh 创建场景快照
5249
+ * @en Create scene snapshot
5029
5250
  *
5030
- * @param scene 要快照的场景
5031
- * @param options 序列化选项
5032
- * @returns 场景快照对象
5251
+ * @param scene - @zh 要快照的场景 @en Scene to snapshot
5252
+ * @param options - @zh 序列化选项 @en Serialization options
5253
+ * @returns @zh 场景快照对象 @en Scene snapshot object
5033
5254
  */
5034
5255
  static createSnapshot(scene: IScene, options?: IncrementalSerializationOptions): SceneSnapshot;
5035
5256
  /**
5036
- * 计算增量变更
5257
+ * @zh 计算增量变更
5258
+ * @en Compute incremental changes
5037
5259
  *
5038
- * @param scene 当前场景
5039
- * @param baseSnapshot 基础快照
5040
- * @param options 序列化选项
5041
- * @returns 增量快照
5260
+ * @param scene - @zh 当前场景 @en Current scene
5261
+ * @param baseSnapshot - @zh 基础快照 @en Base snapshot
5262
+ * @param options - @zh 序列化选项 @en Serialization options
5263
+ * @returns @zh 增量快照 @en Incremental snapshot
5042
5264
  */
5043
5265
  static computeIncremental(scene: IScene, baseSnapshot: SceneSnapshot, options?: IncrementalSerializationOptions): IncrementalSnapshot;
5044
5266
  /**
5045
- * 检测组件变更
5267
+ * @zh 检测组件变更
5268
+ * @en Detect component changes
5046
5269
  */
5047
5270
  private static detectComponentChanges;
5048
5271
  /**
5049
- * 检测场景数据变更
5272
+ * @zh 检测场景数据变更
5273
+ * @en Detect scene data changes
5050
5274
  */
5051
5275
  private static detectSceneDataChanges;
5052
5276
  /**
5053
- * 应用增量变更到场景
5277
+ * @zh 应用增量变更到场景
5278
+ * @en Apply incremental changes to scene
5054
5279
  *
5055
- * @param scene 目标场景
5056
- * @param incremental 增量快照
5057
- * @param componentRegistry 组件类型注册表
5280
+ * @param scene - @zh 目标场景 @en Target scene
5281
+ * @param incremental - @zh 增量快照 @en Incremental snapshot
5282
+ * @param componentRegistry - @zh 组件类型注册表 @en Component type registry
5058
5283
  */
5059
5284
  static applyIncremental(scene: IScene, incremental: IncrementalSnapshot, componentRegistry: Map<string, ComponentType>): void;
5060
5285
  private static applyEntityAdded;
@@ -5064,11 +5289,12 @@ declare class IncrementalSerializer {
5064
5289
  private static applyComponentRemoved;
5065
5290
  private static applyComponentUpdated;
5066
5291
  /**
5067
- * 序列化增量快照
5292
+ * @zh 序列化增量快照
5293
+ * @en Serialize incremental snapshot
5068
5294
  *
5069
- * @param incremental 增量快照
5070
- * @param options 序列化选项
5071
- * @returns 序列化后的数据(JSON字符串或二进制Uint8Array)
5295
+ * @param incremental - @zh 增量快照 @en Incremental snapshot
5296
+ * @param options - @zh 序列化选项 @en Serialization options
5297
+ * @returns @zh 序列化后的数据 @en Serialized data
5072
5298
  *
5073
5299
  * @example
5074
5300
  * ```typescript
@@ -5079,12 +5305,6 @@ declare class IncrementalSerializer {
5079
5305
  * const binaryData = IncrementalSerializer.serializeIncremental(snapshot, {
5080
5306
  * format: 'binary'
5081
5307
  * });
5082
- *
5083
- * // 美化JSON
5084
- * const prettyJson = IncrementalSerializer.serializeIncremental(snapshot, {
5085
- * format: 'json',
5086
- * pretty: true
5087
- * });
5088
5308
  * ```
5089
5309
  */
5090
5310
  static serializeIncremental(incremental: IncrementalSnapshot, options?: {
@@ -5092,41 +5312,24 @@ declare class IncrementalSerializer {
5092
5312
  pretty?: boolean;
5093
5313
  }): string | Uint8Array;
5094
5314
  /**
5095
- * 反序列化增量快照
5096
- *
5097
- * @param data 序列化的数据(JSON字符串或二进制Uint8Array)
5098
- * @returns 增量快照
5099
- *
5100
- * @example
5101
- * ```typescript
5102
- * // 从JSON反序列化
5103
- * const snapshot = IncrementalSerializer.deserializeIncremental(jsonString);
5315
+ * @zh 反序列化增量快照
5316
+ * @en Deserialize incremental snapshot
5104
5317
  *
5105
- * // 从二进制反序列化
5106
- * const snapshot = IncrementalSerializer.deserializeIncremental(buffer);
5107
- * ```
5318
+ * @param data - @zh 序列化的数据 @en Serialized data
5319
+ * @returns @zh 增量快照 @en Incremental snapshot
5108
5320
  */
5109
5321
  static deserializeIncremental(data: string | Uint8Array): IncrementalSnapshot;
5110
5322
  /**
5111
- * 获取增量快照的统计信息
5323
+ * @zh 获取增量快照的统计信息
5324
+ * @en Get incremental snapshot statistics
5112
5325
  *
5113
- * @param incremental 增量快照
5114
- * @returns 统计信息
5326
+ * @param incremental - @zh 增量快照 @en Incremental snapshot
5327
+ * @returns @zh 统计信息 @en Statistics
5115
5328
  */
5116
- static getIncrementalStats(incremental: IncrementalSnapshot): {
5117
- totalChanges: number;
5118
- entityChanges: number;
5119
- componentChanges: number;
5120
- sceneDataChanges: number;
5121
- addedEntities: number;
5122
- removedEntities: number;
5123
- updatedEntities: number;
5124
- addedComponents: number;
5125
- removedComponents: number;
5126
- updatedComponents: number;
5127
- };
5329
+ static getIncrementalStats(incremental: IncrementalSnapshot): IIncrementalStats;
5128
5330
  /**
5129
- * 重置快照版本号(用于测试)
5331
+ * @zh 重置快照版本号(用于测试)
5332
+ * @en Reset snapshot version (for testing)
5130
5333
  */
5131
5334
  static resetVersion(): void;
5132
5335
  }
@@ -5437,22 +5640,29 @@ type ISceneFactory<T extends IScene> = {
5437
5640
  createScene(): T;
5438
5641
  };
5439
5642
  /**
5440
- * 场景配置接口
5441
- * Scene configuration interface
5643
+ * @zh 场景配置接口
5644
+ * @en Scene configuration interface
5442
5645
  */
5443
5646
  type ISceneConfig = {
5444
5647
  /**
5445
- * 场景名称
5446
- * Scene name
5648
+ * @zh 场景名称
5649
+ * @en Scene name
5447
5650
  */
5448
5651
  name?: string;
5449
5652
  /**
5450
- * 是否从全局注册表继承组件类型
5451
- * Whether to inherit component types from global registry
5653
+ * @zh 是否从全局注册表继承组件类型
5654
+ * @en Whether to inherit component types from global registry
5452
5655
  *
5453
5656
  * @default true
5454
5657
  */
5455
5658
  inheritGlobalRegistry?: boolean;
5659
+ /**
5660
+ * @zh 系统最大错误次数,超过此阈值后系统将被自动禁用
5661
+ * @en Maximum error count for systems, systems exceeding this threshold will be auto-disabled
5662
+ *
5663
+ * @default 10
5664
+ */
5665
+ maxSystemErrorCount?: number;
5456
5666
  };
5457
5667
 
5458
5668
  /**
@@ -5930,7 +6140,7 @@ declare class Scene implements IScene {
5930
6140
  /**
5931
6141
  * 日志记录器
5932
6142
  */
5933
- private readonly logger;
6143
+ private readonly _logger;
5934
6144
  /**
5935
6145
  * 性能监控器缓存
5936
6146
  *
@@ -5980,9 +6190,8 @@ declare class Scene implements IScene {
5980
6190
  */
5981
6191
  private _systemErrorCount;
5982
6192
  /**
5983
- * 最大允许错误次数
5984
- *
5985
- * 系统错误次数超过此阈值后将被自动禁用
6193
+ * @zh 最大允许错误次数,系统错误次数超过此阈值后将被自动禁用
6194
+ * @en Maximum error count, systems exceeding this threshold will be auto-disabled
5986
6195
  */
5987
6196
  private _maxErrorCount;
5988
6197
  /**
@@ -6090,8 +6299,10 @@ declare class Scene implements IScene {
6090
6299
  */
6091
6300
  get services(): ServiceContainer;
6092
6301
  /**
6093
- * 创建场景实例
6094
- * Create scene instance
6302
+ * @zh 创建场景实例
6303
+ * @en Create scene instance
6304
+ *
6305
+ * @param config - @zh 场景配置 @en Scene configuration
6095
6306
  */
6096
6307
  constructor(config?: ISceneConfig);
6097
6308
  /**
@@ -6160,12 +6371,10 @@ declare class Scene implements IScene {
6160
6371
  */
6161
6372
  update(): void;
6162
6373
  /**
6163
- * 检查系统是否应该运行
6164
- * Check if a system should run
6165
- *
6166
- * @param system 要检查的系统 | System to check
6167
- * @returns 是否应该运行 | Whether it should run
6374
+ * @zh 执行系统的指定阶段
6375
+ * @en Run specified phase for all systems
6168
6376
  */
6377
+ private _runSystemPhase;
6169
6378
  private _shouldSystemRun;
6170
6379
  /**
6171
6380
  * 执行所有系统的延迟命令
@@ -8232,59 +8441,102 @@ declare abstract class IntervalSystem extends EntitySystem {
8232
8441
  }
8233
8442
 
8234
8443
  /**
8235
- * Worker处理函数类型
8236
- * 用户编写的处理逻辑,会被序列化到Worker中执行
8444
+ * @zh 支持 Worker 并行处理的实体系统基类
8445
+ * @en Base class for entity systems with Worker parallel processing support
8446
+ */
8447
+
8448
+ /**
8449
+ * @zh Worker 处理函数类型
8450
+ * @en Worker process function type
8451
+ *
8452
+ * @zh 用户编写的处理逻辑,会被序列化到 Worker 中执行
8453
+ * @en User-defined processing logic, serialized and executed in Worker
8454
+ */
8455
+ type WorkerProcessFunction<T extends Record<string, unknown> = Record<string, unknown>> = (entities: T[], deltaTime: number, config?: unknown) => T[] | Promise<T[]>;
8456
+ /**
8457
+ * @zh SharedArrayBuffer 处理函数类型
8458
+ * @en SharedArrayBuffer process function type
8237
8459
  */
8238
- type WorkerProcessFunction<T extends Record<string, any> = any> = (entities: T[], deltaTime: number, config?: any) => T[] | Promise<T[]>;
8460
+ type SharedArrayBufferProcessFunction = (sharedFloatArray: Float32Array, startIndex: number, endIndex: number, deltaTime: number, systemConfig?: unknown) => void;
8239
8461
  /**
8240
- * Worker配置接口
8462
+ * @zh Worker 系统配置接口
8463
+ * @en Worker system configuration interface
8241
8464
  */
8242
- type WorkerSystemConfig = {
8243
- /** 是否启用Worker并行处理 */
8465
+ interface IWorkerSystemConfig {
8466
+ /**
8467
+ * @zh 是否启用 Worker 并行处理
8468
+ * @en Enable Worker parallel processing
8469
+ * @default true
8470
+ */
8244
8471
  enableWorker?: boolean;
8245
- /** Worker数量,默认为CPU核心数,自动限制在系统最大值内 */
8472
+ /**
8473
+ * @zh Worker 数量,默认为 CPU 核心数,自动限制在系统最大值内
8474
+ * @en Worker count, defaults to CPU cores, auto-limited to system max
8475
+ */
8246
8476
  workerCount?: number;
8247
- /** 每个Worker处理的实体数量,用于控制负载分布 */
8477
+ /**
8478
+ * @zh 每个 Worker 处理的实体数量,用于控制负载分布
8479
+ * @en Entities per Worker, for load distribution control
8480
+ */
8248
8481
  entitiesPerWorker?: number;
8249
- /** 系统配置数据,会传递给Worker */
8250
- systemConfig?: any;
8251
- /** 是否使用SharedArrayBuffer优化 */
8482
+ /**
8483
+ * @zh 系统配置数据,会传递给 Worker
8484
+ * @en System config data, passed to Worker
8485
+ */
8486
+ systemConfig?: unknown;
8487
+ /**
8488
+ * @zh 是否使用 SharedArrayBuffer 优化
8489
+ * @en Use SharedArrayBuffer optimization
8490
+ */
8252
8491
  useSharedArrayBuffer?: boolean;
8253
- /** 每个实体在SharedArrayBuffer中占用的Float32数量 */
8492
+ /**
8493
+ * @zh 每个实体在 SharedArrayBuffer 中占用的 Float32 数量
8494
+ * @en Float32 count per entity in SharedArrayBuffer
8495
+ */
8254
8496
  entityDataSize?: number;
8255
- /** 最大实体数量(用于预分配SharedArrayBuffer) */
8497
+ /**
8498
+ * @zh 最大实体数量(用于预分配 SharedArrayBuffer)
8499
+ * @en Max entities (for SharedArrayBuffer pre-allocation)
8500
+ * @default 10000
8501
+ */
8256
8502
  maxEntities?: number;
8257
8503
  /**
8258
- * 预编译 Worker 脚本路径(微信小游戏等不支持动态脚本的平台必需)
8259
- * Pre-compiled Worker script path (required for platforms like WeChat Mini Game that don't support dynamic scripts)
8504
+ * @zh 预编译 Worker 脚本路径(微信小游戏等不支持动态脚本的平台必需)
8505
+ * @en Pre-compiled Worker script path (required for platforms like WeChat Mini Game)
8260
8506
  *
8261
8507
  * @example
8262
8508
  * ```typescript
8263
8509
  * // 微信小游戏使用方式:
8264
- * // 1. 创建 Worker 文件: workers/physics-worker.js
8265
- * // 2. 在 game.json 配置 "workers": "workers"
8266
- * // 3. 指定路径:
8267
8510
  * workerScriptPath: 'workers/physics-worker.js'
8268
8511
  * ```
8269
8512
  */
8270
8513
  workerScriptPath?: string;
8514
+ }
8515
+ /**
8516
+ * @zh 内部使用的完整配置类型
8517
+ * @en Internal complete config type
8518
+ */
8519
+ type ResolvedConfig = Required<Omit<IWorkerSystemConfig, 'systemConfig' | 'entitiesPerWorker' | 'workerScriptPath'>> & {
8520
+ systemConfig?: unknown;
8521
+ entitiesPerWorker?: number;
8522
+ workerScriptPath?: string;
8271
8523
  };
8272
8524
  /**
8273
- * SharedArrayBuffer处理函数类型
8525
+ * @zh 处理模式
8526
+ * @en Processing mode
8274
8527
  */
8275
- type SharedArrayBufferProcessFunction = (sharedFloatArray: Float32Array, startIndex: number, endIndex: number, deltaTime: number, systemConfig?: any) => void;
8528
+ type ProcessingMode = 'shared-buffer' | 'worker' | 'sync';
8276
8529
  /**
8277
- * 支持Worker并行处理的EntitySystem基类
8530
+ * @zh 支持 Worker 并行处理的 EntitySystem 基类
8531
+ * @en Base EntitySystem class with Worker parallel processing support
8278
8532
  *
8279
- * 支持传统Worker和SharedArrayBuffer两种优化模式:
8533
+ * @zh 支持传统 Worker SharedArrayBuffer 两种优化模式:
8280
8534
  * - 传统模式:数据序列化传输,适用于复杂计算
8281
- * - SharedArrayBuffer模式:零拷贝数据共享,适用于大量简单计算
8535
+ * - SharedArrayBuffer 模式:零拷贝数据共享,适用于大量简单计算
8282
8536
  *
8283
- * 用户需要实现:
8284
- * 1. extractEntityData - 定义数据提取逻辑
8285
- * 2. workerProcess - 编写处理函数(纯函数,可序列化)
8286
- * 3. applyResult - 定义结果应用逻辑
8287
- * 4. (可选) SharedArrayBuffer相关方法
8537
+ * @en Supports two optimization modes:
8538
+ * - Traditional mode: Data serialization, for complex calculations
8539
+ * - SharedArrayBuffer mode: Zero-copy sharing, for many simple calculations
8288
8540
  *
8289
8541
  * @example
8290
8542
  * ```typescript
@@ -8292,12 +8544,8 @@ type SharedArrayBufferProcessFunction = (sharedFloatArray: Float32Array, startIn
8292
8544
  * constructor() {
8293
8545
  * super(Matcher.all(Transform, Velocity), {
8294
8546
  * enableWorker: true,
8295
- * workerCount: 8, // 指定8个worker,系统会自动限制在系统最大值内
8296
- * entitiesPerWorker: 100, // 每个worker处理100个实体
8297
- * useSharedArrayBuffer: true,
8298
- * entityDataSize: 6, // x, y, vx, vy, radius, mass
8299
- * maxEntities: 10000,
8300
- * systemConfig: { gravity: 100, friction: 0.95 }
8547
+ * workerCount: 8,
8548
+ * systemConfig: { gravity: 100 }
8301
8549
  * });
8302
8550
  * }
8303
8551
  *
@@ -8306,238 +8554,176 @@ type SharedArrayBufferProcessFunction = (sharedFloatArray: Float32Array, startIn
8306
8554
  * }
8307
8555
  *
8308
8556
  * protected extractEntityData(entity: Entity): PhysicsData {
8309
- * const transform = entity.getComponent(Transform);
8310
- * const velocity = entity.getComponent(Velocity);
8311
- * const physics = entity.getComponent(PhysicsComponent);
8312
- * return {
8313
- * x: transform.x,
8314
- * y: transform.y,
8315
- * vx: velocity.x,
8316
- * vy: velocity.y,
8317
- * radius: physics.radius,
8318
- * mass: physics.mass
8319
- * };
8557
+ * // Extract component data
8320
8558
  * }
8321
8559
  *
8322
- * protected workerProcess(entities: PhysicsData[], deltaTime: number, config: any): PhysicsData[] {
8323
- * return entities.map(entity => {
8324
- * // 应用重力
8325
- * entity.vy += config.gravity * deltaTime;
8326
- *
8327
- * // 更新位置
8328
- * entity.x += entity.vx * deltaTime;
8329
- * entity.y += entity.vy * deltaTime;
8330
- *
8331
- * // 应用摩擦力
8332
- * entity.vx *= config.friction;
8333
- * entity.vy *= config.friction;
8334
- *
8335
- * return entity;
8336
- * });
8560
+ * protected workerProcess(entities: PhysicsData[], deltaTime: number, config: unknown): PhysicsData[] {
8561
+ * // Pure function executed in Worker
8337
8562
  * }
8338
8563
  *
8339
8564
  * protected applyResult(entity: Entity, result: PhysicsData): void {
8340
- * const transform = entity.getComponent(Transform);
8341
- * const velocity = entity.getComponent(Velocity);
8342
- *
8343
- * transform.x = result.x;
8344
- * transform.y = result.y;
8345
- * velocity.x = result.vx;
8346
- * velocity.y = result.vy;
8347
- * }
8348
- *
8349
- * // SharedArrayBuffer优化支持
8350
- * protected writeEntityToBuffer(entityData: PhysicsData, offset: number): void {
8351
- * if (!this.sharedFloatArray) return;
8352
- *
8353
- * this.sharedFloatArray[offset] = entityData.x;
8354
- * this.sharedFloatArray[offset + 1] = entityData.y;
8355
- * this.sharedFloatArray[offset + 2] = entityData.vx;
8356
- * this.sharedFloatArray[offset + 3] = entityData.vy;
8357
- * this.sharedFloatArray[offset + 4] = entityData.radius;
8358
- * this.sharedFloatArray[offset + 5] = entityData.mass;
8359
- * }
8360
- *
8361
- * protected readEntityFromBuffer(offset: number): PhysicsData | null {
8362
- * if (!this.sharedFloatArray) return null;
8363
- *
8364
- * return {
8365
- * x: this.sharedFloatArray[offset],
8366
- * y: this.sharedFloatArray[offset + 1],
8367
- * vx: this.sharedFloatArray[offset + 2],
8368
- * vy: this.sharedFloatArray[offset + 3],
8369
- * radius: this.sharedFloatArray[offset + 4],
8370
- * mass: this.sharedFloatArray[offset + 5]
8371
- * };
8565
+ * // Apply result back to components
8372
8566
  * }
8373
- *
8374
- * protected getSharedArrayBufferProcessFunction(): SharedArrayBufferProcessFunction {
8375
- * return function(sharedFloatArray: Float32Array, startIndex: number, endIndex: number, deltaTime: number, config: any) {
8376
- * const entitySize = 6;
8377
- * for (let i = startIndex; i < endIndex; i++) {
8378
- * const offset = i * entitySize;
8379
- *
8380
- * // 读取数据
8381
- * let x = sharedFloatArray[offset];
8382
- * let y = sharedFloatArray[offset + 1];
8383
- * let vx = sharedFloatArray[offset + 2];
8384
- * let vy = sharedFloatArray[offset + 3];
8385
- * const radius = sharedFloatArray[offset + 4];
8386
- * const mass = sharedFloatArray[offset + 5];
8387
- *
8388
- * // 物理计算
8389
- * vy += config.gravity * deltaTime;
8390
- * x += vx * deltaTime;
8391
- * y += vy * deltaTime;
8392
- * vx *= config.friction;
8393
- * vy *= config.friction;
8394
- *
8395
- * // 写回数据
8396
- * sharedFloatArray[offset] = x;
8397
- * sharedFloatArray[offset + 1] = y;
8398
- * sharedFloatArray[offset + 2] = vx;
8399
- * sharedFloatArray[offset + 3] = vy;
8400
- * }
8401
- * };
8402
- * }
8403
- * }
8404
- *
8405
- * interface PhysicsData {
8406
- * x: number;
8407
- * y: number;
8408
- * vx: number;
8409
- * vy: number;
8410
- * radius: number;
8411
- * mass: number;
8412
8567
  * }
8413
8568
  * ```
8414
8569
  */
8415
- declare abstract class WorkerEntitySystem<TEntityData = any> extends EntitySystem {
8416
- protected config: Required<Omit<WorkerSystemConfig, 'systemConfig' | 'entitiesPerWorker' | 'workerScriptPath'>> & {
8417
- systemConfig?: any;
8418
- entitiesPerWorker?: number;
8419
- workerScriptPath?: string;
8420
- };
8421
- private workerPool;
8422
- private isProcessing;
8570
+ declare abstract class WorkerEntitySystem<TEntityData = unknown> extends EntitySystem {
8571
+ protected config: ResolvedConfig;
8423
8572
  protected sharedBuffer: SharedArrayBuffer | null;
8424
8573
  protected sharedFloatArray: Float32Array | null;
8425
- private platformAdapter;
8574
+ private workerPool;
8575
+ private isProcessing;
8426
8576
  private hasLoggedSyncMode;
8427
- constructor(matcher?: Matcher, config?: WorkerSystemConfig);
8577
+ private readonly platformAdapter;
8578
+ constructor(matcher?: Matcher, config?: IWorkerSystemConfig);
8428
8579
  /**
8429
- * 检查是否支持Worker
8580
+ * @zh 解析并验证配置
8581
+ * @en Resolve and validate config
8582
+ */
8583
+ private resolveConfig;
8584
+ /**
8585
+ * @zh 检查是否支持 Worker
8586
+ * @en Check Worker support
8430
8587
  */
8431
8588
  private isWorkerSupported;
8432
8589
  /**
8433
- * 检查是否支持SharedArrayBuffer
8590
+ * @zh 检查是否支持 SharedArrayBuffer
8591
+ * @en Check SharedArrayBuffer support
8434
8592
  */
8435
8593
  private isSharedArrayBufferSupported;
8436
8594
  /**
8437
- * 获取系统支持的最大Worker数量
8595
+ * @zh 获取系统支持的最大 Worker 数量
8596
+ * @en Get max Worker count supported by system
8438
8597
  */
8439
8598
  private getMaxSystemWorkerCount;
8440
8599
  /**
8441
- * 获取实体数据大小 - 子类必须实现
8442
- * 返回每个实体在SharedArrayBuffer中占用的Float32数量
8600
+ * @zh 初始化 Worker 系统
8601
+ * @en Initialize Worker system
8443
8602
  */
8444
- protected abstract getDefaultEntityDataSize(): number;
8603
+ private initializeWorkerSystem;
8445
8604
  /**
8446
- * 初始化SharedArrayBuffer
8605
+ * @zh 初始化 SharedArrayBuffer
8606
+ * @en Initialize SharedArrayBuffer
8447
8607
  */
8448
8608
  private initializeSharedArrayBuffer;
8449
8609
  /**
8450
- * 初始化Worker
8610
+ * @zh 降级到单 Worker 模式
8611
+ * @en Fallback to single Worker mode
8612
+ */
8613
+ private fallbackToSingleWorker;
8614
+ /**
8615
+ * @zh 初始化 Worker 池
8616
+ * @en Initialize Worker pool
8451
8617
  */
8452
8618
  private initializeWorkerPool;
8453
8619
  /**
8454
- * 创建Worker脚本
8620
+ * @zh 解析 Worker 脚本
8621
+ * @en Resolve Worker script
8622
+ */
8623
+ private resolveWorkerScript;
8624
+ /**
8625
+ * @zh 创建 Worker 实例数组
8626
+ * @en Create Worker instance array
8627
+ */
8628
+ private createWorkers;
8629
+ /**
8630
+ * @zh 创建 Worker 脚本
8631
+ * @en Create Worker script
8455
8632
  */
8456
8633
  private createWorkerScript;
8457
8634
  /**
8458
- * 重写process方法,支持Worker并行处理
8635
+ * @zh 提取函数体
8636
+ * @en Extract function body
8459
8637
  */
8460
- protected process(entities: readonly Entity[]): void;
8638
+ private extractFunctionBody;
8461
8639
  /**
8462
- * 使用SharedArrayBuffer优化的Worker处理
8640
+ * @zh 获取 SharedArrayBuffer 处理函数体
8641
+ * @en Get SharedArrayBuffer process function body
8463
8642
  */
8464
- private processWithSharedArrayBuffer;
8643
+ private getSharedProcessFunctionBody;
8465
8644
  /**
8466
- * 使用Worker并行处理
8645
+ * @zh 重写 process 方法,支持 Worker 并行处理
8646
+ * @en Override process method with Worker parallel processing
8467
8647
  */
8468
- private processWithWorker;
8648
+ protected process(entities: readonly Entity[]): void;
8469
8649
  /**
8470
- * 同步处理(fallback)
8650
+ * @zh 获取当前处理模式
8651
+ * @en Get current processing mode
8471
8652
  */
8472
- private processSynchronously;
8653
+ private getCurrentProcessingMode;
8473
8654
  /**
8474
- * 创建数据批次 - 支持用户指定每个Worker的实体数量
8655
+ * @zh 使用 SharedArrayBuffer 优化的 Worker 处理
8656
+ * @en Worker processing with SharedArrayBuffer optimization
8475
8657
  */
8476
- private createBatches;
8658
+ private processWithSharedArrayBuffer;
8477
8659
  /**
8478
- * 将实体数据写入SharedArrayBuffer
8660
+ * @zh 使用 Worker 并行处理
8661
+ * @en Worker parallel processing
8479
8662
  */
8480
- private writeEntitiesToSharedBuffer;
8663
+ private processWithWorker;
8481
8664
  /**
8482
- * 将单个实体数据写入SharedArrayBuffer - 子类必须实现
8483
- * @param entityData 实体数据
8484
- * @param offset 在SharedArrayBuffer中的偏移位置(Float32索引)
8665
+ * @zh 同步处理(fallback)
8666
+ * @en Synchronous processing (fallback)
8485
8667
  */
8486
- protected abstract writeEntityToBuffer(entityData: TEntityData, offset: number): void;
8668
+ private processSynchronously;
8487
8669
  /**
8488
- * 创建SharedArrayBuffer任务 - 支持用户指定每个Worker的实体数量
8670
+ * @zh 创建数据批次
8671
+ * @en Create data batches
8489
8672
  */
8490
- private createSharedArrayBufferTasks;
8673
+ private createDataBatches;
8491
8674
  /**
8492
- * 从SharedArrayBuffer读取结果并应用
8675
+ * @zh 创建批次任务
8676
+ * @en Create batch tasks
8493
8677
  */
8494
- private readResultsFromSharedBuffer;
8678
+ private createBatchTasks;
8495
8679
  /**
8496
- * 从SharedArrayBuffer读取单个实体数据 - 子类必须实现
8497
- * @param offset 在SharedArrayBuffer中的偏移位置(Float32索引)
8498
- * @returns 实体数据或null
8680
+ * @zh 通用批次分割逻辑
8681
+ * @en Generic batch splitting logic
8499
8682
  */
8500
- protected abstract readEntityFromBuffer(offset: number): TEntityData | null;
8683
+ private splitIntoBatches;
8501
8684
  /**
8502
- * 获取SharedArrayBuffer处理函数 - 子类可选实现
8503
- * 返回一个函数,该函数将被序列化到Worker中执行
8685
+ * @zh 应用批次结果
8686
+ * @en Apply batch results
8504
8687
  */
8505
- protected getSharedArrayBufferProcessFunction?(): SharedArrayBufferProcessFunction;
8688
+ private applyBatchResults;
8506
8689
  /**
8507
- * 提取实体数据 - 子类必须实现
8508
- *
8509
- * 将Entity转换为可序列化的数据对象
8690
+ * @zh 应用结果数组
8691
+ * @en Apply results array
8510
8692
  */
8511
- protected abstract extractEntityData(entity: Entity): TEntityData;
8693
+ private applyResults;
8512
8694
  /**
8513
- * Worker处理函数 - 子类必须实现
8514
- *
8515
- * 这个函数会被序列化并在Worker中执行,因此:
8516
- * 1. 必须是纯函数,不能访问外部变量
8517
- * 2. 不能使用闭包或this
8518
- * 3. 只能使用标准JavaScript API
8695
+ * @zh 将实体数据写入 SharedArrayBuffer
8696
+ * @en Write entity data to SharedArrayBuffer
8519
8697
  */
8520
- protected abstract workerProcess(entities: TEntityData[], deltaTime: number, systemConfig?: any): TEntityData[] | Promise<TEntityData[]>;
8698
+ private writeEntitiesToBuffer;
8521
8699
  /**
8522
- * 应用处理结果 - 子类必须实现
8523
- *
8524
- * 将Worker处理的结果应用回Entity的组件
8700
+ * @zh SharedArrayBuffer 读取结果并应用
8701
+ * @en Read results from SharedArrayBuffer and apply
8525
8702
  */
8526
- protected abstract applyResult(entity: Entity, result: TEntityData): void;
8703
+ private readResultsFromBuffer;
8527
8704
  /**
8528
- * 更新Worker配置
8705
+ * @zh 更新 Worker 配置
8706
+ * @en Update Worker config
8529
8707
  */
8530
- updateConfig(newConfig: Partial<WorkerSystemConfig>): void;
8708
+ updateConfig(newConfig: Partial<IWorkerSystemConfig>): void;
8531
8709
  /**
8532
- * 重新初始化整个 Worker 系统(包括 SharedArrayBuffer)
8710
+ * @zh 重新初始化整个系统
8711
+ * @en Reinitialize entire system
8533
8712
  */
8534
- private reinitializeWorkerSystem;
8713
+ private reinitializeSystem;
8535
8714
  /**
8536
- * 重新初始化 Worker 池(保持 SharedArrayBuffer)
8715
+ * @zh 重新初始化 Worker
8716
+ * @en Reinitialize Worker pool
8537
8717
  */
8538
8718
  private reinitializeWorkerPool;
8539
8719
  /**
8540
- * 获取系统性能信息
8720
+ * @zh 销毁 Worker 池
8721
+ * @en Destroy Worker pool
8722
+ */
8723
+ private destroyWorkerPool;
8724
+ /**
8725
+ * @zh 获取 Worker 系统信息
8726
+ * @en Get Worker system info
8541
8727
  */
8542
8728
  getWorkerInfo(): {
8543
8729
  enabled: boolean;
@@ -8547,36 +8733,386 @@ declare abstract class WorkerEntitySystem<TEntityData = any> extends EntitySyste
8547
8733
  isProcessing: boolean;
8548
8734
  sharedArrayBufferSupported: boolean;
8549
8735
  sharedArrayBufferEnabled: boolean;
8550
- currentMode: 'shared-buffer' | 'worker' | 'sync';
8736
+ currentMode: ProcessingMode;
8551
8737
  };
8552
8738
  /**
8553
- * 销毁系统时清理Worker池
8739
+ * @zh 销毁系统时清理资源
8740
+ * @en Clean up resources on destroy
8554
8741
  */
8555
8742
  protected onDestroy(): void;
8556
8743
  protected getLoggerName(): string;
8744
+ /**
8745
+ * @zh 获取实体数据大小 - 子类必须实现
8746
+ * @en Get entity data size - subclass must implement
8747
+ *
8748
+ * @zh 返回每个实体在 SharedArrayBuffer 中占用的 Float32 数量
8749
+ * @en Returns Float32 count per entity in SharedArrayBuffer
8750
+ */
8751
+ protected abstract getDefaultEntityDataSize(): number;
8752
+ /**
8753
+ * @zh 将单个实体数据写入 SharedArrayBuffer - 子类必须实现
8754
+ * @en Write single entity data to SharedArrayBuffer - subclass must implement
8755
+ */
8756
+ protected abstract writeEntityToBuffer(entityData: TEntityData, offset: number): void;
8757
+ /**
8758
+ * @zh 从 SharedArrayBuffer 读取单个实体数据 - 子类必须实现
8759
+ * @en Read single entity data from SharedArrayBuffer - subclass must implement
8760
+ */
8761
+ protected abstract readEntityFromBuffer(offset: number): TEntityData | null;
8762
+ /**
8763
+ * @zh 提取实体数据 - 子类必须实现
8764
+ * @en Extract entity data - subclass must implement
8765
+ */
8766
+ protected abstract extractEntityData(entity: Entity): TEntityData;
8767
+ /**
8768
+ * @zh Worker 处理函数 - 子类必须实现(必须是纯函数)
8769
+ * @en Worker process function - subclass must implement (must be pure function)
8770
+ */
8771
+ protected abstract workerProcess(entities: TEntityData[], deltaTime: number, systemConfig?: unknown): TEntityData[] | Promise<TEntityData[]>;
8772
+ /**
8773
+ * @zh 应用处理结果 - 子类必须实现
8774
+ * @en Apply result - subclass must implement
8775
+ */
8776
+ protected abstract applyResult(entity: Entity, result: TEntityData): void;
8777
+ /**
8778
+ * @zh 获取 SharedArrayBuffer 处理函数 - 子类可选实现
8779
+ * @en Get SharedArrayBuffer process function - optional for subclass
8780
+ */
8781
+ protected getSharedArrayBufferProcessFunction?(): SharedArrayBufferProcessFunction;
8557
8782
  }
8558
-
8559
8783
  /**
8560
- * Type Decorators for ECS Components and Systems
8561
- * ECS 组件和系统的类型装饰器
8562
- *
8563
- * Provides decorators to mark component/system types with stable names
8564
- * that survive code minification.
8565
- *
8566
- * 提供装饰器为组件/系统类型标记稳定的名称,使其在代码混淆后仍然有效。
8784
+ * @deprecated Use IWorkerSystemConfig instead
8567
8785
  */
8786
+ type WorkerSystemConfig = IWorkerSystemConfig;
8568
8787
 
8569
8788
  /**
8570
- * 存储系统类型名称的Symbol键
8571
- * Symbol key for storing system type name
8789
+ * 平台适配器接口
8790
+ * 用于适配不同的运行环境(浏览器、微信小游戏、字节跳动小游戏等)
8572
8791
  */
8573
- declare const SYSTEM_TYPE_NAME: unique symbol;
8574
- /**
8575
- * 系统构造函数类型
8576
- * System constructor type
8577
- *
8578
- * 注意:构造函数参数使用 any[] 是必要的,因为系统可以有各种不同签名的构造函数
8579
- * Note: Constructor args use any[] because systems can have various constructor signatures
8792
+ type IPlatformAdapter = {
8793
+ /**
8794
+ * 平台名称
8795
+ */
8796
+ readonly name: string;
8797
+ /**
8798
+ * 平台版本信息
8799
+ */
8800
+ readonly version?: string;
8801
+ /**
8802
+ * 检查是否支持Worker
8803
+ */
8804
+ isWorkerSupported(): boolean;
8805
+ /**
8806
+ * 检查是否支持SharedArrayBuffer
8807
+ */
8808
+ isSharedArrayBufferSupported(): boolean;
8809
+ /**
8810
+ * 获取硬件并发数(CPU核心数)
8811
+ */
8812
+ getHardwareConcurrency(): number;
8813
+ /**
8814
+ * 创建Worker
8815
+ * @param script Worker脚本内容
8816
+ * @param options Worker选项
8817
+ */
8818
+ createWorker(script: string, options?: WorkerCreationOptions): PlatformWorker;
8819
+ /**
8820
+ * 创建SharedArrayBuffer
8821
+ * @param length 缓冲区大小(字节)
8822
+ */
8823
+ createSharedArrayBuffer(length: number): SharedArrayBuffer | null;
8824
+ /**
8825
+ * 获取高精度时间戳
8826
+ */
8827
+ getHighResTimestamp(): number;
8828
+ /**
8829
+ * 获取平台特定的配置
8830
+ */
8831
+ getPlatformConfig(): PlatformConfig;
8832
+ /**
8833
+ * 异步获取平台配置(包含需要异步获取的信息)
8834
+ */
8835
+ getPlatformConfigAsync?(): Promise<PlatformConfig>;
8836
+ };
8837
+ /**
8838
+ * Worker创建选项
8839
+ */
8840
+ type WorkerCreationOptions = {
8841
+ /**
8842
+ * Worker类型
8843
+ */
8844
+ type?: 'classic' | 'module';
8845
+ /**
8846
+ * 凭据模式
8847
+ */
8848
+ credentials?: 'omit' | 'same-origin' | 'include';
8849
+ /**
8850
+ * Worker名称(用于调试)
8851
+ */
8852
+ name?: string;
8853
+ };
8854
+ /**
8855
+ * 平台Worker接口
8856
+ */
8857
+ type PlatformWorker = {
8858
+ /**
8859
+ * 发送消息到Worker
8860
+ */
8861
+ postMessage(message: any, transfer?: Transferable[]): void;
8862
+ /**
8863
+ * 监听Worker消息
8864
+ */
8865
+ onMessage(handler: (event: {
8866
+ data: any;
8867
+ }) => void): void;
8868
+ /**
8869
+ * 监听Worker错误
8870
+ */
8871
+ onError(handler: (error: ErrorEvent) => void): void;
8872
+ /**
8873
+ * 终止Worker
8874
+ */
8875
+ terminate(): void;
8876
+ /**
8877
+ * Worker状态
8878
+ */
8879
+ readonly state: 'running' | 'terminated';
8880
+ };
8881
+ /**
8882
+ * 平台配置
8883
+ */
8884
+ type PlatformConfig = {
8885
+ /**
8886
+ * 最大Worker数量限制
8887
+ */
8888
+ maxWorkerCount: number;
8889
+ /**
8890
+ * 是否支持模块Worker
8891
+ */
8892
+ supportsModuleWorker: boolean;
8893
+ /**
8894
+ * 是否支持Transferable Objects
8895
+ */
8896
+ supportsTransferableObjects: boolean;
8897
+ /**
8898
+ * SharedArrayBuffer的最大大小限制(字节)
8899
+ */
8900
+ maxSharedArrayBufferSize?: number;
8901
+ /**
8902
+ * 平台特定的Worker脚本前缀(如果需要)
8903
+ */
8904
+ workerScriptPrefix?: string;
8905
+ /**
8906
+ * 平台特定的限制和特性
8907
+ */
8908
+ limitations?: {
8909
+ /**
8910
+ * 是否禁用eval(影响动态脚本创建)
8911
+ */
8912
+ noEval?: boolean;
8913
+ /**
8914
+ * 是否需要特殊的Worker初始化
8915
+ */
8916
+ requiresWorkerInit?: boolean;
8917
+ /**
8918
+ * 内存限制(字节)
8919
+ */
8920
+ memoryLimit?: number;
8921
+ /**
8922
+ * Worker是否不受支持(用于明确标记不支持Worker的平台)
8923
+ */
8924
+ workerNotSupported?: boolean;
8925
+ /**
8926
+ * Worker限制说明列表
8927
+ */
8928
+ workerLimitations?: string[];
8929
+ };
8930
+ /**
8931
+ * 平台特定的扩展属性
8932
+ */
8933
+ extensions?: Record<string, any>;
8934
+ };
8935
+ /**
8936
+ * 平台检测结果
8937
+ */
8938
+ type PlatformDetectionResult = {
8939
+ /**
8940
+ * 平台类型
8941
+ */
8942
+ platform: 'browser' | 'wechat-minigame' | 'bytedance-minigame' | 'alipay-minigame' | 'baidu-minigame' | 'nodejs' | 'unknown';
8943
+ /**
8944
+ * 是否确定检测结果
8945
+ */
8946
+ confident: boolean;
8947
+ /**
8948
+ * 检测到的特征
8949
+ */
8950
+ features: string[];
8951
+ /**
8952
+ * 建议使用的适配器类名
8953
+ */
8954
+ adapterClass?: string;
8955
+ };
8956
+
8957
+ /**
8958
+ * @zh 平台适配的 Worker 池管理器
8959
+ * @en Platform-adapted Worker Pool Manager
8960
+ */
8961
+
8962
+ /**
8963
+ * @zh Worker 池状态接口
8964
+ * @en Worker pool status interface
8965
+ */
8966
+ interface IWorkerPoolStatus {
8967
+ /** @zh Worker 总数 @en Total number of workers */
8968
+ readonly total: number;
8969
+ /** @zh 空闲 Worker 数量 @en Number of idle workers */
8970
+ readonly idle: number;
8971
+ /** @zh 忙碌 Worker 数量 @en Number of busy workers */
8972
+ readonly busy: number;
8973
+ /** @zh 初始化中的 Worker 数量 @en Number of initializing workers */
8974
+ readonly initializing: number;
8975
+ /** @zh 队列中等待的任务数 @en Number of queued tasks */
8976
+ readonly queuedTasks: number;
8977
+ }
8978
+ /**
8979
+ * @zh 平台适配的 Worker 池管理器
8980
+ * @en Platform-adapted Worker Pool Manager
8981
+ *
8982
+ * @zh 管理 Worker 生命周期、任务分发和状态跟踪
8983
+ * @en Manages Worker lifecycle, task distribution and state tracking
8984
+ */
8985
+ declare class PlatformWorkerPool {
8986
+ private readonly workers;
8987
+ private readonly workerStates;
8988
+ private readonly pendingTasks;
8989
+ private readonly taskQueue;
8990
+ private taskCounter;
8991
+ private _isDestroyed;
8992
+ /**
8993
+ * @zh 创建 Worker 池
8994
+ * @en Create Worker pool
8995
+ *
8996
+ * @param workers - @zh Worker 实例数组 @en Array of Worker instances
8997
+ * @param sharedBuffer - @zh 共享内存缓冲区 @en Shared memory buffer
8998
+ */
8999
+ constructor(workers: PlatformWorker[], sharedBuffer?: SharedArrayBuffer | null);
9000
+ /**
9001
+ * @zh 池是否已销毁
9002
+ * @en Whether the pool has been destroyed
9003
+ */
9004
+ get isDestroyed(): boolean;
9005
+ /**
9006
+ * @zh Worker 数量
9007
+ * @en Number of workers in the pool
9008
+ */
9009
+ get workerCount(): number;
9010
+ /**
9011
+ * @zh 所有 Worker 是否已就绪(无初始化中的 Worker)
9012
+ * @en Whether all workers are ready (no initializing workers)
9013
+ */
9014
+ get isReady(): boolean;
9015
+ /**
9016
+ * @zh 是否有待处理的任务(队列中或执行中)
9017
+ * @en Whether there are pending tasks (queued or executing)
9018
+ */
9019
+ get hasPendingTasks(): boolean;
9020
+ /**
9021
+ * @zh 执行 SharedArrayBuffer 任务
9022
+ * @en Execute SharedArrayBuffer task
9023
+ *
9024
+ * @param data - @zh 任务数据 @en Task data
9025
+ * @returns @zh 任务完成的 Promise @en Promise that resolves when task completes
9026
+ */
9027
+ executeSharedBuffer(data: Record<string, unknown>): Promise<void>;
9028
+ /**
9029
+ * @zh 执行普通任务
9030
+ * @en Execute normal task
9031
+ *
9032
+ * @param data - @zh 任务数据 @en Task data
9033
+ * @returns @zh 包含任务结果的 Promise @en Promise with task result
9034
+ */
9035
+ execute<TResult = unknown>(data: Record<string, unknown>): Promise<TResult>;
9036
+ /**
9037
+ * @zh 获取 Worker 池状态
9038
+ * @en Get Worker pool status
9039
+ *
9040
+ * @returns @zh 池状态对象 @en Pool status object
9041
+ */
9042
+ getStatus(): IWorkerPoolStatus;
9043
+ /**
9044
+ * @zh 销毁 Worker 池,释放所有资源
9045
+ * @en Destroy Worker pool and release all resources
9046
+ */
9047
+ destroy(): void;
9048
+ /**
9049
+ * @zh 初始化所有 Worker
9050
+ * @en Initialize all Workers
9051
+ */
9052
+ private initializeWorkers;
9053
+ /**
9054
+ * @zh 创建并入队任务
9055
+ * @en Create and enqueue task
9056
+ */
9057
+ private createTask;
9058
+ /**
9059
+ * @zh 将任务加入队列
9060
+ * @en Enqueue task
9061
+ */
9062
+ private enqueueTask;
9063
+ /**
9064
+ * @zh 分发任务到空闲 Worker
9065
+ * @en Dispatch tasks to idle Workers
9066
+ */
9067
+ private dispatchTasks;
9068
+ /**
9069
+ * @zh 查找空闲 Worker
9070
+ * @en Find idle Worker
9071
+ */
9072
+ private findIdleWorker;
9073
+ /**
9074
+ * @zh 分配任务给指定 Worker
9075
+ * @en Assign task to specified Worker
9076
+ */
9077
+ private assignTask;
9078
+ /**
9079
+ * @zh 处理 Worker 消息
9080
+ * @en Handle Worker message
9081
+ */
9082
+ private handleMessage;
9083
+ /**
9084
+ * @zh 处理 Worker 错误
9085
+ * @en Handle Worker error
9086
+ */
9087
+ private handleError;
9088
+ /**
9089
+ * @zh 完成任务并释放 Worker
9090
+ * @en Complete task and release Worker
9091
+ */
9092
+ private completeTask;
9093
+ }
9094
+
9095
+ /**
9096
+ * Type Decorators for ECS Components and Systems
9097
+ * ECS 组件和系统的类型装饰器
9098
+ *
9099
+ * Provides decorators to mark component/system types with stable names
9100
+ * that survive code minification.
9101
+ *
9102
+ * 提供装饰器为组件/系统类型标记稳定的名称,使其在代码混淆后仍然有效。
9103
+ */
9104
+
9105
+ /**
9106
+ * 存储系统类型名称的Symbol键
9107
+ * Symbol key for storing system type name
9108
+ */
9109
+ declare const SYSTEM_TYPE_NAME: unique symbol;
9110
+ /**
9111
+ * 系统构造函数类型
9112
+ * System constructor type
9113
+ *
9114
+ * 注意:构造函数参数使用 any[] 是必要的,因为系统可以有各种不同签名的构造函数
9115
+ * Note: Constructor args use any[] because systems can have various constructor signatures
8580
9116
  */
8581
9117
  type SystemConstructor<T extends EntitySystem = EntitySystem> = new (...args: any[]) => T;
8582
9118
  /**
@@ -9670,175 +10206,159 @@ declare const enum EEntityLifecyclePolicy {
9670
10206
  }
9671
10207
 
9672
10208
  /**
9673
- * 实体比较器
10209
+ * @zh 游戏实体类
10210
+ * @en Game entity class
9674
10211
  *
9675
- * 用于比较两个实体的优先级,首先按更新顺序比较,然后按ID比较。
9676
- */
9677
- declare class EntityComparer {
9678
- /**
9679
- * 比较两个实体
9680
- *
9681
- * @param self - 第一个实体
9682
- * @param other - 第二个实体
9683
- * @returns 比较结果,负数表示self优先级更高,正数表示other优先级更高,0表示相等
9684
- */
9685
- compare(self: Entity, other: Entity): number;
9686
- }
9687
- /**
9688
- * 游戏实体类
9689
- *
9690
- * ECS架构中的实体(Entity),作为组件的容器。
10212
+ * @zh ECS架构中的实体(Entity),作为组件的容器。
9691
10213
  * 实体本身不包含游戏逻辑,所有功能都通过组件来实现。
9692
- *
9693
10214
  * 层级关系通过 HierarchyComponent 和 HierarchySystem 管理,
9694
10215
  * 而非 Entity 内置属性,符合 ECS 组合原则。
10216
+ * @en Entity in ECS architecture, serves as a container for components.
10217
+ * Entity itself contains no game logic, all functionality is implemented through components.
10218
+ * Hierarchy relationships are managed by HierarchyComponent and HierarchySystem,
10219
+ * not built-in Entity properties, following ECS composition principles.
9695
10220
  *
9696
10221
  * @example
9697
10222
  * ```typescript
9698
- * // 创建实体
10223
+ * // @zh 创建实体 | @en Create entity
9699
10224
  * const entity = scene.createEntity("Player");
9700
10225
  *
9701
- * // 添加组件
10226
+ * // @zh 添加组件 | @en Add component
9702
10227
  * const healthComponent = entity.addComponent(new HealthComponent(100));
9703
10228
  *
9704
- * // 获取组件
10229
+ * // @zh 获取组件 | @en Get component
9705
10230
  * const health = entity.getComponent(HealthComponent);
9706
10231
  *
9707
- * // 层级关系使用 HierarchySystem
10232
+ * // @zh 层级关系使用 HierarchySystem | @en Use HierarchySystem for hierarchy
9708
10233
  * const hierarchySystem = scene.getSystem(HierarchySystem);
9709
10234
  * hierarchySystem.setParent(childEntity, parentEntity);
9710
10235
  * ```
9711
10236
  */
9712
10237
  declare class Entity {
9713
10238
  /**
9714
- * Entity专用日志器
10239
+ * @zh Entity专用日志器
10240
+ * @en Entity logger
9715
10241
  */
9716
10242
  private static _logger;
9717
10243
  /**
9718
- * 实体比较器实例
9719
- */
9720
- static entityComparer: EntityComparer;
9721
- /**
9722
- * 实体名称
10244
+ * @zh 实体名称
10245
+ * @en Entity name
9723
10246
  */
9724
10247
  name: string;
9725
10248
  /**
9726
- * 实体唯一标识符(运行时 ID
9727
- *
9728
- * Runtime identifier for fast lookups.
10249
+ * @zh 实体唯一标识符(运行时ID),用于快速查找
10250
+ * @en Unique entity identifier (runtime ID) for fast lookups
9729
10251
  */
9730
10252
  readonly id: number;
9731
10253
  /**
9732
- * 持久化唯一标识符(GUID)
9733
- *
9734
- * 用于序列化/反序列化时保持实体引用一致性。
9735
- * 在场景保存和加载时保持不变。
10254
+ * @zh 持久化唯一标识符(GUID)
10255
+ * @en Persistent unique identifier (GUID)
9736
10256
  *
9737
- * Persistent identifier for serialization.
9738
- * Remains stable across save/load cycles.
10257
+ * @zh 用于序列化/反序列化时保持实体引用一致性,在场景保存和加载时保持不变
10258
+ * @en Used to maintain entity reference consistency during serialization/deserialization, remains stable across save/load cycles
9739
10259
  */
9740
10260
  readonly persistentId: string;
9741
10261
  /**
9742
- * 轻量级实体句柄
10262
+ * @zh 轻量级实体句柄
10263
+ * @en Lightweight entity handle
9743
10264
  *
9744
- * 数值类型的实体标识符,包含索引和代数信息。
10265
+ * @zh 数值类型的实体标识符,包含索引和代数信息。
9745
10266
  * 用于高性能场景下替代对象引用,支持 Archetype 存储等优化。
9746
- *
9747
- * Lightweight entity handle.
9748
- * Numeric identifier containing index and generation.
10267
+ * @en Numeric identifier containing index and generation.
9749
10268
  * Used for high-performance scenarios instead of object references,
9750
10269
  * supports Archetype storage optimizations.
9751
10270
  */
9752
10271
  private _handle;
9753
10272
  /**
9754
- * 所属场景引用
10273
+ * @zh 所属场景引用
10274
+ * @en Reference to the owning scene
9755
10275
  */
9756
10276
  scene: IScene | null;
9757
10277
  /**
9758
- * 销毁状态标志
10278
+ * @zh 销毁状态标志
10279
+ * @en Destroyed state flag
9759
10280
  */
9760
10281
  private _isDestroyed;
9761
10282
  /**
9762
- * 激活状态
10283
+ * @zh 激活状态
10284
+ * @en Active state
9763
10285
  */
9764
10286
  private _active;
9765
10287
  /**
9766
- * 实体标签
10288
+ * @zh 实体标签,用于分类和查询
10289
+ * @en Entity tag for categorization and querying
9767
10290
  */
9768
10291
  private _tag;
9769
10292
  /**
9770
- * 启用状态
10293
+ * @zh 启用状态
10294
+ * @en Enabled state
9771
10295
  */
9772
10296
  private _enabled;
9773
10297
  /**
9774
- * 更新顺序
10298
+ * @zh 更新顺序
10299
+ * @en Update order
9775
10300
  */
9776
10301
  private _updateOrder;
9777
10302
  /**
9778
- * 组件位掩码(用于快速 hasComponent 检查)
10303
+ * @zh 组件位掩码,用于快速 hasComponent 检查
10304
+ * @en Component bitmask for fast hasComponent checks
9779
10305
  */
9780
10306
  private _componentMask;
9781
10307
  /**
9782
- * 懒加载的组件数组缓存
10308
+ * @zh 懒加载的组件数组缓存
10309
+ * @en Lazy-loaded component array cache
9783
10310
  */
9784
10311
  private _componentCache;
9785
10312
  /**
9786
- * 生命周期策略
9787
- *
9788
- * Lifecycle policy for scene transitions.
10313
+ * @zh 生命周期策略,控制实体在场景切换时的行为
10314
+ * @en Lifecycle policy controlling entity behavior during scene transitions
9789
10315
  */
9790
10316
  private _lifecyclePolicy;
9791
10317
  /**
9792
- * 构造函数
10318
+ * @zh 构造函数
10319
+ * @en Constructor
9793
10320
  *
9794
- * @param name - 实体名称
9795
- * @param id - 实体唯一标识符(运行时 ID
9796
- * @param persistentId - 持久化标识符(可选,用于反序列化时恢复)
10321
+ * @param name - @zh 实体名称 @en Entity name
10322
+ * @param id - @zh 实体唯一标识符(运行时ID)@en Unique entity identifier (runtime ID)
10323
+ * @param persistentId - @zh 持久化标识符(可选,用于反序列化时恢复)@en Persistent identifier (optional, for deserialization)
9797
10324
  */
9798
10325
  constructor(name: string, id: number, persistentId?: string);
9799
10326
  /**
9800
- * 获取生命周期策略
9801
- *
9802
- * Get lifecycle policy.
10327
+ * @zh 获取生命周期策略
10328
+ * @en Get lifecycle policy
9803
10329
  */
9804
10330
  get lifecyclePolicy(): EEntityLifecyclePolicy;
9805
10331
  /**
9806
- * 检查实体是否为持久化实体
9807
- *
9808
- * Check if entity is persistent (survives scene transitions).
10332
+ * @zh 检查实体是否为持久化实体(跨场景保留)
10333
+ * @en Check if entity is persistent (survives scene transitions)
9809
10334
  */
9810
10335
  get isPersistent(): boolean;
9811
10336
  /**
9812
- * 获取实体句柄
10337
+ * @zh 获取实体句柄
10338
+ * @en Get entity handle
9813
10339
  *
9814
- * 返回轻量级数值句柄,用于高性能场景。
9815
- * 如果实体尚未分配句柄,返回 NULL_HANDLE
9816
- *
9817
- * Get entity handle.
9818
- * Returns lightweight numeric handle for high-performance scenarios.
9819
- * Returns NULL_HANDLE if entity has no handle assigned.
10340
+ * @zh 返回轻量级数值句柄,用于高性能场景。如果实体尚未分配句柄,返回 NULL_HANDLE。
10341
+ * @en Returns lightweight numeric handle for high-performance scenarios. Returns NULL_HANDLE if entity has no handle assigned.
9820
10342
  */
9821
10343
  get handle(): EntityHandle;
9822
10344
  /**
9823
- * 设置实体句柄(内部使用)
9824
- *
9825
- * 此方法供 Scene 在创建实体时调用。
10345
+ * @zh 设置实体句柄(内部使用)
10346
+ * @en Set entity handle (internal use)
9826
10347
  *
9827
- * Set entity handle (internal use).
9828
- * Called by Scene when creating entities.
10348
+ * @zh 此方法供 Scene 在创建实体时调用
10349
+ * @en Called by Scene when creating entities
9829
10350
  *
9830
10351
  * @internal
9831
10352
  */
9832
10353
  setHandle(handle: EntityHandle): void;
9833
10354
  /**
9834
- * 设置实体为持久化(跨场景保留)
9835
- *
9836
- * 标记后的实体在场景切换时不会被销毁,会自动迁移到新场景。
10355
+ * @zh 设置实体为持久化(跨场景保留)
10356
+ * @en Mark entity as persistent (survives scene transitions)
9837
10357
  *
9838
- * Mark entity as persistent (survives scene transitions).
9839
- * Persistent entities are automatically migrated to the new scene.
10358
+ * @zh 标记后的实体在场景切换时不会被销毁,会自动迁移到新场景
10359
+ * @en Persistent entities are automatically migrated to the new scene
9840
10360
  *
9841
- * @returns this,支持链式调用 | Returns this for chaining
10361
+ * @returns @zh this,支持链式调用 @en Returns this for chaining
9842
10362
  *
9843
10363
  * @example
9844
10364
  * ```typescript
@@ -9849,37 +10369,39 @@ declare class Entity {
9849
10369
  */
9850
10370
  setPersistent(): this;
9851
10371
  /**
9852
- * 设置实体为场景本地(随场景销毁)
9853
- *
9854
- * 将实体恢复为默认行为。
9855
- *
9856
- * Mark entity as scene-local (destroyed with scene).
9857
- * Restores default behavior.
10372
+ * @zh 设置实体为场景本地(随场景销毁),恢复默认行为
10373
+ * @en Mark entity as scene-local (destroyed with scene), restores default behavior
9858
10374
  *
9859
- * @returns this,支持链式调用 | Returns this for chaining
10375
+ * @returns @zh this,支持链式调用 @en Returns this for chaining
9860
10376
  */
9861
10377
  setSceneLocal(): this;
9862
10378
  /**
9863
- * 获取销毁状态
9864
- * @returns 如果实体已被销毁则返回true
10379
+ * @zh 获取销毁状态
10380
+ * @en Get destroyed state
10381
+ *
10382
+ * @returns @zh 如果实体已被销毁则返回true @en Returns true if entity has been destroyed
9865
10383
  */
9866
10384
  get isDestroyed(): boolean;
9867
10385
  /**
9868
- * 设置销毁状态(内部使用)
10386
+ * @zh 设置销毁状态(内部使用)
10387
+ * @en Set destroyed state (internal use)
9869
10388
  *
9870
- * 此方法供Scene和批量操作使用,以提高性能。
9871
- * 不应在普通业务逻辑中调用,应使用destroy()方法。
10389
+ * @zh 此方法供Scene和批量操作使用,以提高性能。不应在普通业务逻辑中调用,应使用destroy()方法
10390
+ * @en Used by Scene and batch operations for performance. Should not be called in normal business logic, use destroy() instead
9872
10391
  *
9873
10392
  * @internal
9874
10393
  */
9875
10394
  setDestroyedState(destroyed: boolean): void;
9876
10395
  /**
9877
- * 获取组件数组(懒加载)
9878
- * @returns 只读的组件数组
10396
+ * @zh 获取组件数组(懒加载)
10397
+ * @en Get component array (lazy-loaded)
10398
+ *
10399
+ * @returns @zh 只读的组件数组 @en Readonly component array
9879
10400
  */
9880
10401
  get components(): readonly Component[];
9881
10402
  /**
9882
- * 从存储重建组件缓存
10403
+ * @zh 从存储重建组件缓存
10404
+ * @en Rebuild component cache from storage
9883
10405
  */
9884
10406
  private _rebuildComponentCache;
9885
10407
  /**
@@ -9895,53 +10417,61 @@ declare class Entity {
9895
10417
  */
9896
10418
  set active(value: boolean);
9897
10419
  /**
9898
- * 获取实体标签
10420
+ * @zh 获取实体标签
10421
+ * @en Get entity tag
9899
10422
  *
9900
- * @returns 实体的数字标签
10423
+ * @returns @zh 实体的数字标签 @en Entity's numeric tag
9901
10424
  */
9902
10425
  get tag(): number;
9903
10426
  /**
9904
- * 设置实体标签
10427
+ * @zh 设置实体标签
10428
+ * @en Set entity tag
9905
10429
  *
9906
- * @param value - 新的标签值
10430
+ * @param value - @zh 新的标签值 @en New tag value
9907
10431
  */
9908
10432
  set tag(value: number);
9909
10433
  /**
9910
- * 获取启用状态
10434
+ * @zh 获取启用状态
10435
+ * @en Get enabled state
9911
10436
  *
9912
- * @returns 如果实体已启用则返回true
10437
+ * @returns @zh 如果实体已启用则返回true @en Returns true if entity is enabled
9913
10438
  */
9914
10439
  get enabled(): boolean;
9915
10440
  /**
9916
- * 设置启用状态
10441
+ * @zh 设置启用状态
10442
+ * @en Set enabled state
9917
10443
  *
9918
- * @param value - 新的启用状态
10444
+ * @param value - @zh 新的启用状态 @en New enabled state
9919
10445
  */
9920
10446
  set enabled(value: boolean);
9921
10447
  /**
9922
- * 获取更新顺序
10448
+ * @zh 获取更新顺序
10449
+ * @en Get update order
9923
10450
  *
9924
- * @returns 实体的更新顺序值
10451
+ * @returns @zh 实体的更新顺序值 @en Entity's update order value
9925
10452
  */
9926
10453
  get updateOrder(): number;
9927
10454
  /**
9928
- * 设置更新顺序
10455
+ * @zh 设置更新顺序
10456
+ * @en Set update order
9929
10457
  *
9930
- * @param value - 新的更新顺序值
10458
+ * @param value - @zh 新的更新顺序值 @en New update order value
9931
10459
  */
9932
10460
  set updateOrder(value: number);
9933
10461
  /**
9934
- * 获取组件位掩码
10462
+ * @zh 获取组件位掩码
10463
+ * @en Get component bitmask
9935
10464
  *
9936
- * @returns 实体的组件位掩码
10465
+ * @returns @zh 实体的组件位掩码 @en Entity's component bitmask
9937
10466
  */
9938
10467
  get componentMask(): BitMask64Data;
9939
10468
  /**
9940
- * 创建并添加组件
10469
+ * @zh 创建并添加组件
10470
+ * @en Create and add component
9941
10471
  *
9942
- * @param componentType - 组件类型构造函数
9943
- * @param args - 组件构造函数参数
9944
- * @returns 创建的组件实例
10472
+ * @param componentType - @zh 组件类型构造函数 @en Component type constructor
10473
+ * @param args - @zh 组件构造函数参数 @en Component constructor arguments
10474
+ * @returns @zh 创建的组件实例 @en Created component instance
9945
10475
  *
9946
10476
  * @example
9947
10477
  * ```typescript
@@ -9950,27 +10480,15 @@ declare class Entity {
9950
10480
  * ```
9951
10481
  */
9952
10482
  createComponent<T extends Component>(componentType: ComponentType<T>, ...args: ConstructorParameters<ComponentType<T>>): T;
9953
- /**
9954
- * 内部添加组件方法(不进行重复检查,用于初始化)
9955
- *
9956
- * @param component - 要添加的组件实例
9957
- * @returns 添加的组件实例
9958
- */
9959
10483
  private addComponentInternal;
9960
- /**
9961
- * 通知Scene中的QuerySystem实体组件发生变动
9962
- *
9963
- * Notify the QuerySystem in Scene that entity components have changed
9964
- *
9965
- * @param changedComponentType 变化的组件类型(可选,用于优化通知) | Changed component type (optional, for optimized notification)
9966
- */
9967
10484
  private notifyQuerySystems;
9968
10485
  /**
9969
- * 添加组件到实体
10486
+ * @zh 添加组件到实体
10487
+ * @en Add component to entity
9970
10488
  *
9971
- * @param component - 要添加的组件实例
9972
- * @returns 添加的组件实例
9973
- * @throws {Error} 如果实体已存在该类型的组件
10489
+ * @param component - @zh 要添加的组件实例 @en Component instance to add
10490
+ * @returns @zh 添加的组件实例 @en Added component instance
10491
+ * @throws @zh 如果实体已存在该类型的组件 @en If entity already has this component type
9974
10492
  *
9975
10493
  * @example
9976
10494
  * ```typescript
@@ -9980,10 +10498,11 @@ declare class Entity {
9980
10498
  */
9981
10499
  addComponent<T extends Component>(component: T): T;
9982
10500
  /**
9983
- * 获取指定类型的组件
10501
+ * @zh 获取指定类型的组件
10502
+ * @en Get component of specified type
9984
10503
  *
9985
- * @param type - 组件类型构造函数
9986
- * @returns 组件实例,如果不存在则返回null
10504
+ * @param type - @zh 组件类型构造函数 @en Component type constructor
10505
+ * @returns @zh 组件实例,如果不存在则返回null @en Component instance, or null if not found
9987
10506
  *
9988
10507
  * @example
9989
10508
  * ```typescript
@@ -9996,10 +10515,11 @@ declare class Entity {
9996
10515
  */
9997
10516
  getComponent<T extends Component>(type: ComponentType<T>): T | null;
9998
10517
  /**
9999
- * 检查实体是否拥有指定类型的组件
10518
+ * @zh 检查实体是否拥有指定类型的组件
10519
+ * @en Check if entity has component of specified type
10000
10520
  *
10001
- * @param type - 组件类型构造函数
10002
- * @returns 如果实体拥有该组件返回true,否则返回false
10521
+ * @param type - @zh 组件类型构造函数 @en Component type constructor
10522
+ * @returns @zh 如果实体拥有该组件返回true @en Returns true if entity has the component
10003
10523
  *
10004
10524
  * @example
10005
10525
  * ```typescript
@@ -10011,33 +10531,32 @@ declare class Entity {
10011
10531
  */
10012
10532
  hasComponent<T extends Component>(type: ComponentType<T>): boolean;
10013
10533
  /**
10014
- * 获取或创建指定类型的组件
10534
+ * @zh 获取或创建指定类型的组件
10535
+ * @en Get or create component of specified type
10015
10536
  *
10016
- * 如果组件已存在则返回现有组件,否则创建新组件并添加到实体
10537
+ * @zh 如果组件已存在则返回现有组件,否则创建新组件并添加到实体
10538
+ * @en Returns existing component if present, otherwise creates and adds new component
10017
10539
  *
10018
- * @param type - 组件类型构造函数
10019
- * @param args - 组件构造函数参数(仅在创建新组件时使用)
10020
- * @returns 组件实例
10540
+ * @param type - @zh 组件类型构造函数 @en Component type constructor
10541
+ * @param args - @zh 组件构造函数参数(仅在创建新组件时使用)@en Constructor arguments (only used when creating new component)
10542
+ * @returns @zh 组件实例 @en Component instance
10021
10543
  *
10022
10544
  * @example
10023
10545
  * ```typescript
10024
- * // 确保实体拥有Position组件
10546
+ * // @zh 确保实体拥有Position组件 | @en Ensure entity has Position component
10025
10547
  * const position = entity.getOrCreateComponent(Position, 0, 0);
10026
10548
  * position.x = 100;
10027
10549
  * ```
10028
10550
  */
10029
10551
  getOrCreateComponent<T extends Component>(type: ComponentType<T>, ...args: ConstructorParameters<ComponentType<T>>): T;
10030
10552
  /**
10031
- * 标记组件为已修改
10032
- *
10033
- * 便捷方法,自动从场景获取当前 epoch 并标记组件。
10034
- * 用于帧级变更检测系统。
10553
+ * @zh 标记组件为已修改
10554
+ * @en Mark component(s) as modified
10035
10555
  *
10036
- * Mark component(s) as modified.
10037
- * Convenience method that auto-gets epoch from scene and marks components.
10038
- * Used for frame-level change detection system.
10556
+ * @zh 便捷方法,自动从场景获取当前 epoch 并标记组件。用于帧级变更检测系统。
10557
+ * @en Convenience method that auto-gets epoch from scene and marks components. Used for frame-level change detection system.
10039
10558
  *
10040
- * @param components 要标记的组件 | Components to mark
10559
+ * @param components - @zh 要标记的组件 @en Components to mark
10041
10560
  *
10042
10561
  * @example
10043
10562
  * ```typescript
@@ -10045,33 +10564,37 @@ declare class Entity {
10045
10564
  * pos.x = 100;
10046
10565
  * entity.markDirty(pos);
10047
10566
  *
10048
- * // 或者标记多个组件
10567
+ * // @zh 或者标记多个组件 | @en Or mark multiple components
10049
10568
  * entity.markDirty(pos, vel);
10050
10569
  * ```
10051
10570
  */
10052
10571
  markDirty(...components: Component[]): void;
10053
10572
  /**
10054
- * 移除指定的组件
10573
+ * @zh 移除指定的组件
10574
+ * @en Remove specified component
10055
10575
  *
10056
- * @param component - 要移除的组件实例
10576
+ * @param component - @zh 要移除的组件实例 @en Component instance to remove
10057
10577
  */
10058
10578
  removeComponent(component: Component): void;
10059
10579
  /**
10060
- * 移除指定类型的组件
10580
+ * @zh 移除指定类型的组件
10581
+ * @en Remove component by type
10061
10582
  *
10062
- * @param type - 组件类型
10063
- * @returns 被移除的组件实例或null
10583
+ * @param type - @zh 组件类型 @en Component type
10584
+ * @returns @zh 被移除的组件实例或null @en Removed component instance or null
10064
10585
  */
10065
10586
  removeComponentByType<T extends Component>(type: ComponentType<T>): T | null;
10066
10587
  /**
10067
- * 移除所有组件
10588
+ * @zh 移除所有组件
10589
+ * @en Remove all components
10068
10590
  */
10069
10591
  removeAllComponents(): void;
10070
10592
  /**
10071
- * 批量添加组件
10593
+ * @zh 批量添加组件
10594
+ * @en Add multiple components
10072
10595
  *
10073
- * @param components - 要添加的组件数组
10074
- * @returns 添加的组件数组
10596
+ * @param components - @zh 要添加的组件数组 @en Array of components to add
10597
+ * @returns @zh 添加的组件数组 @en Array of added components
10075
10598
  */
10076
10599
  addComponents<T extends Component>(components: T[]): T[];
10077
10600
  /**
@@ -10112,17 +10635,19 @@ declare class Entity {
10112
10635
  */
10113
10636
  private onActiveChanged;
10114
10637
  /**
10115
- * 销毁实体
10638
+ * @zh 销毁实体
10639
+ * @en Destroy entity
10116
10640
  *
10117
- * 移除所有组件并标记为已销毁。
10118
- * 层级关系的清理由 HierarchySystem 处理。
10641
+ * @zh 移除所有组件并标记为已销毁。层级关系的清理由 HierarchySystem 处理。
10642
+ * @en Removes all components and marks as destroyed. Hierarchy cleanup is handled by HierarchySystem.
10119
10643
  */
10120
10644
  destroy(): void;
10121
10645
  /**
10122
- * 比较实体
10646
+ * @zh 比较实体优先级
10647
+ * @en Compare entity priority
10123
10648
  *
10124
- * @param other - 另一个实体
10125
- * @returns 比较结果
10649
+ * @param other - @zh 另一个实体 @en Another entity
10650
+ * @returns @zh 比较结果 @en Comparison result
10126
10651
  */
10127
10652
  compareTo(other: Entity): number;
10128
10653
  /**
@@ -11013,85 +11538,97 @@ declare class SceneManager implements IService {
11013
11538
  }
11014
11539
 
11015
11540
  /**
11016
- * 全局系统接口
11017
- * 全局系统是在World级别运行的系统,不依赖特定Scene
11541
+ * @zh 全局系统接口
11542
+ * @en Global system interface
11543
+ *
11544
+ * @zh 全局系统是在World级别运行的系统,不依赖特定Scene
11545
+ * @en Global systems run at World level and don't depend on specific Scene
11018
11546
  */
11019
- type IGlobalSystem = {
11547
+ interface IGlobalSystem {
11020
11548
  /**
11021
- * 系统名称
11549
+ * @zh 系统名称
11550
+ * @en System name
11022
11551
  */
11023
11552
  readonly name: string;
11024
11553
  /**
11025
- * 初始化系统
11554
+ * @zh 初始化系统
11555
+ * @en Initialize system
11026
11556
  */
11027
11557
  initialize?(): void;
11028
11558
  /**
11029
- * 更新系统
11559
+ * @zh 更新系统
11560
+ * @en Update system
11030
11561
  */
11031
11562
  update(deltaTime?: number): void;
11032
11563
  /**
11033
- * 重置系统
11564
+ * @zh 重置系统
11565
+ * @en Reset system
11034
11566
  */
11035
11567
  reset?(): void;
11036
11568
  /**
11037
- * 销毁系统
11569
+ * @zh 销毁系统
11570
+ * @en Destroy system
11038
11571
  */
11039
11572
  destroy?(): void;
11040
- };
11573
+ }
11041
11574
  /**
11042
- * World配置接口
11575
+ * @zh World配置接口
11576
+ * @en World configuration interface
11043
11577
  */
11044
- type IWorldConfig = {
11578
+ interface IWorldConfig {
11045
11579
  /**
11046
- * World名称
11580
+ * @zh World名称
11581
+ * @en World name
11047
11582
  */
11048
11583
  name?: string;
11049
11584
  /**
11050
- * 是否启用调试模式
11585
+ * @zh 是否启用调试模式
11586
+ * @en Enable debug mode
11051
11587
  */
11052
11588
  debug?: boolean;
11053
11589
  /**
11054
- * 最大Scene数量限制
11590
+ * @zh 最大Scene数量限制
11591
+ * @en Maximum number of scenes
11055
11592
  */
11056
11593
  maxScenes?: number;
11057
11594
  /**
11058
- * 是否自动清理空Scene
11595
+ * @zh 是否自动清理空Scene
11596
+ * @en Auto cleanup empty scenes
11059
11597
  */
11060
11598
  autoCleanup?: boolean;
11061
- };
11599
+ /**
11600
+ * @zh 自动清理阈值(毫秒),空Scene超过此时间后将被自动清理
11601
+ * @en Auto cleanup threshold (ms), empty scenes exceeding this time will be auto-cleaned
11602
+ * @default 300000 (5 minutes)
11603
+ */
11604
+ cleanupThresholdMs?: number;
11605
+ }
11062
11606
  /**
11063
- * World类 - ECS世界管理器
11607
+ * @zh World类 - ECS世界管理器
11608
+ * @en World class - ECS world manager
11064
11609
  *
11065
- * World是Scene的容器,每个World可以管理多个Scene。
11610
+ * @zh World是Scene的容器,每个World可以管理多个Scene。
11066
11611
  * World拥有独立的服务容器,用于管理World级别的全局服务。
11612
+ * @en World is a container for Scenes, each World can manage multiple Scenes.
11613
+ * World has its own service container for managing World-level global services.
11067
11614
  *
11068
- * 服务容器层级:
11615
+ * @zh 服务容器层级:
11069
11616
  * - Core.services: 应用程序全局服务
11070
11617
  * - World.services: World级别服务(每个World独立)
11071
11618
  * - Scene.services: Scene级别服务(每个Scene独立)
11072
- *
11073
- * 这种设计允许创建独立的游戏世界,如:
11074
- * - 游戏房间(每个房间一个World
11075
- * - 不同的游戏模式
11076
- * - 独立的模拟环境
11619
+ * @en Service container hierarchy:
11620
+ * - Core.services: Application-wide global services
11621
+ * - World.services: World-level services (independent per World)
11622
+ * - Scene.services: Scene-level services (independent per Scene)
11077
11623
  *
11078
11624
  * @example
11079
11625
  * ```typescript
11080
- * // 创建游戏房间的World
11081
11626
  * const roomWorld = new World({ name: 'Room_001' });
11082
- *
11083
- * // 注册World级别的服务
11084
11627
  * roomWorld.services.registerSingleton(RoomManager);
11085
11628
  *
11086
- * // 在World中创建Scene
11087
- * const gameScene = roomWorld.createScene('game', new Scene());
11088
- * const uiScene = roomWorld.createScene('ui', new Scene());
11089
- *
11090
- * // 在Scene中使用World级别的服务
11091
- * const roomManager = roomWorld.services.resolve(RoomManager);
11092
- *
11093
- * // 更新整个World
11094
- * roomWorld.update(deltaTime);
11629
+ * const gameScene = roomWorld.createScene('game');
11630
+ * roomWorld.setSceneActive('game', true);
11631
+ * roomWorld.start();
11095
11632
  * ```
11096
11633
  */
11097
11634
  declare class World {
@@ -11101,87 +11638,142 @@ declare class World {
11101
11638
  private readonly _activeScenes;
11102
11639
  private readonly _globalSystems;
11103
11640
  private readonly _services;
11641
+ private readonly _createdAt;
11104
11642
  private _isActive;
11105
- private _createdAt;
11106
11643
  constructor(config?: IWorldConfig);
11107
11644
  /**
11108
- * World级别的服务容器
11109
- * 用于管理World范围内的全局服务
11645
+ * @zh World级别的服务容器
11646
+ * @en World-level service container
11110
11647
  */
11111
11648
  get services(): ServiceContainer;
11112
11649
  /**
11113
- * 创建并添加Scene到World
11650
+ * @zh 检查World是否激活
11651
+ * @en Check if World is active
11652
+ */
11653
+ get isActive(): boolean;
11654
+ /**
11655
+ * @zh 获取Scene数量
11656
+ * @en Get scene count
11657
+ */
11658
+ get sceneCount(): number;
11659
+ /**
11660
+ * @zh 获取创建时间
11661
+ * @en Get creation time
11662
+ */
11663
+ get createdAt(): number;
11664
+ /**
11665
+ * @zh 创建并添加Scene到World
11666
+ * @en Create and add Scene to World
11667
+ *
11668
+ * @param sceneName - @zh Scene名称 @en Scene name
11669
+ * @param sceneInstance - @zh Scene实例(可选)@en Scene instance (optional)
11670
+ * @returns @zh 创建的Scene实例 @en Created Scene instance
11671
+ * @throws @zh 名称为空、重复或超出限制时抛出错误 @en Throws if name is empty, duplicate, or limit exceeded
11114
11672
  */
11115
11673
  createScene<T extends IScene>(sceneName: string, sceneInstance?: T): T;
11116
11674
  /**
11117
- * 移除Scene
11675
+ * @zh 移除Scene
11676
+ * @en Remove Scene
11677
+ *
11678
+ * @param sceneName - @zh Scene名称 @en Scene name
11679
+ * @returns @zh 是否成功移除 @en Whether removal was successful
11118
11680
  */
11119
11681
  removeScene(sceneName: string): boolean;
11120
11682
  /**
11121
- * 获取Scene
11683
+ * @zh 移除所有Scene
11684
+ * @en Remove all Scenes
11685
+ */
11686
+ removeAllScenes(): void;
11687
+ /**
11688
+ * @zh 获取Scene
11689
+ * @en Get Scene
11690
+ *
11691
+ * @param sceneName - @zh Scene名称 @en Scene name
11692
+ * @returns @zh Scene实例或null @en Scene instance or null
11122
11693
  */
11123
11694
  getScene<T extends IScene>(sceneName: string): T | null;
11124
11695
  /**
11125
- * 获取所有Scene ID
11696
+ * @zh 获取所有Scene ID
11697
+ * @en Get all Scene IDs
11126
11698
  */
11127
11699
  getSceneIds(): string[];
11128
11700
  /**
11129
- * 获取所有Scene
11701
+ * @zh 获取所有Scene
11702
+ * @en Get all Scenes
11130
11703
  */
11131
11704
  getAllScenes(): IScene[];
11132
11705
  /**
11133
- * 移除所有Scene
11134
- */
11135
- removeAllScenes(): void;
11136
- /**
11137
- * 设置Scene激活状态
11706
+ * @zh 设置Scene激活状态
11707
+ * @en Set Scene active state
11708
+ *
11709
+ * @param sceneName - @zh Scene名称 @en Scene name
11710
+ * @param active - @zh 是否激活 @en Whether to activate
11138
11711
  */
11139
11712
  setSceneActive(sceneName: string, active: boolean): void;
11140
11713
  /**
11141
- * 检查Scene是否激活
11714
+ * @zh 检查Scene是否激活
11715
+ * @en Check if Scene is active
11142
11716
  */
11143
11717
  isSceneActive(sceneName: string): boolean;
11144
11718
  /**
11145
- * 获取活跃Scene数量
11719
+ * @zh 获取活跃Scene数量
11720
+ * @en Get active Scene count
11146
11721
  */
11147
11722
  getActiveSceneCount(): number;
11148
11723
  /**
11149
- * 添加全局System
11150
- * 全局System会在所有激活Scene之前更新
11724
+ * @zh 添加全局System
11725
+ * @en Add global System
11726
+ *
11727
+ * @param system - @zh 全局System实例 @en Global System instance
11728
+ * @returns @zh 添加的System实例 @en Added System instance
11151
11729
  */
11152
11730
  addGlobalSystem<T extends IGlobalSystem>(system: T): T;
11153
11731
  /**
11154
- * 移除全局System
11732
+ * @zh 移除全局System
11733
+ * @en Remove global System
11734
+ *
11735
+ * @param system - @zh 要移除的System @en System to remove
11736
+ * @returns @zh 是否成功移除 @en Whether removal was successful
11155
11737
  */
11156
11738
  removeGlobalSystem(system: IGlobalSystem): boolean;
11157
11739
  /**
11158
- * 获取全局System
11740
+ * @zh 获取全局System
11741
+ * @en Get global System
11742
+ *
11743
+ * @param type - @zh System类型 @en System type
11744
+ * @returns @zh System实例或null @en System instance or null
11159
11745
  */
11160
- getGlobalSystem<T extends IGlobalSystem>(type: new (...args: any[]) => T): T | null;
11746
+ getGlobalSystem<T extends IGlobalSystem>(type: new (...args: unknown[]) => T): T | null;
11161
11747
  /**
11162
- * 启动World
11748
+ * @zh 启动World
11749
+ * @en Start World
11163
11750
  */
11164
11751
  start(): void;
11165
11752
  /**
11166
- * 停止World
11753
+ * @zh 停止World
11754
+ * @en Stop World
11167
11755
  */
11168
11756
  stop(): void;
11169
11757
  /**
11170
- * 更新World中的全局System
11171
- * 注意:此方法由Core.update()调用,不应直接调用
11758
+ * @zh 销毁World
11759
+ * @en Destroy World
11172
11760
  */
11173
- updateGlobalSystems(): void;
11761
+ destroy(): void;
11174
11762
  /**
11175
- * 更新World中的所有激活Scene
11176
- * 注意:此方法由Core.update()调用,不应直接调用
11763
+ * @zh 更新World中的全局System
11764
+ * @en Update global systems in World
11765
+ * @internal
11177
11766
  */
11178
- updateScenes(): void;
11767
+ updateGlobalSystems(): void;
11179
11768
  /**
11180
- * 销毁World
11769
+ * @zh 更新World中的所有激活Scene
11770
+ * @en Update all active scenes in World
11771
+ * @internal
11181
11772
  */
11182
- destroy(): void;
11773
+ updateScenes(): void;
11183
11774
  /**
11184
- * 获取World状态
11775
+ * @zh 获取World状态
11776
+ * @en Get World status
11185
11777
  */
11186
11778
  getStatus(): {
11187
11779
  name: string;
@@ -11191,31 +11783,21 @@ declare class World {
11191
11783
  globalSystemCount: number;
11192
11784
  createdAt: number;
11193
11785
  config: {
11194
- /**
11195
- * World名称
11196
- */
11197
- name?: string;
11198
- /**
11199
- * 是否启用调试模式
11200
- */
11201
- debug?: boolean;
11202
- /**
11203
- * 最大Scene数量限制
11204
- */
11205
- maxScenes?: number;
11206
- /**
11207
- * 是否自动清理空Scene
11208
- */
11209
- autoCleanup?: boolean;
11786
+ name: string;
11787
+ debug: boolean;
11788
+ maxScenes: number;
11789
+ autoCleanup: boolean;
11790
+ cleanupThresholdMs: number;
11210
11791
  };
11211
11792
  scenes: {
11212
11793
  id: string;
11213
- isActive: boolean;
11214
11794
  name: string;
11795
+ isActive: boolean;
11215
11796
  }[];
11216
11797
  };
11217
11798
  /**
11218
- * 获取World统计信息
11799
+ * @zh 获取World统计信息
11800
+ * @en Get World statistics
11219
11801
  */
11220
11802
  getStats(): {
11221
11803
  totalEntities: number;
@@ -11227,79 +11809,71 @@ declare class World {
11227
11809
  };
11228
11810
  };
11229
11811
  /**
11230
- * 检查是否应该执行自动清理
11812
+ * @zh 验证Scene名称
11813
+ * @en Validate Scene name
11231
11814
  */
11232
- private shouldAutoCleanup;
11233
- /**
11234
- * 执行清理操作
11235
- */
11236
- private cleanup;
11237
- /**
11238
- * 检查World是否激活
11239
- */
11240
- get isActive(): boolean;
11815
+ private validateSceneName;
11241
11816
  /**
11242
- * 获取Scene数量
11817
+ * @zh 检查Scene是否可以被自动清理
11818
+ * @en Check if a scene is eligible for auto cleanup
11243
11819
  */
11244
- get sceneCount(): number;
11820
+ private isCleanupCandidate;
11245
11821
  /**
11246
- * 获取创建时间
11822
+ * @zh 执行自动清理操作
11823
+ * @en Execute auto cleanup operation
11247
11824
  */
11248
- get createdAt(): number;
11825
+ private cleanup;
11249
11826
  }
11250
11827
 
11251
11828
  /**
11252
- * WorldManager配置接口
11829
+ * @zh WorldManager配置接口
11830
+ * @en WorldManager configuration interface
11253
11831
  */
11254
- type IWorldManagerConfig = {
11832
+ interface IWorldManagerConfig {
11255
11833
  /**
11256
- * 最大World数量
11834
+ * @zh 最大World数量
11835
+ * @en Maximum number of worlds
11257
11836
  */
11258
11837
  maxWorlds?: number;
11259
11838
  /**
11260
- * 是否自动清理空World
11839
+ * @zh 是否自动清理空World
11840
+ * @en Auto cleanup empty worlds
11261
11841
  */
11262
11842
  autoCleanup?: boolean;
11263
11843
  /**
11264
- * 清理间隔(帧数)
11844
+ * @zh 清理间隔(帧数)
11845
+ * @en Cleanup interval in frames
11265
11846
  */
11266
11847
  cleanupFrameInterval?: number;
11267
11848
  /**
11268
- * 是否启用调试模式
11849
+ * @zh 是否启用调试模式
11850
+ * @en Enable debug mode
11269
11851
  */
11270
11852
  debug?: boolean;
11271
- };
11853
+ }
11272
11854
  /**
11273
- * World管理器 - 管理所有World实例
11855
+ * @zh World管理器 - 管理所有World实例
11856
+ * @en World Manager - Manages all World instances
11274
11857
  *
11275
- * WorldManager负责管理多个独立的World实例。
11858
+ * @zh WorldManager负责管理多个独立的World实例。
11276
11859
  * 每个World都是独立的ECS环境,可以包含多个Scene。
11860
+ * @en WorldManager is responsible for managing multiple independent World instances.
11861
+ * Each World is an isolated ECS environment that can contain multiple Scenes.
11277
11862
  *
11278
- * 适用场景:
11863
+ * @zh 适用场景:
11279
11864
  * - MMO游戏的多房间管理
11280
11865
  * - 服务器端的多游戏实例
11281
11866
  * - 需要完全隔离的多个游戏环境
11867
+ * @en Use cases:
11868
+ * - Multi-room management for MMO games
11869
+ * - Multiple game instances on server-side
11870
+ * - Completely isolated game environments
11282
11871
  *
11283
11872
  * @example
11284
11873
  * ```typescript
11285
- * // 创建WorldManager实例
11286
- * const worldManager = new WorldManager({
11287
- * maxWorlds: 100,
11288
- * autoCleanup: true
11289
- * });
11290
- *
11291
- * // 创建游戏房间World
11292
- * const room1 = worldManager.createWorld('room_001', {
11293
- * name: 'GameRoom_001',
11294
- * maxScenes: 5
11295
- * });
11296
- * room1.setActive(true);
11297
- *
11298
- * // 游戏循环
11299
- * function gameLoop(deltaTime: number) {
11300
- * Core.update(deltaTime);
11301
- * worldManager.updateAll(); // 更新所有活跃World
11302
- * }
11874
+ * const worldManager = new WorldManager({ maxWorlds: 100 });
11875
+ * const room = worldManager.createWorld('room_001');
11876
+ * worldManager.setWorldActive('room_001', true);
11303
11877
  * ```
11304
11878
  */
11305
11879
  declare class WorldManager implements IService {
@@ -11309,70 +11883,124 @@ declare class WorldManager implements IService {
11309
11883
  private _framesSinceCleanup;
11310
11884
  constructor(config?: IWorldManagerConfig);
11311
11885
  /**
11312
- * 创建新World
11886
+ * @zh 获取World总数
11887
+ * @en Get total world count
11888
+ */
11889
+ get worldCount(): number;
11890
+ /**
11891
+ * @zh 获取激活World数量
11892
+ * @en Get active world count
11893
+ */
11894
+ get activeWorldCount(): number;
11895
+ /**
11896
+ * @zh 检查是否正在运行
11897
+ * @en Check if running
11898
+ */
11899
+ get isRunning(): boolean;
11900
+ /**
11901
+ * @zh 获取配置
11902
+ * @en Get configuration
11903
+ */
11904
+ get config(): IWorldManagerConfig;
11905
+ /**
11906
+ * @zh 创建新World
11907
+ * @en Create new World
11908
+ *
11909
+ * @param worldName - @zh World名称 @en World name
11910
+ * @param config - @zh World配置 @en World configuration
11911
+ * @returns @zh 创建的World实例 @en Created World instance
11912
+ * @throws @zh 名称为空、重复或超出限制时抛出错误 @en Throws if name is empty, duplicate, or limit exceeded
11313
11913
  */
11314
11914
  createWorld(worldName: string, config?: IWorldConfig): World;
11315
11915
  /**
11316
- * 移除World
11916
+ * @zh 移除World
11917
+ * @en Remove World
11918
+ *
11919
+ * @param worldName - @zh World名称 @en World name
11920
+ * @returns @zh 是否成功移除 @en Whether removal was successful
11317
11921
  */
11318
11922
  removeWorld(worldName: string): boolean;
11319
11923
  /**
11320
- * 获取World
11924
+ * @zh 获取World
11925
+ * @en Get World
11926
+ *
11927
+ * @param worldName - @zh World名称 @en World name
11928
+ * @returns @zh World实例或null @en World instance or null
11321
11929
  */
11322
11930
  getWorld(worldName: string): World | null;
11323
11931
  /**
11324
- * 获取所有World ID
11932
+ * @zh 获取所有World ID
11933
+ * @en Get all World IDs
11325
11934
  */
11326
11935
  getWorldIds(): string[];
11327
11936
  /**
11328
- * 获取所有World
11937
+ * @zh 获取所有World
11938
+ * @en Get all Worlds
11329
11939
  */
11330
11940
  getAllWorlds(): World[];
11331
11941
  /**
11332
- * 设置World激活状态
11942
+ * @zh 设置World激活状态
11943
+ * @en Set World active state
11944
+ *
11945
+ * @param worldName - @zh World名称 @en World name
11946
+ * @param active - @zh 是否激活 @en Whether to activate
11333
11947
  */
11334
11948
  setWorldActive(worldName: string, active: boolean): void;
11335
11949
  /**
11336
- * 检查World是否激活
11950
+ * @zh 检查World是否激活
11951
+ * @en Check if World is active
11337
11952
  */
11338
11953
  isWorldActive(worldName: string): boolean;
11339
11954
  /**
11340
- * 更新所有活跃的World
11341
- *
11342
- * 应该在每帧的游戏循环中调用。
11343
- * 会自动更新所有活跃World的全局系统和场景。
11955
+ * @zh 获取所有激活的World
11956
+ * @en Get all active Worlds
11957
+ */
11958
+ getActiveWorlds(): World[];
11959
+ /**
11960
+ * @zh 查找满足条件的World
11961
+ * @en Find Worlds matching predicate
11344
11962
  *
11345
- * @example
11346
- * ```typescript
11347
- * function gameLoop(deltaTime: number) {
11348
- * Core.update(deltaTime); // 更新全局服务
11349
- * worldManager.updateAll(); // 更新所有World
11350
- * }
11351
- * ```
11963
+ * @param predicate - @zh 过滤条件 @en Filter predicate
11352
11964
  */
11353
- updateAll(): void;
11965
+ findWorlds(predicate: (world: World) => boolean): World[];
11354
11966
  /**
11355
- * 获取所有激活的World
11967
+ * @zh 根据名称查找World
11968
+ * @en Find World by name
11969
+ *
11970
+ * @param name - @zh World名称 @en World name
11356
11971
  */
11357
- getActiveWorlds(): World[];
11972
+ findWorldByName(name: string): World | null;
11358
11973
  /**
11359
- * 启动所有World
11974
+ * @zh 启动所有World
11975
+ * @en Start all Worlds
11360
11976
  */
11361
11977
  startAll(): void;
11362
11978
  /**
11363
- * 停止所有World
11979
+ * @zh 停止所有World
11980
+ * @en Stop all Worlds
11981
+ */
11982
+ stopAll(): void;
11983
+ /**
11984
+ * @zh 销毁WorldManager
11985
+ * @en Destroy WorldManager
11364
11986
  */
11365
- stopAll(): void;
11987
+ destroy(): void;
11366
11988
  /**
11367
- * 查找满足条件的World
11989
+ * @zh 实现 IService 接口的 dispose 方法
11990
+ * @en Implement IService dispose method
11368
11991
  */
11369
- findWorlds(predicate: (world: World) => boolean): World[];
11992
+ dispose(): void;
11370
11993
  /**
11371
- * 根据名称查找World
11994
+ * @zh 更新所有活跃的World
11995
+ * @en Update all active Worlds
11996
+ *
11997
+ * @zh 应该在每帧的游戏循环中调用
11998
+ * @en Should be called in each frame of game loop
11372
11999
  */
11373
- findWorldByName(name: string): World | null;
12000
+ updateAll(): void;
11374
12001
  /**
11375
- * 获取WorldManager统计信息
12002
+ * @zh 获取WorldManager统计信息
12003
+ * @en Get WorldManager statistics
11376
12004
  */
11377
12005
  getStats(): {
11378
12006
  totalWorlds: number;
@@ -11388,34 +12016,24 @@ declare class WorldManager implements IService {
11388
12016
  cleanupFrameInterval: number;
11389
12017
  debug: boolean;
11390
12018
  };
11391
- worlds: any[];
12019
+ worlds: {
12020
+ id: string;
12021
+ name: string;
12022
+ isActive: boolean;
12023
+ sceneCount: number;
12024
+ totalEntities: number;
12025
+ totalSystems: number;
12026
+ }[];
11392
12027
  };
11393
12028
  /**
11394
- * 获取详细状态信息
12029
+ * @zh 获取详细状态信息
12030
+ * @en Get detailed status information
11395
12031
  */
11396
12032
  getDetailedStatus(): {
11397
12033
  worlds: {
11398
12034
  id: string;
11399
12035
  isActive: boolean;
11400
- status: {
11401
- name: string;
11402
- isActive: boolean;
11403
- sceneCount: number;
11404
- activeSceneCount: number;
11405
- globalSystemCount: number;
11406
- createdAt: number;
11407
- config: {
11408
- name?: string;
11409
- debug?: boolean;
11410
- maxScenes?: number;
11411
- autoCleanup?: boolean;
11412
- };
11413
- scenes: {
11414
- id: string;
11415
- isActive: boolean;
11416
- name: string;
11417
- }[];
11418
- };
12036
+ status: ReturnType<World["getStatus"]>;
11419
12037
  }[];
11420
12038
  totalWorlds: number;
11421
12039
  activeWorlds: number;
@@ -11432,42 +12050,30 @@ declare class WorldManager implements IService {
11432
12050
  };
11433
12051
  };
11434
12052
  /**
11435
- * 清理空World
12053
+ * @zh 清理空World
12054
+ * @en Cleanup empty Worlds
12055
+ *
12056
+ * @returns @zh 清理的World数量 @en Number of cleaned up Worlds
11436
12057
  */
11437
12058
  cleanup(): number;
11438
12059
  /**
11439
- * 销毁WorldManager
11440
- */
11441
- destroy(): void;
11442
- /**
11443
- * 实现 IService 接口的 dispose 方法
11444
- * 调用 destroy 方法进行清理
12060
+ * @zh 验证World名称
12061
+ * @en Validate World name
11445
12062
  */
11446
- dispose(): void;
11447
- /**
11448
- * 判断World是否应该被清理
11449
- * 清理策略:
11450
- * 1. World未激活
11451
- * 2. 没有Scene或所有Scene都是空的
11452
- * 3. 创建时间超过10分钟
11453
- */
11454
- private shouldCleanupWorld;
11455
- /**
11456
- * 获取World总数
11457
- */
11458
- get worldCount(): number;
11459
- /**
11460
- * 获取激活World数量
11461
- */
11462
- get activeWorldCount(): number;
12063
+ private validateWorldName;
11463
12064
  /**
11464
- * 检查是否正在运行
12065
+ * @zh 处理自动清理
12066
+ * @en Process auto cleanup
11465
12067
  */
11466
- get isRunning(): boolean;
12068
+ private processAutoCleanup;
11467
12069
  /**
11468
- * 获取配置
12070
+ * @zh 判断World是否应该被清理
12071
+ * @en Check if World should be cleaned up
12072
+ *
12073
+ * @zh 清理策略:未激活 + (无Scene或全空Scene) + 创建超过10分钟
12074
+ * @en Cleanup policy: inactive + (no scenes or all empty) + created over 10 minutes ago
11469
12075
  */
11470
- get config(): IWorldManagerConfig;
12076
+ private isCleanupCandidate;
11471
12077
  }
11472
12078
 
11473
12079
  /**
@@ -11666,15 +12272,19 @@ declare class EventBus implements IEventBus {
11666
12272
  * 提供全局访问的事件总线
11667
12273
  */
11668
12274
  declare class GlobalEventBus {
11669
- private static instance;
12275
+ private static _instance;
11670
12276
  /**
11671
- * 获取全局事件总线实例
11672
- * @param debugMode 是否启用调试模式
12277
+ * @zh 获取全局事件总线实例
12278
+ * @en Get global event bus instance
12279
+ *
12280
+ * @param debugMode - @zh 是否启用调试模式 @en Whether to enable debug mode
11673
12281
  */
11674
12282
  static getInstance(debugMode?: boolean): EventBus;
11675
12283
  /**
11676
- * 重置全局事件总线实例
11677
- * @param debugMode 是否启用调试模式
12284
+ * @zh 重置全局事件总线实例
12285
+ * @en Reset global event bus instance
12286
+ *
12287
+ * @param debugMode - @zh 是否启用调试模式 @en Whether to enable debug mode
11678
12288
  */
11679
12289
  static reset(debugMode?: boolean): EventBus;
11680
12290
  }
@@ -11744,51 +12354,61 @@ interface ComponentUsageTracker {
11744
12354
  * 全局组件池管理器
11745
12355
  */
11746
12356
  declare class ComponentPoolManager {
11747
- private static instance;
11748
- private pools;
11749
- private usageTracker;
11750
- private autoCleanupInterval;
11751
- private lastCleanupTime;
12357
+ private static _instance;
12358
+ private _pools;
12359
+ private _usageTracker;
12360
+ private _autoCleanupInterval;
12361
+ private _lastCleanupTime;
11752
12362
  private constructor();
11753
12363
  static getInstance(): ComponentPoolManager;
11754
12364
  /**
11755
- * 注册组件池
12365
+ * @zh 注册组件池
12366
+ * @en Register component pool
11756
12367
  */
11757
12368
  registerPool<T extends Component>(componentName: string, createFn: () => T, resetFn?: (component: T) => void, maxSize?: number, minSize?: number): void;
11758
12369
  /**
11759
- * 获取组件实例
12370
+ * @zh 获取组件实例
12371
+ * @en Acquire component instance
11760
12372
  */
11761
12373
  acquireComponent<T extends Component>(componentName: string): T | null;
11762
12374
  /**
11763
- * 释放组件实例
12375
+ * @zh 释放组件实例
12376
+ * @en Release component instance
11764
12377
  */
11765
12378
  releaseComponent<T extends Component>(componentName: string, component: T): void;
11766
12379
  /**
11767
- * 追踪使用情况
12380
+ * @zh 追踪使用情况
12381
+ * @en Track usage
11768
12382
  */
11769
- private trackUsage;
12383
+ private _trackUsage;
11770
12384
  /**
11771
- * 自动清理(定期调用)
12385
+ * @zh 自动清理(定期调用)
12386
+ * @en Auto cleanup (called periodically)
11772
12387
  */
11773
12388
  update(): void;
11774
12389
  /**
11775
- * 获取热点组件列表
12390
+ * @zh 获取热点组件列表
12391
+ * @en Get hot components list
11776
12392
  */
11777
12393
  getHotComponents(threshold?: number): string[];
11778
12394
  /**
11779
- * 预热所有池
12395
+ * @zh 预热所有池
12396
+ * @en Prewarm all pools
11780
12397
  */
11781
12398
  prewarmAll(count?: number): void;
11782
12399
  /**
11783
- * 清空所有池
12400
+ * @zh 清空所有池
12401
+ * @en Clear all pools
11784
12402
  */
11785
12403
  clearAll(): void;
11786
12404
  /**
11787
- * 重置管理器
12405
+ * @zh 重置管理器
12406
+ * @en Reset manager
11788
12407
  */
11789
12408
  reset(): void;
11790
12409
  /**
11791
- * 获取全局统计信息
12410
+ * @zh 获取全局统计信息
12411
+ * @en Get global stats
11792
12412
  */
11793
12413
  getGlobalStats(): Array<{
11794
12414
  componentName: string;
@@ -11796,14 +12416,16 @@ declare class ComponentPoolManager {
11796
12416
  usage: ComponentUsageTracker | undefined;
11797
12417
  }>;
11798
12418
  /**
11799
- * 获取池统计信息
12419
+ * @zh 获取池统计信息
12420
+ * @en Get pool stats
11800
12421
  */
11801
12422
  getPoolStats(): Map<string, {
11802
12423
  available: number;
11803
12424
  maxSize: number;
11804
12425
  }>;
11805
12426
  /**
11806
- * 获取池利用率信息
12427
+ * @zh 获取池利用率信息
12428
+ * @en Get pool utilization info
11807
12429
  */
11808
12430
  getPoolUtilization(): Map<string, {
11809
12431
  used: number;
@@ -11811,7 +12433,8 @@ declare class ComponentPoolManager {
11811
12433
  utilization: number;
11812
12434
  }>;
11813
12435
  /**
11814
- * 获取指定组件的池利用率
12436
+ * @zh 获取指定组件的池利用率
12437
+ * @en Get component pool utilization
11815
12438
  */
11816
12439
  getComponentUtilization(componentName: string): number;
11817
12440
  }
@@ -12632,65 +13255,68 @@ type IPluginMetadata = {
12632
13255
  };
12633
13256
 
12634
13257
  /**
12635
- * 游戏引擎核心类
13258
+ * @zh 游戏引擎核心类
13259
+ * @en Game engine core class
12636
13260
  *
12637
- * 职责:
13261
+ * @zh 职责:
12638
13262
  * - 提供全局服务(Timer、Performance、Pool等)
12639
13263
  * - 管理场景生命周期(内置SceneManager)
12640
13264
  * - 管理全局管理器的生命周期
12641
13265
  * - 提供统一的游戏循环更新入口
13266
+ * @en Responsibilities:
13267
+ * - Provide global services (Timer, Performance, Pool, etc.)
13268
+ * - Manage scene lifecycle (built-in SceneManager)
13269
+ * - Manage global manager lifecycles
13270
+ * - Provide unified game loop update entry
12642
13271
  *
12643
13272
  * @example
12644
13273
  * ```typescript
12645
- * // 初始化并设置场景
13274
+ * // @zh 初始化并设置场景 | @en Initialize and set scene
12646
13275
  * Core.create({ debug: true });
12647
13276
  * Core.setScene(new GameScene());
12648
13277
  *
12649
- * // 游戏循环(自动更新全局服务和场景)
13278
+ * // @zh 游戏循环(自动更新全局服务和场景)| @en Game loop (auto-updates global services and scene)
12650
13279
  * function gameLoop(deltaTime: number) {
12651
13280
  * Core.update(deltaTime);
12652
13281
  * }
12653
13282
  *
12654
- * // 使用定时器
13283
+ * // @zh 使用定时器 | @en Use timer
12655
13284
  * Core.schedule(1.0, false, null, (timer) => {
12656
- * console.log("1秒后执行");
13285
+ * console.log("Executed after 1 second");
12657
13286
  * });
12658
13287
  *
12659
- * // 切换场景
12660
- * Core.loadScene(new MenuScene()); // 延迟切换
12661
- * Core.setScene(new GameScene()); // 立即切换
13288
+ * // @zh 切换场景 | @en Switch scene
13289
+ * Core.loadScene(new MenuScene()); // @zh 延迟切换 | @en Deferred switch
13290
+ * Core.setScene(new GameScene()); // @zh 立即切换 | @en Immediate switch
12662
13291
  *
12663
- * // 获取当前场景
13292
+ * // @zh 获取当前场景 | @en Get current scene
12664
13293
  * const currentScene = Core.scene;
12665
13294
  * ```
12666
13295
  */
12667
13296
  declare class Core {
12668
13297
  /**
12669
- * 游戏暂停状态
12670
- *
12671
- * 当设置为true时,游戏循环将暂停执行。
13298
+ * @zh 游戏暂停状态,当设置为true时,游戏循环将暂停执行
13299
+ * @en Game paused state, when set to true, game loop will pause execution
12672
13300
  */
12673
13301
  static paused: boolean;
12674
13302
  /**
12675
- * 全局核心实例
12676
- *
12677
- * 可能为null表示Core尚未初始化或已被销毁
13303
+ * @zh 全局核心实例,可能为null表示Core尚未初始化或已被销毁
13304
+ * @en Global core instance, null means Core is not initialized or destroyed
12678
13305
  */
12679
13306
  private static _instance;
12680
13307
  /**
12681
- * Core专用日志器
13308
+ * @zh Core专用日志器
13309
+ * @en Core logger
12682
13310
  */
12683
- private static _logger;
13311
+ private static readonly _logger;
12684
13312
  /**
12685
- * 调试模式标志
12686
- *
12687
- * 在调试模式下会启用额外的性能监控和错误检查。
13313
+ * @zh 调试模式标志,在调试模式下会启用额外的性能监控和错误检查
13314
+ * @en Debug mode flag, enables additional performance monitoring and error checking in debug mode
12688
13315
  */
12689
13316
  readonly debug: boolean;
12690
13317
  /**
12691
- * 服务容器
12692
- *
12693
- * 管理所有服务的注册、解析和生命周期。
13318
+ * @zh 服务容器,管理所有服务的注册、解析和生命周期
13319
+ * @en Service container for managing registration, resolution, and lifecycle of all services
12694
13320
  */
12695
13321
  private _serviceContainer;
12696
13322
  private _timerManager;
@@ -12698,102 +13324,105 @@ declare class Core {
12698
13324
  private _poolManager;
12699
13325
  private _debugManager?;
12700
13326
  /**
12701
- * 场景管理器
12702
- *
12703
- * 管理当前场景的生命周期。
13327
+ * @zh 场景管理器,管理当前场景的生命周期
13328
+ * @en Scene manager for managing current scene lifecycle
12704
13329
  */
12705
13330
  private _sceneManager;
12706
13331
  /**
12707
- * World管理器
12708
- *
12709
- * 管理多个独立的World实例(可选)。
13332
+ * @zh World管理器,管理多个独立的World实例(可选)
13333
+ * @en World manager for managing multiple independent World instances (optional)
12710
13334
  */
12711
13335
  private _worldManager;
12712
13336
  /**
12713
- * 插件管理器
12714
- *
12715
- * 管理所有插件的生命周期。
13337
+ * @zh 插件管理器,管理所有插件的生命周期
13338
+ * @en Plugin manager for managing all plugin lifecycles
12716
13339
  */
12717
13340
  private _pluginManager;
12718
13341
  /**
12719
- * 插件服务注册表
12720
- *
12721
- * 基于 ServiceToken 的类型安全服务注册表。
12722
- * Type-safe service registry based on ServiceToken.
13342
+ * @zh 插件服务注册表,基于 ServiceToken 的类型安全服务注册表
13343
+ * @en Plugin service registry, type-safe service registry based on ServiceToken
12723
13344
  */
12724
13345
  private _pluginServiceRegistry;
12725
13346
  /**
12726
- * Core配置
13347
+ * @zh Core配置
13348
+ * @en Core configuration
12727
13349
  */
12728
13350
  private _config;
12729
13351
  /**
12730
- * 创建核心实例
13352
+ * @zh 创建核心实例
13353
+ * @en Create core instance
12731
13354
  *
12732
- * @param config - Core配置对象
13355
+ * @param config - @zh Core配置对象 @en Core configuration object
12733
13356
  */
12734
13357
  private constructor();
12735
13358
  /**
12736
- * 获取核心实例
13359
+ * @zh 获取核心实例
13360
+ * @en Get core instance
12737
13361
  *
12738
- * @returns 全局核心实例
13362
+ * @returns @zh 全局核心实例 @en Global core instance
12739
13363
  */
12740
13364
  static get Instance(): Core | null;
12741
13365
  /**
12742
- * 获取服务容器
13366
+ * @zh 获取服务容器
13367
+ * @en Get service container
12743
13368
  *
12744
- * 用于注册和解析自定义服务。
13369
+ * @zh 用于注册和解析自定义服务。
13370
+ * @en Used for registering and resolving custom services.
12745
13371
  *
12746
- * @returns 服务容器实例
12747
- * @throws 如果Core实例未创建
13372
+ * @returns @zh 服务容器实例 @en Service container instance
13373
+ * @throws @zh 如果Core实例未创建 @en If Core instance is not created
12748
13374
  *
12749
13375
  * @example
12750
13376
  * ```typescript
12751
- * // 注册自定义服务
13377
+ * // @zh 注册自定义服务 | @en Register custom service
12752
13378
  * Core.services.registerSingleton(MyService);
12753
13379
  *
12754
- * // 解析服务
13380
+ * // @zh 解析服务 | @en Resolve service
12755
13381
  * const myService = Core.services.resolve(MyService);
12756
13382
  * ```
12757
13383
  */
12758
13384
  static get services(): ServiceContainer;
12759
13385
  /**
12760
- * 获取插件服务注册表
13386
+ * @zh 获取插件服务注册表
13387
+ * @en Get plugin service registry
12761
13388
  *
12762
- * 用于基于 ServiceToken 的类型安全服务注册和获取。
12763
- * For type-safe service registration and retrieval based on ServiceToken.
13389
+ * @zh 用于基于 ServiceToken 的类型安全服务注册和获取。
13390
+ * @en For type-safe service registration and retrieval based on ServiceToken.
12764
13391
  *
12765
- * @returns PluginServiceRegistry 实例
12766
- * @throws 如果 Core 实例未创建
13392
+ * @returns @zh PluginServiceRegistry 实例 @en PluginServiceRegistry instance
13393
+ * @throws @zh 如果 Core 实例未创建 @en If Core instance is not created
12767
13394
  *
12768
13395
  * @example
12769
13396
  * ```typescript
12770
13397
  * import { createServiceToken } from '@esengine/ecs-framework';
12771
13398
  *
12772
- * // 定义服务令牌
13399
+ * // @zh 定义服务令牌 | @en Define service token
12773
13400
  * const MyServiceToken = createServiceToken<IMyService>('myService');
12774
13401
  *
12775
- * // 注册服务
13402
+ * // @zh 注册服务 | @en Register service
12776
13403
  * Core.pluginServices.register(MyServiceToken, myServiceInstance);
12777
13404
  *
12778
- * // 获取服务(可选)
13405
+ * // @zh 获取服务(可选)| @en Get service (optional)
12779
13406
  * const service = Core.pluginServices.get(MyServiceToken);
12780
13407
  *
12781
- * // 获取服务(必需,不存在则抛异常)
13408
+ * // @zh 获取服务(必需,不存在则抛异常)| @en Get service (required, throws if not found)
12782
13409
  * const service = Core.pluginServices.require(MyServiceToken);
12783
13410
  * ```
12784
13411
  */
12785
13412
  static get pluginServices(): PluginServiceRegistry;
12786
13413
  /**
12787
- * 获取World管理器
13414
+ * @zh 获取World管理器
13415
+ * @en Get World manager
12788
13416
  *
12789
- * 用于管理多个独立的World实例(高级用户)。
13417
+ * @zh 用于管理多个独立的World实例(高级用户)。
13418
+ * @en For managing multiple independent World instances (advanced users).
12790
13419
  *
12791
- * @returns WorldManager实例
12792
- * @throws 如果Core实例未创建
13420
+ * @returns @zh WorldManager实例 @en WorldManager instance
13421
+ * @throws @zh 如果Core实例未创建 @en If Core instance is not created
12793
13422
  *
12794
13423
  * @example
12795
13424
  * ```typescript
12796
- * // 创建多个游戏房间
13425
+ * // @zh 创建多个游戏房间 | @en Create multiple game rooms
12797
13426
  * const wm = Core.worldManager;
12798
13427
  * const room1 = wm.createWorld('room_001');
12799
13428
  * room1.createScene('game', new GameScene());
@@ -12802,16 +13431,18 @@ declare class Core {
12802
13431
  */
12803
13432
  static get worldManager(): WorldManager;
12804
13433
  /**
12805
- * 创建Core实例
13434
+ * @zh 创建Core实例
13435
+ * @en Create Core instance
12806
13436
  *
12807
- * 如果实例已存在,则返回现有实例。
13437
+ * @zh 如果实例已存在,则返回现有实例。
13438
+ * @en If instance already exists, returns the existing instance.
12808
13439
  *
12809
- * @param config - Core配置,也可以直接传入boolean表示debug模式(向后兼容)
12810
- * @returns Core实例
13440
+ * @param config - @zh Core配置,也可以直接传入boolean表示debug模式(向后兼容) @en Core config, can also pass boolean for debug mode (backward compatible)
13441
+ * @returns @zh Core实例 @en Core instance
12811
13442
  *
12812
13443
  * @example
12813
13444
  * ```typescript
12814
- * // 方式1:使用配置对象
13445
+ * // @zh 方式1:使用配置对象 | @en Method 1: Use config object
12815
13446
  * Core.create({
12816
13447
  * debug: true,
12817
13448
  * debugConfig: {
@@ -12820,166 +13451,180 @@ declare class Core {
12820
13451
  * }
12821
13452
  * });
12822
13453
  *
12823
- * // 方式2:简单模式(向后兼容)
13454
+ * // @zh 方式2:简单模式(向后兼容)| @en Method 2: Simple mode (backward compatible)
12824
13455
  * Core.create(true); // debug = true
12825
13456
  * ```
12826
13457
  */
12827
13458
  static create(config?: ICoreConfig | boolean): Core;
12828
13459
  /**
12829
- * 设置当前场景
13460
+ * @zh 设置当前场景
13461
+ * @en Set current scene
12830
13462
  *
12831
- * @param scene - 要设置的场景
12832
- * @returns 设置的场景实例
13463
+ * @param scene - @zh 要设置的场景 @en The scene to set
13464
+ * @returns @zh 设置的场景实例 @en The scene instance that was set
12833
13465
  *
12834
13466
  * @example
12835
13467
  * ```typescript
12836
13468
  * Core.create({ debug: true });
12837
13469
  *
12838
- * // 创建并设置场景
13470
+ * // @zh 创建并设置场景 | @en Create and set scene
12839
13471
  * const gameScene = new GameScene();
12840
13472
  * Core.setScene(gameScene);
12841
13473
  * ```
12842
13474
  */
12843
13475
  static setScene<T extends IScene>(scene: T): T;
12844
13476
  /**
12845
- * 获取当前场景
13477
+ * @zh 获取当前场景
13478
+ * @en Get current scene
12846
13479
  *
12847
- * @returns 当前场景,如果没有场景则返回null
13480
+ * @returns @zh 当前场景,如果没有场景则返回null @en Current scene, or null if no scene
12848
13481
  */
12849
13482
  static get scene(): IScene | null;
12850
13483
  /**
12851
- * 获取ECS流式API
13484
+ * @zh 获取ECS流式API
13485
+ * @en Get ECS fluent API
12852
13486
  *
12853
- * @returns ECS API实例,如果当前没有场景则返回null
13487
+ * @returns @zh ECS API实例,如果当前没有场景则返回null @en ECS API instance, or null if no scene
12854
13488
  *
12855
13489
  * @example
12856
13490
  * ```typescript
12857
- * // 使用流式API创建实体
13491
+ * // @zh 使用流式API创建实体 | @en Create entity with fluent API
12858
13492
  * const player = Core.ecsAPI?.createEntity('Player')
12859
13493
  * .addComponent(Position, 100, 100)
12860
13494
  * .addComponent(Velocity, 50, 0);
12861
13495
  *
12862
- * // 查询实体
13496
+ * // @zh 查询实体 | @en Query entities
12863
13497
  * const enemies = Core.ecsAPI?.query(Enemy, Transform);
12864
13498
  *
12865
- * // 发射事件
13499
+ * // @zh 发射事件 | @en Emit event
12866
13500
  * Core.ecsAPI?.emit('game:start', { level: 1 });
12867
13501
  * ```
12868
13502
  */
12869
13503
  static get ecsAPI(): ECSFluentAPI | null;
12870
13504
  /**
12871
- * 延迟加载场景(下一帧切换)
13505
+ * @zh 延迟加载场景(下一帧切换)
13506
+ * @en Load scene with delay (switch on next frame)
12872
13507
  *
12873
- * @param scene - 要加载的场景
13508
+ * @param scene - @zh 要加载的场景 @en The scene to load
12874
13509
  *
12875
13510
  * @example
12876
13511
  * ```typescript
12877
- * // 延迟切换场景(在下一帧生效)
13512
+ * // @zh 延迟切换场景(在下一帧生效)| @en Deferred scene switch (takes effect next frame)
12878
13513
  * Core.loadScene(new MenuScene());
12879
13514
  * ```
12880
13515
  */
12881
13516
  static loadScene<T extends IScene>(scene: T): void;
12882
13517
  /**
12883
- * 更新游戏逻辑
13518
+ * @zh 更新游戏逻辑
13519
+ * @en Update game logic
12884
13520
  *
12885
- * 此方法应该在游戏引擎的更新循环中调用。
12886
- * 会自动更新全局服务和当前场景。
13521
+ * @zh 此方法应该在游戏引擎的更新循环中调用。会自动更新全局服务和当前场景。
13522
+ * @en This method should be called in the game engine's update loop. Automatically updates global services and current scene.
12887
13523
  *
12888
- * @param deltaTime - 外部引擎提供的帧时间间隔(秒)
13524
+ * @param deltaTime - @zh 外部引擎提供的帧时间间隔(秒)@en Frame delta time in seconds from external engine
12889
13525
  *
12890
13526
  * @example
12891
13527
  * ```typescript
12892
- * // 初始化
13528
+ * // @zh 初始化 | @en Initialize
12893
13529
  * Core.create({ debug: true });
12894
13530
  * Core.setScene(new GameScene());
12895
13531
  *
12896
- * // Laya引擎集成
13532
+ * // @zh Laya引擎集成 | @en Laya engine integration
12897
13533
  * Laya.timer.frameLoop(1, this, () => {
12898
13534
  * const deltaTime = Laya.timer.delta / 1000;
12899
- * Core.update(deltaTime); // 自动更新全局服务和场景
13535
+ * Core.update(deltaTime);
12900
13536
  * });
12901
13537
  *
12902
- * // Cocos Creator集成
13538
+ * // @zh Cocos Creator集成 | @en Cocos Creator integration
12903
13539
  * update(deltaTime: number) {
12904
- * Core.update(deltaTime); // 自动更新全局服务和场景
13540
+ * Core.update(deltaTime);
12905
13541
  * }
12906
13542
  * ```
12907
13543
  */
12908
13544
  static update(deltaTime: number): void;
12909
13545
  /**
12910
- * 调度定时器
13546
+ * @zh 调度定时器
13547
+ * @en Schedule a timer
12911
13548
  *
12912
- * 创建一个定时器,在指定时间后执行回调函数。
13549
+ * @zh 创建一个定时器,在指定时间后执行回调函数。
13550
+ * @en Create a timer that executes a callback after the specified time.
12913
13551
  *
12914
- * @param timeInSeconds - 延迟时间(秒)
12915
- * @param repeats - 是否重复执行,默认为false
12916
- * @param context - 回调函数的上下文,默认为null
12917
- * @param onTime - 定时器触发时的回调函数
12918
- * @returns 创建的定时器实例
12919
- * @throws 如果Core实例未创建或onTime回调未提供
13552
+ * @param timeInSeconds - @zh 延迟时间(秒)@en Delay time in seconds
13553
+ * @param repeats - @zh 是否重复执行,默认为false @en Whether to repeat, defaults to false
13554
+ * @param context - @zh 回调函数的上下文 @en Context for the callback
13555
+ * @param onTime - @zh 定时器触发时的回调函数 @en Callback when timer fires
13556
+ * @returns @zh 创建的定时器实例 @en The created timer instance
13557
+ * @throws @zh 如果Core实例未创建或onTime回调未提供 @en If Core instance not created or onTime not provided
12920
13558
  *
12921
13559
  * @example
12922
13560
  * ```typescript
12923
- * // 一次性定时器
13561
+ * // @zh 一次性定时器 | @en One-time timer
12924
13562
  * Core.schedule(1.0, false, null, (timer) => {
12925
- * console.log("1秒后执行一次");
13563
+ * console.log("Executed after 1 second");
12926
13564
  * });
12927
13565
  *
12928
- * // 重复定时器
13566
+ * // @zh 重复定时器 | @en Repeating timer
12929
13567
  * Core.schedule(0.5, true, null, (timer) => {
12930
- * console.log("0.5秒执行一次");
13568
+ * console.log("Executed every 0.5 seconds");
12931
13569
  * });
12932
13570
  * ```
12933
13571
  */
12934
13572
  static schedule<TContext = unknown>(timeInSeconds: number, repeats?: boolean, context?: TContext, onTime?: (timer: ITimer<TContext>) => void): Timer<TContext>;
12935
13573
  /**
12936
- * 启用调试功能
13574
+ * @zh 启用调试功能
13575
+ * @en Enable debug features
12937
13576
  *
12938
- * @param config 调试配置
13577
+ * @param config - @zh 调试配置 @en Debug configuration
12939
13578
  */
12940
13579
  static enableDebug(config: IECSDebugConfig): void;
12941
13580
  /**
12942
- * 禁用调试功能
13581
+ * @zh 禁用调试功能
13582
+ * @en Disable debug features
12943
13583
  */
12944
13584
  static disableDebug(): void;
12945
13585
  /**
12946
- * 获取调试数据
13586
+ * @zh 获取调试数据
13587
+ * @en Get debug data
12947
13588
  *
12948
- * @returns 当前调试数据,如果调试未启用则返回null
13589
+ * @returns @zh 当前调试数据,如果调试未启用则返回null @en Current debug data, or null if debug is disabled
12949
13590
  */
12950
13591
  static getDebugData(): unknown;
12951
13592
  /**
12952
- * 检查调试是否启用
13593
+ * @zh 检查调试是否启用
13594
+ * @en Check if debug is enabled
12953
13595
  *
12954
- * @returns 调试状态
13596
+ * @returns @zh 调试状态 @en Debug status
12955
13597
  */
12956
13598
  static get isDebugEnabled(): boolean;
12957
13599
  /**
12958
- * 获取性能监视器实例
13600
+ * @zh 获取性能监视器实例
13601
+ * @en Get performance monitor instance
12959
13602
  *
12960
- * @returns 性能监视器,如果Core未初始化则返回null
13603
+ * @returns @zh 性能监视器,如果Core未初始化则返回null @en Performance monitor, or null if Core not initialized
12961
13604
  */
12962
13605
  static get performanceMonitor(): PerformanceMonitor | null;
12963
13606
  /**
12964
- * 安装插件
13607
+ * @zh 安装插件
13608
+ * @en Install plugin
12965
13609
  *
12966
- * @param plugin - 插件实例
12967
- * @throws 如果Core实例未创建或插件安装失败
13610
+ * @param plugin - @zh 插件实例 @en Plugin instance
13611
+ * @throws @zh 如果Core实例未创建或插件安装失败 @en If Core instance not created or plugin installation fails
12968
13612
  *
12969
13613
  * @example
12970
13614
  * ```typescript
12971
13615
  * Core.create({ debug: true });
12972
13616
  *
12973
- * // 安装插件
13617
+ * // @zh 安装插件 | @en Install plugin
12974
13618
  * await Core.installPlugin(new MyPlugin());
12975
13619
  * ```
12976
13620
  */
12977
13621
  static installPlugin(plugin: IPlugin): Promise<void>;
12978
13622
  /**
12979
- * 卸载插件
13623
+ * @zh 卸载插件
13624
+ * @en Uninstall plugin
12980
13625
  *
12981
- * @param name - 插件名称
12982
- * @throws 如果Core实例未创建或插件卸载失败
13626
+ * @param name - @zh 插件名称 @en Plugin name
13627
+ * @throws @zh 如果Core实例未创建或插件卸载失败 @en If Core instance not created or plugin uninstallation fails
12983
13628
  *
12984
13629
  * @example
12985
13630
  * ```typescript
@@ -12988,10 +13633,11 @@ declare class Core {
12988
13633
  */
12989
13634
  static uninstallPlugin(name: string): Promise<void>;
12990
13635
  /**
12991
- * 获取插件实例
13636
+ * @zh 获取插件实例
13637
+ * @en Get plugin instance
12992
13638
  *
12993
- * @param name - 插件名称
12994
- * @returns 插件实例,如果未安装则返回undefined
13639
+ * @param name - @zh 插件名称 @en Plugin name
13640
+ * @returns @zh 插件实例,如果未安装则返回undefined @en Plugin instance, or undefined if not installed
12995
13641
  *
12996
13642
  * @example
12997
13643
  * ```typescript
@@ -13003,10 +13649,11 @@ declare class Core {
13003
13649
  */
13004
13650
  static getPlugin(name: string): IPlugin | undefined;
13005
13651
  /**
13006
- * 检查插件是否已安装
13652
+ * @zh 检查插件是否已安装
13653
+ * @en Check if plugin is installed
13007
13654
  *
13008
- * @param name - 插件名称
13009
- * @returns 是否已安装
13655
+ * @param name - @zh 插件名称 @en Plugin name
13656
+ * @returns @zh 是否已安装 @en Whether installed
13010
13657
  *
13011
13658
  * @example
13012
13659
  * ```typescript
@@ -13017,21 +13664,26 @@ declare class Core {
13017
13664
  */
13018
13665
  static isPluginInstalled(name: string): boolean;
13019
13666
  /**
13020
- * 初始化核心系统
13667
+ * @zh 初始化核心系统
13668
+ * @en Initialize core system
13021
13669
  *
13022
- * 执行核心系统的初始化逻辑。
13670
+ * @zh 执行核心系统的初始化逻辑。
13671
+ * @en Execute core system initialization logic.
13023
13672
  */
13024
13673
  protected initialize(): void;
13025
13674
  /**
13026
- * 内部更新方法
13675
+ * @zh 内部更新方法
13676
+ * @en Internal update method
13027
13677
  *
13028
- * @param deltaTime - 帧时间间隔(秒)
13678
+ * @param deltaTime - @zh 帧时间间隔(秒)@en Frame delta time in seconds
13029
13679
  */
13030
13680
  private updateInternal;
13031
13681
  /**
13032
- * 销毁Core实例
13682
+ * @zh 销毁Core实例
13683
+ * @en Destroy Core instance
13033
13684
  *
13034
- * 清理所有资源,通常在应用程序关闭时调用。
13685
+ * @zh 清理所有资源,通常在应用程序关闭时调用。
13686
+ * @en Clean up all resources, typically called when the application closes.
13035
13687
  */
13036
13688
  static destroy(): void;
13037
13689
  }
@@ -13297,9 +13949,10 @@ declare class RuntimeModeService implements IRuntimeMode {
13297
13949
  * @internal
13298
13950
  */
13299
13951
  updateMode(config: RuntimeModeConfig): void;
13952
+ private static readonly _logger;
13300
13953
  /**
13301
- * 通知模式变化
13302
- * Notify mode change
13954
+ * @zh 通知模式变化
13955
+ * @en Notify mode change
13303
13956
  */
13304
13957
  private _notifyChange;
13305
13958
  /**
@@ -15088,8 +15741,8 @@ declare class BinarySerializer {
15088
15741
  * 性能分析器 SDK
15089
15742
  */
15090
15743
  declare class ProfilerSDK {
15091
- private static instance;
15092
- private config;
15744
+ private static _instance;
15745
+ private _config;
15093
15746
  private currentFrame;
15094
15747
  private frameHistory;
15095
15748
  private frameNumber;
@@ -15103,11 +15756,13 @@ declare class ProfilerSDK {
15103
15756
  private performanceObserver;
15104
15757
  private constructor();
15105
15758
  /**
15106
- * 获取单例实例
15759
+ * @zh 获取单例实例
15760
+ * @en Get singleton instance
15107
15761
  */
15108
15762
  static getInstance(config?: Partial<ProfilerConfig>): ProfilerSDK;
15109
15763
  /**
15110
- * 重置实例(测试用)
15764
+ * @zh 重置实例(测试用)
15765
+ * @en Reset instance (for testing)
15111
15766
  */
15112
15767
  static resetInstance(): void;
15113
15768
  /**
@@ -15147,7 +15802,8 @@ declare class ProfilerSDK {
15147
15802
  */
15148
15803
  static setEnabled(enabled: boolean): void;
15149
15804
  /**
15150
- * 检查是否启用
15805
+ * @zh 检查是否启用
15806
+ * @en Check if enabled
15151
15807
  */
15152
15808
  static isEnabled(): boolean;
15153
15809
  /**
@@ -15167,11 +15823,13 @@ declare class ProfilerSDK {
15167
15823
  */
15168
15824
  static reset(): void;
15169
15825
  /**
15170
- * 开始采样
15826
+ * @zh 开始采样
15827
+ * @en Begin sample
15171
15828
  */
15172
15829
  beginSample(name: string, category?: ProfileCategory): SampleHandle | null;
15173
15830
  /**
15174
- * 结束采样
15831
+ * @zh 结束采样
15832
+ * @en End sample
15175
15833
  */
15176
15834
  endSample(handle: SampleHandle): void;
15177
15835
  /**
@@ -15183,23 +15841,28 @@ declare class ProfilerSDK {
15183
15841
  */
15184
15842
  measureAsync<T>(name: string, fn: () => Promise<T>, category?: ProfileCategory): Promise<T>;
15185
15843
  /**
15186
- * 开始帧
15844
+ * @zh 开始帧
15845
+ * @en Begin frame
15187
15846
  */
15188
15847
  beginFrame(): void;
15189
15848
  /**
15190
- * 结束帧
15849
+ * @zh 结束帧
15850
+ * @en End frame
15191
15851
  */
15192
15852
  endFrame(): void;
15193
15853
  /**
15194
- * 递增计数器
15854
+ * @zh 递增计数器
15855
+ * @en Increment counter
15195
15856
  */
15196
15857
  incrementCounter(name: string, value?: number, category?: ProfileCategory): void;
15197
15858
  /**
15198
- * 设置仪表值
15859
+ * @zh 设置仪表值
15860
+ * @en Set gauge value
15199
15861
  */
15200
15862
  setGauge(name: string, value: number, category?: ProfileCategory): void;
15201
15863
  /**
15202
- * 设置启用状态
15864
+ * @zh 设置启用状态
15865
+ * @en Set enabled state
15203
15866
  */
15204
15867
  setEnabled(enabled: boolean): void;
15205
15868
  /**
@@ -15211,10 +15874,13 @@ declare class ProfilerSDK {
15211
15874
  */
15212
15875
  generateReport(frameCount?: number): ProfileReport;
15213
15876
  /**
15214
- * 从帧历史构建调用图
15215
- * 注意:totalTime 存储的是平均耗时(总耗时/调用次数),而不是累计总耗时
15877
+ * @zh 从帧历史构建调用图
15878
+ * @en Build call graph from frame history
15879
+ *
15880
+ * @zh 注意:totalTime 存储的是平均耗时(总耗时/调用次数),而不是累计总耗时
15881
+ * @en Note: totalTime stores average time (total/count), not cumulative total
15216
15882
  */
15217
- private buildCallGraphFromFrames;
15883
+ private _buildCallGraphFromFrames;
15218
15884
  /**
15219
15885
  * 获取调用图数据
15220
15886
  */
@@ -15238,15 +15904,15 @@ declare class ProfilerSDK {
15238
15904
  * 释放资源
15239
15905
  */
15240
15906
  dispose(): void;
15241
- private captureMemory;
15242
- private resetFrameCounters;
15243
- private calculateSampleStats;
15244
- private calculateCategoryStats;
15245
- private updateCallGraph;
15246
- private aggregateSampleStats;
15247
- private aggregateCategoryStats;
15248
- private setupLongTaskObserver;
15249
- private createEmptyReport;
15907
+ private _captureMemory;
15908
+ private _resetFrameCounters;
15909
+ private _calculateSampleStats;
15910
+ private _calculateCategoryStats;
15911
+ private _updateCallGraph;
15912
+ private _aggregateSampleStats;
15913
+ private _aggregateCategoryStats;
15914
+ private _setupLongTaskObserver;
15915
+ private _createEmptyReport;
15250
15916
  }
15251
15917
 
15252
15918
  /**
@@ -15289,18 +15955,20 @@ interface SampleData {
15289
15955
  * 自动性能分析器
15290
15956
  */
15291
15957
  declare class AutoProfiler {
15292
- private static instance;
15293
- private config;
15958
+ private static _instance;
15959
+ private _config;
15294
15960
  private wrappedObjects;
15295
15961
  private samplingProfiler;
15296
15962
  private registeredClasses;
15297
15963
  private constructor();
15298
15964
  /**
15299
- * 获取单例实例
15965
+ * @zh 获取单例实例
15966
+ * @en Get singleton instance
15300
15967
  */
15301
15968
  static getInstance(config?: Partial<AutoProfilerConfig>): AutoProfiler;
15302
15969
  /**
15303
- * 重置实例
15970
+ * @zh 重置实例
15971
+ * @en Reset instance
15304
15972
  */
15305
15973
  static resetInstance(): void;
15306
15974
  /**
@@ -15329,23 +15997,28 @@ declare class AutoProfiler {
15329
15997
  */
15330
15998
  static stopSampling(): SampleData[];
15331
15999
  /**
15332
- * 设置启用状态
16000
+ * @zh 设置启用状态
16001
+ * @en Set enabled state
15333
16002
  */
15334
16003
  setEnabled(enabled: boolean): void;
15335
16004
  /**
15336
- * 注册类以进行自动分析
16005
+ * @zh 注册类以进行自动分析
16006
+ * @en Register class for automatic profiling
15337
16007
  */
15338
16008
  registerClass<T extends new (...args: any[]) => any>(constructor: T, category?: ProfileCategory, className?: string): T;
15339
16009
  /**
15340
- * 包装对象实例的所有方法
16010
+ * @zh 包装对象实例的所有方法
16011
+ * @en Wrap all methods of an object instance
15341
16012
  */
15342
16013
  wrapInstance<T extends object>(instance: T, className: string, category?: ProfileCategory): T;
15343
16014
  /**
15344
- * 包装单个函数
16015
+ * @zh 包装单个函数
16016
+ * @en Wrap a single function
15345
16017
  */
15346
16018
  wrapFunction<T extends (...args: any[]) => any>(fn: T, name: string, category?: ProfileCategory): T;
15347
16019
  /**
15348
- * 启动采样分析器
16020
+ * @zh 启动采样分析器
16021
+ * @en Start sampling profiler
15349
16022
  */
15350
16023
  startSampling(): void;
15351
16024
  /**
@@ -15357,21 +16030,25 @@ declare class AutoProfiler {
15357
16030
  */
15358
16031
  dispose(): void;
15359
16032
  /**
15360
- * 创建包装后的方法
16033
+ * @zh 创建包装后的方法
16034
+ * @en Create wrapped method
15361
16035
  */
15362
- private createWrappedMethod;
16036
+ private _createWrappedMethod;
15363
16037
  /**
15364
- * 获取对象的所有方法名
16038
+ * @zh 获取对象的所有方法名
16039
+ * @en Get all method names of an object
15365
16040
  */
15366
- private getAllMethodNames;
16041
+ private _getAllMethodNames;
15367
16042
  /**
15368
- * 获取属性描述符
16043
+ * @zh 获取属性描述符
16044
+ * @en Get property descriptor
15369
16045
  */
15370
- private getPropertyDescriptor;
16046
+ private _getPropertyDescriptor;
15371
16047
  /**
15372
- * 判断是否应该排除该方法
16048
+ * @zh 判断是否应该排除该方法
16049
+ * @en Check if method should be excluded
15373
16050
  */
15374
- private shouldExcludeMethod;
16051
+ private _shouldExcludeMethod;
15375
16052
  }
15376
16053
  /**
15377
16054
  * @Profile 装饰器
@@ -15449,189 +16126,23 @@ declare function isValidGUID(value: string): boolean;
15449
16126
  declare const EMPTY_GUID = "00000000-0000-0000-0000-000000000000";
15450
16127
 
15451
16128
  /**
15452
- * 平台适配器接口
15453
- * 用于适配不同的运行环境(浏览器、微信小游戏、字节跳动小游戏等)
15454
- */
15455
- type IPlatformAdapter = {
15456
- /**
15457
- * 平台名称
15458
- */
15459
- readonly name: string;
15460
- /**
15461
- * 平台版本信息
15462
- */
15463
- readonly version?: string;
15464
- /**
15465
- * 检查是否支持Worker
15466
- */
15467
- isWorkerSupported(): boolean;
15468
- /**
15469
- * 检查是否支持SharedArrayBuffer
15470
- */
15471
- isSharedArrayBufferSupported(): boolean;
15472
- /**
15473
- * 获取硬件并发数(CPU核心数)
15474
- */
15475
- getHardwareConcurrency(): number;
15476
- /**
15477
- * 创建Worker
15478
- * @param script Worker脚本内容
15479
- * @param options Worker选项
15480
- */
15481
- createWorker(script: string, options?: WorkerCreationOptions): PlatformWorker;
15482
- /**
15483
- * 创建SharedArrayBuffer
15484
- * @param length 缓冲区大小(字节)
15485
- */
15486
- createSharedArrayBuffer(length: number): SharedArrayBuffer | null;
15487
- /**
15488
- * 获取高精度时间戳
15489
- */
15490
- getHighResTimestamp(): number;
15491
- /**
15492
- * 获取平台特定的配置
15493
- */
15494
- getPlatformConfig(): PlatformConfig;
15495
- /**
15496
- * 异步获取平台配置(包含需要异步获取的信息)
15497
- */
15498
- getPlatformConfigAsync?(): Promise<PlatformConfig>;
15499
- };
15500
- /**
15501
- * Worker创建选项
15502
- */
15503
- type WorkerCreationOptions = {
15504
- /**
15505
- * Worker类型
15506
- */
15507
- type?: 'classic' | 'module';
15508
- /**
15509
- * 凭据模式
15510
- */
15511
- credentials?: 'omit' | 'same-origin' | 'include';
15512
- /**
15513
- * Worker名称(用于调试)
15514
- */
15515
- name?: string;
15516
- };
15517
- /**
15518
- * 平台Worker接口
15519
- */
15520
- type PlatformWorker = {
15521
- /**
15522
- * 发送消息到Worker
15523
- */
15524
- postMessage(message: any, transfer?: Transferable[]): void;
15525
- /**
15526
- * 监听Worker消息
15527
- */
15528
- onMessage(handler: (event: {
15529
- data: any;
15530
- }) => void): void;
15531
- /**
15532
- * 监听Worker错误
15533
- */
15534
- onError(handler: (error: ErrorEvent) => void): void;
15535
- /**
15536
- * 终止Worker
15537
- */
15538
- terminate(): void;
15539
- /**
15540
- * Worker状态
15541
- */
15542
- readonly state: 'running' | 'terminated';
15543
- };
15544
- /**
15545
- * 平台配置
15546
- */
15547
- type PlatformConfig = {
15548
- /**
15549
- * 最大Worker数量限制
15550
- */
15551
- maxWorkerCount: number;
15552
- /**
15553
- * 是否支持模块Worker
15554
- */
15555
- supportsModuleWorker: boolean;
15556
- /**
15557
- * 是否支持Transferable Objects
15558
- */
15559
- supportsTransferableObjects: boolean;
15560
- /**
15561
- * SharedArrayBuffer的最大大小限制(字节)
15562
- */
15563
- maxSharedArrayBufferSize?: number;
15564
- /**
15565
- * 平台特定的Worker脚本前缀(如果需要)
15566
- */
15567
- workerScriptPrefix?: string;
15568
- /**
15569
- * 平台特定的限制和特性
15570
- */
15571
- limitations?: {
15572
- /**
15573
- * 是否禁用eval(影响动态脚本创建)
15574
- */
15575
- noEval?: boolean;
15576
- /**
15577
- * 是否需要特殊的Worker初始化
15578
- */
15579
- requiresWorkerInit?: boolean;
15580
- /**
15581
- * 内存限制(字节)
15582
- */
15583
- memoryLimit?: number;
15584
- /**
15585
- * Worker是否不受支持(用于明确标记不支持Worker的平台)
15586
- */
15587
- workerNotSupported?: boolean;
15588
- /**
15589
- * Worker限制说明列表
15590
- */
15591
- workerLimitations?: string[];
15592
- };
15593
- /**
15594
- * 平台特定的扩展属性
15595
- */
15596
- extensions?: Record<string, any>;
15597
- };
15598
- /**
15599
- * 平台检测结果
15600
- */
15601
- type PlatformDetectionResult = {
15602
- /**
15603
- * 平台类型
15604
- */
15605
- platform: 'browser' | 'wechat-minigame' | 'bytedance-minigame' | 'alipay-minigame' | 'baidu-minigame' | 'nodejs' | 'unknown';
15606
- /**
15607
- * 是否确定检测结果
15608
- */
15609
- confident: boolean;
15610
- /**
15611
- * 检测到的特征
15612
- */
15613
- features: string[];
15614
- /**
15615
- * 建议使用的适配器类名
15616
- */
15617
- adapterClass?: string;
15618
- };
15619
-
15620
- /**
15621
- * 平台检测器
15622
- * 自动检测当前运行环境并返回对应的平台信息
16129
+ * @zh 平台检测器 - 自动检测当前运行环境并返回对应的平台信息
16130
+ * @en Platform Detector - Automatically detect the current runtime environment
15623
16131
  */
15624
16132
  declare class PlatformDetector {
16133
+ private static readonly miniGameGlobals;
15625
16134
  /**
15626
16135
  * 检测当前平台
15627
16136
  */
15628
16137
  static detect(): PlatformDetectionResult;
15629
16138
  /**
15630
- * 检测是否为微信小游戏环境
16139
+ * @zh 检测是否为微信小游戏环境
16140
+ * @en Check if running in WeChat Mini Game environment
15631
16141
  */
15632
16142
  private static isWeChatMiniGame;
15633
16143
  /**
15634
- * 检测是否为字节跳动小游戏环境
16144
+ * @zh 检测是否为字节跳动小游戏环境
16145
+ * @en Check if running in ByteDance Mini Game environment
15635
16146
  */
15636
16147
  private static isByteDanceMiniGame;
15637
16148
  /**
@@ -15639,11 +16150,13 @@ declare class PlatformDetector {
15639
16150
  */
15640
16151
  private static isNodeJS;
15641
16152
  /**
15642
- * 检测是否为支付宝小游戏环境
16153
+ * @zh 检测是否为支付宝小游戏环境
16154
+ * @en Check if running in Alipay Mini Game environment
15643
16155
  */
15644
16156
  private static isAlipayMiniGame;
15645
16157
  /**
15646
- * 检测是否为百度小游戏环境
16158
+ * @zh 检测是否为百度小游戏环境
16159
+ * @en Check if running in Baidu Mini Game environment
15647
16160
  */
15648
16161
  private static isBaiduMiniGame;
15649
16162
  /**
@@ -15667,9 +16180,10 @@ declare class PlatformDetector {
15667
16180
  */
15668
16181
  static isEditorEnvironment(): boolean;
15669
16182
  /**
15670
- * 获取详细的环境信息(用于调试)
16183
+ * @zh 获取详细的环境信息(用于调试)
16184
+ * @en Get detailed environment information for debugging
15671
16185
  */
15672
- static getDetailedInfo(): Record<string, any>;
16186
+ static getDetailedInfo(): Record<string, unknown>;
15673
16187
  }
15674
16188
 
15675
16189
  /**
@@ -15677,37 +16191,46 @@ declare class PlatformDetector {
15677
16191
  * 用户需要手动注册平台适配器
15678
16192
  */
15679
16193
  declare class PlatformManager {
15680
- private static instance;
15681
- private adapter;
15682
- private readonly logger;
16194
+ private static _instance;
16195
+ private _adapter;
16196
+ private readonly _logger;
15683
16197
  private constructor();
15684
16198
  /**
15685
- * 获取单例实例
16199
+ * @zh 获取单例实例
16200
+ * @en Get singleton instance
15686
16201
  */
15687
16202
  static getInstance(): PlatformManager;
15688
16203
  /**
15689
- * 获取当前平台适配器
16204
+ * @zh 获取当前平台适配器
16205
+ * @en Get current platform adapter
15690
16206
  */
15691
16207
  getAdapter(): IPlatformAdapter;
15692
16208
  /**
15693
- * 注册平台适配器
16209
+ * @zh 注册平台适配器
16210
+ * @en Register platform adapter
15694
16211
  */
15695
16212
  registerAdapter(adapter: IPlatformAdapter): void;
15696
16213
  /**
15697
- * 检查是否已注册适配器
16214
+ * @zh 检查是否已注册适配器
16215
+ * @en Check if adapter is registered
15698
16216
  */
15699
16217
  hasAdapter(): boolean;
15700
16218
  /**
15701
- * 获取平台适配器信息(用于调试)
16219
+ * @zh 获取平台适配器信息(用于调试)
16220
+ * @en Get platform adapter info (for debugging)
15702
16221
  */
15703
16222
  getAdapterInfo(): any;
15704
16223
  /**
15705
- * 检查当前平台是否支持特定功能
16224
+ * @zh 检查当前平台是否支持特定功能
16225
+ * @en Check if current platform supports specific feature
15706
16226
  */
15707
16227
  supportsFeature(feature: 'worker' | 'shared-array-buffer' | 'transferable-objects' | 'module-worker'): boolean;
15708
16228
  /**
15709
- * 获取基础的Worker配置信息(不做自动决策)
15710
- * 用户应该根据自己的业务需求来配置Worker参数
16229
+ * @zh 获取基础的Worker配置信息(不做自动决策)
16230
+ * @en Get basic Worker configuration (no auto-decision)
16231
+ *
16232
+ * @zh 用户应该根据自己的业务需求来配置Worker参数
16233
+ * @en Users should configure Worker parameters based on their business requirements
15711
16234
  */
15712
16235
  getBasicWorkerConfig(): {
15713
16236
  platformSupportsWorker: boolean;
@@ -15716,7 +16239,8 @@ declare class PlatformManager {
15716
16239
  platformLimitations: any;
15717
16240
  };
15718
16241
  /**
15719
- * 异步获取完整的平台配置信息(包含性能信息)
16242
+ * @zh 异步获取完整的平台配置信息(包含性能信息)
16243
+ * @en Async get full platform configuration (includes performance info)
15720
16244
  */
15721
16245
  getFullPlatformConfig(): Promise<any>;
15722
16246
  }
@@ -15737,5 +16261,5 @@ declare function getFullPlatformConfig(): Promise<any>;
15737
16261
  declare function supportsFeature(feature: 'worker' | 'shared-array-buffer' | 'transferable-objects' | 'module-worker'): boolean;
15738
16262
  declare function hasAdapter(): boolean;
15739
16263
 
15740
- export { AdvancedProfilerCollector, After, AutoProfiler, Before, BinarySerializer, BitMask64Utils, Bits, COMPONENT_DEPENDENCIES, COMPONENT_EDITOR_OPTIONS, COMPONENT_TYPE_NAME, ChangeOperation, Colors, CommandBuffer, CommandType, CompiledQuery, Component, ComponentDataCollector, ComponentPool, ComponentPoolManager, ComponentRegistry, ComponentSerializer, ComponentSparseSet, ComponentStorage, ConsoleLogger, Core, CycleDependencyError, DEFAULT_PROFILER_CONFIG, DEFAULT_STAGE_ORDER, DebugConfigService, DebugManager, DebugPlugin, DeepCopy, ECSComponent, ECSEventType, ECSFluentAPI, ECSSystem, EEntityLifecyclePolicy, EMPTY_GUID, ENTITY_REF_METADATA, EVENT_TYPES, Emitter, EnableSoA, Entity, EntityDataCollector, EntityHandleManager, EntityList, EntityProcessorList, EntityRef, EntitySerializer, EntitySystem, EntityTags, EpochManager, EventBus, EventPriority, EventTypeValidator, Float32, Float64, FuncPack, GEN_BITS, GEN_MASK, GlobalComponentRegistry, GlobalEventBus, GlobalManager, HierarchyComponent, HierarchySystem, INDEX_BITS, INDEX_MASK, IdentifierPool, IgnoreSerialization, InSet, IncrementalSerializer, InjectProperty, Injectable, Int16, Int32, Int8, IntervalSystem, LogLevel, Logger, LoggerManager, MAX_ENTITIES, MAX_GENERATION, Matcher, MigrationBuilder, NULL_HANDLE, NumberExtension, PREFAB_FORMAT_VERSION, PROPERTY_METADATA, PassiveSystem, PerformanceDataCollector, PerformanceMonitor, PerformanceWarningType, PlatformDetector, PlatformManager, PluginManager, PluginServiceRegistry, PluginState, Pool, PoolManager, PrefabInstanceComponent, PrefabSerializer, ProcessingSystem, Profile, ProfileCategory, ProfileClass, ProfilerSDK, Property, QuerySystem, ReactiveQuery, ReactiveQueryChangeType, ReferenceTracker, RuntimeModeService, RuntimeModeToken, SCHEDULING_METADATA, SERIALIZABLE_METADATA, SERIALIZE_FIELD, SERIALIZE_OPTIONS, SYSTEM_TYPE_NAME, Scene, SceneDataCollector, SceneManager, SceneSerializer, Serializable, SerializationContext, Serialize, SerializeArray, SerializeAsMap, SerializeAsSet, SerializeMap, SerializeSet, ServiceContainer, ServiceLifetime, SoAStorage, SparseSet, Stage, SystemDataCollector, SystemDependencyGraph, SystemScheduler, Time, Timer, TimerManager, TypeSafeEventSystem, TypeUtils, TypedEntityBuilder, TypedQueryBuilder, TypedQueryResult, Uint16, Uint32, Uint8, Uint8Clamped, Updatable, ValueSerializer, VersionMigrationManager, WebSocketManager, WorkerEntitySystem, World, WorldManager, addAndConfigure, addEntityTag, buildEntity, createECSAPI, createEditorModeService, createInstance, createLogger, createQuery, createServiceToken, createStandaloneModeService, genOf, generateGUID, getBasicWorkerConfig, getComponentDependencies, getComponentEditorOptions, getComponentInstanceEditorOptions, getComponentInstanceTypeName, getComponentTypeName, getComponents, getCurrentAdapter, getEntityRefMetadata, getEntityRefProperties, getFullPlatformConfig, getOrAddComponent, getPropertyInjectMetadata, getPropertyMetadata, getSceneByEntityId, getSchedulingMetadata, getSerializationMetadata, getSystemInstanceMetadata, getSystemInstanceTypeName, getSystemMetadata, getSystemTypeName, getUpdatableMetadata, handleEquals, handleToString, hasAdapter, hasAnyComponent, hasComponents, hasECSComponentDecorator, hasEntityRef, hasEntityTag, hasPropertyMetadata, hasSchedulingMetadata, indexOf, injectProperties, isComponentArray, isComponentHiddenInInspector, isComponentInstanceHiddenInInspector, isComponentType, isEntityRefProperty, isFolder, isHidden, isLocked, isSerializable, isUpdatable, isValidGUID, isValidHandle, makeHandle, queryFor, queryForAll, registerInjectable, registerPlatformAdapter, removeEntityTag, requireComponent, resetLoggerColors, setGlobalLogLevel, setLoggerColors, setLoggerFactory, supportsFeature, tryGetComponent, updateComponent };
15741
- export type { AnyComponentConstructor, AutoProfilerConfig, BitMask64Data, CallGraphNode, ComponentChange, ComponentConstructor, ComponentDebugInfo, ComponentEditorOptions, ComponentInstance, ComponentMigrationFunction, ComponentOptions, ComponentType, ComponentTypeMap, ComponentTypeName, ComponentTypeNames, DataOnly, DeepPartial, DeepReadonly, DeferredCommand, DeserializationStrategy, ECSDebugStats, EntityChange, EntityDebugInfo, EntityHandle, EntityRefMetadata, EntityRefRecord, EntityTagValue, EntityWithComponents, EnumOption, EventListenerConfig, EventStats, ExtractComponents, FieldSerializeOptions, IAdvancedProfilerData, IComponent, IComponentDebugData, IComponentEventData, IComponentRegistry, ICoreConfig, IECSDebugConfig, IECSDebugData, IEntityDebugData, IEntityEventData, IEntityHierarchyNode, IEventBus, IEventData, IEventListenerConfig, IEventStats, ILogger, IPerformanceDebugData, IPerformanceEventData, IPlatformAdapter, IPlugin, IPluginMetadata, IPoolable, IRuntimeMode, IScene, ISceneConfig, ISceneDebugData, ISceneEventData, ISceneFactory, IService, ISystemBase, ISystemDebugData, ISystemEventData, ITimer, IUpdatable, IWorldConfig, IWorldManagerConfig, IncrementalSerializationFormat, IncrementalSerializationOptions, IncrementalSnapshot, InjectableMetadata, InstanceTypes, LoggerColorConfig, LoggerConfig, LongTaskInfo, MemorySnapshot, MigrationFunction, PartialComponent, PerformanceData, PerformanceStats, PerformanceThresholds, PerformanceWarning, PlatformConfig, PlatformDetectionResult, PlatformWorker, PoolStats, PrefabComponentTypeEntry, PrefabCreateOptions, PrefabData, PrefabInstantiateOptions, PrefabMetadata, ProfileCounter, ProfileFrame, ProfileReport, ProfileSample, ProfileSampleStats, ProfilerConfig, PropertyAction, PropertyAssetType, PropertyControl, PropertyOptions, PropertyType, QueryResult$1 as QueryResult, ReactiveQueryChange, ReactiveQueryConfig, ReactiveQueryListener, ReadonlyComponent, RuntimeModeConfig, SampleHandle, SceneDataChange, SceneDebugInfo, SceneDeserializationOptions, SceneMigrationFunction, SceneSerializationOptions, SerializableComponent, SerializableFields, SerializableOptions, SerializableValue, SerializationFormat, SerializationMetadata, SerializedComponent, SerializedEntity, SerializedEntityRef, SerializedPrefabEntity, SerializedScene, ServiceIdentifier, ServiceToken, ServiceType, SharedArrayBufferProcessFunction, SupportedTypedArray, SystemDebugInfo, SystemDependencyInfo, SystemEntityType, SystemLifecycleHooks, SystemMetadata, SystemSchedulingMetadata, SystemStage, TypeDef as TypeHandler, TypeSafeBuilder, TypedEventHandler, TypedQueryCondition, TypedValue, UpdatableMetadata, ValidComponent, ValidComponentArray, WorkerCreationOptions, WorkerProcessFunction, WorkerSystemConfig };
16264
+ export { AdvancedProfilerCollector, After, AutoProfiler, Before, BinarySerializer, BitMask64Utils, Bits, COMPONENT_DEPENDENCIES, COMPONENT_EDITOR_OPTIONS, COMPONENT_TYPE_NAME, ChangeOperation, Colors, CommandBuffer, CommandType, CompiledQuery, Component, ComponentDataCollector, ComponentPool, ComponentPoolManager, ComponentRegistry, ComponentSerializer, ComponentSparseSet, ComponentStorage, ConsoleLogger, Core, CycleDependencyError, DEFAULT_PROFILER_CONFIG, DEFAULT_STAGE_ORDER, DebugConfigService, DebugManager, DebugPlugin, DeepCopy, ECSComponent, ECSEventType, ECSFluentAPI, ECSSystem, EEntityLifecyclePolicy, EMPTY_GUID, ENTITY_REF_METADATA, EVENT_TYPES, Emitter, EnableSoA, Entity, EntityDataCollector, EntityHandleManager, EntityList, EntityProcessorList, EntityRef, EntitySerializer, EntitySystem, EntityTags, EpochManager, EventBus, EventPriority, EventTypeValidator, Float32, Float64, FuncPack, GEN_BITS, GEN_MASK, GlobalComponentRegistry, GlobalEventBus, GlobalManager, HierarchyComponent, HierarchySystem, INDEX_BITS, INDEX_MASK, IdentifierPool, IgnoreSerialization, InSet, IncrementalSerializer, InjectProperty, Injectable, Int16, Int32, Int8, IntervalSystem, LogLevel, Logger, LoggerManager, MAX_ENTITIES, MAX_GENERATION, Matcher, MigrationBuilder, NULL_HANDLE, NumberExtension, PREFAB_FORMAT_VERSION, PROPERTY_METADATA, PassiveSystem, PerformanceDataCollector, PerformanceMonitor, PerformanceWarningType, PlatformDetector, PlatformManager, PlatformWorkerPool, PluginManager, PluginServiceRegistry, PluginState, Pool, PoolManager, PrefabInstanceComponent, PrefabSerializer, ProcessingSystem, Profile, ProfileCategory, ProfileClass, ProfilerSDK, Property, QuerySystem, ReactiveQuery, ReactiveQueryChangeType, ReferenceTracker, RuntimeModeService, RuntimeModeToken, SCHEDULING_METADATA, SERIALIZABLE_METADATA, SERIALIZE_FIELD, SERIALIZE_OPTIONS, SYSTEM_TYPE_NAME, Scene, SceneDataCollector, SceneManager, SceneSerializer, Serializable, SerializationContext, Serialize, SerializeArray, SerializeAsMap, SerializeAsSet, SerializeMap, SerializeSet, ServiceContainer, ServiceLifetime, SoAStorage, SparseSet, Stage, SystemDataCollector, SystemDependencyGraph, SystemScheduler, Time, Timer, TimerManager, TypeSafeEventSystem, TypeUtils, TypedEntityBuilder, TypedQueryBuilder, TypedQueryResult, Uint16, Uint32, Uint8, Uint8Clamped, Updatable, ValueSerializer, VersionMigrationManager, WebSocketManager, WorkerEntitySystem, World, WorldManager, addAndConfigure, addEntityTag, buildEntity, createECSAPI, createEditorModeService, createInstance, createLogger, createQuery, createServiceToken, createStandaloneModeService, genOf, generateGUID, getBasicWorkerConfig, getComponentDependencies, getComponentEditorOptions, getComponentInstanceEditorOptions, getComponentInstanceTypeName, getComponentTypeName, getComponents, getCurrentAdapter, getEntityRefMetadata, getEntityRefProperties, getFullPlatformConfig, getGlobalWithMiniGame, getOrAddComponent, getPerformanceWithMemory, getPropertyInjectMetadata, getPropertyMetadata, getSceneByEntityId, getSchedulingMetadata, getSerializationMetadata, getSystemInstanceMetadata, getSystemInstanceTypeName, getSystemMetadata, getSystemTypeName, getUpdatableMetadata, handleEquals, handleToString, hasAdapter, hasAnyComponent, hasComponents, hasECSComponentDecorator, hasEntityRef, hasEntityTag, hasPropertyMetadata, hasSchedulingMetadata, indexOf, injectProperties, isComponentArray, isComponentHiddenInInspector, isComponentInstanceHiddenInInspector, isComponentType, isEntityRefProperty, isFolder, isHidden, isLocked, isSerializable, isUpdatable, isValidGUID, isValidHandle, makeHandle, queryFor, queryForAll, registerInjectable, registerPlatformAdapter, removeEntityTag, requireComponent, resetLoggerColors, setGlobalLogLevel, setLoggerColors, setLoggerFactory, supportsFeature, tryGetComponent, updateComponent };
16265
+ export type { AnyComponentConstructor, AutoProfilerConfig, BitMask64Data, CallGraphNode, ComponentChange, ComponentConstructor, ComponentDebugInfo, ComponentEditorOptions, ComponentInstance, ComponentMigrationFunction, ComponentOptions, ComponentType, ComponentTypeMap, ComponentTypeName, ComponentTypeNames, ComponentTypeWithMetadata, DataOnly, DeepPartial, DeepReadonly, DeferredCommand, DeserializationStrategy, ECSDebugStats, EntityChange, EntityDebugInfo, EntityHandle, EntityRefMetadata, EntityRefRecord, EntityTagValue, EntityWithComponents, EnumOption, EventListenerConfig, EventStats, ExtractComponents, FieldSerializeOptions, IAdvancedProfilerData, IAlipayMiniGameAPI, IBaiduMiniGameAPI, IByteDanceMiniGameAPI, IChromeMemoryInfo, IComponent, IComponentDebugData, IComponentEventData, IComponentRegistry, IComponentTypeMetadata, ICoreConfig, IECSDebugConfig, IECSDebugData, IEntityDebugData, IEntityEventData, IEntityHierarchyNode, IEventBus, IEventData, IEventListenerConfig, IEventStats, IGlobalThisWithMiniGame, ILogger, IMiniGamePlatformAPI, IPerformanceDebugData, IPerformanceEventData, IPerformanceWithMemory, IPlatformAdapter, IPlugin, IPluginMetadata, IPoolable, IRuntimeMode, IScene, ISceneConfig, ISceneDebugData, ISceneEventData, ISceneFactory, IService, ISystemBase, ISystemDebugData, ISystemEventData, ITimer, IUpdatable, IWeChatMiniGameAPI, IWorkerPoolStatus, IWorkerSystemConfig, IWorldConfig, IWorldManagerConfig, IncrementalSerializationFormat, IncrementalSerializationOptions, IncrementalSnapshot, InjectableMetadata, InstanceTypes, LoggerColorConfig, LoggerConfig, LongTaskInfo, MemorySnapshot, MigrationFunction, PartialComponent, PerformanceData, PerformanceStats, PerformanceThresholds, PerformanceWarning, PlatformConfig, PlatformDetectionResult, PlatformWorker, PoolStats, PrefabComponentTypeEntry, PrefabCreateOptions, PrefabData, PrefabInstantiateOptions, PrefabMetadata, ProcessingMode, ProfileCounter, ProfileFrame, ProfileReport, ProfileSample, ProfileSampleStats, ProfilerConfig, PropertyAction, PropertyAssetType, PropertyControl, PropertyOptions, PropertyType, QueryResult$1 as QueryResult, ReactiveQueryChange, ReactiveQueryConfig, ReactiveQueryListener, ReadonlyComponent, RuntimeModeConfig, SampleHandle, SceneDataChange, SceneDebugInfo, SceneDeserializationOptions, SceneMigrationFunction, SceneSerializationOptions, SerializableComponent, SerializableFields, SerializableOptions, SerializableValue, SerializationFormat, SerializationMetadata, SerializedComponent, SerializedEntity, SerializedEntityRef, SerializedPrefabEntity, SerializedScene, ServiceIdentifier, ServiceToken, ServiceType, SharedArrayBufferProcessFunction, SupportedTypedArray, SystemDebugInfo, SystemDependencyInfo, SystemEntityType, SystemLifecycleHooks, SystemMetadata, SystemSchedulingMetadata, SystemStage, TypeDef as TypeHandler, TypeSafeBuilder, TypedEventHandler, TypedQueryCondition, TypedValue, UpdatableMetadata, ValidComponent, ValidComponentArray, WorkerCreationOptions, WorkerProcessFunction, WorkerSystemConfig };