@esengine/ecs-framework 2.4.1 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @esengine/ecs-framework v2.4.1
2
+ * @esengine/ecs-framework v2.4.2
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
- * 获取实体句柄
9813
- *
9814
- * 返回轻量级数值句柄,用于高性能场景。
9815
- * 如果实体尚未分配句柄,返回 NULL_HANDLE。
10337
+ * @zh 获取实体句柄
10338
+ * @en Get entity handle
9816
10339
  *
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
- * 设置实体句柄(内部使用)
10345
+ * @zh 设置实体句柄(内部使用)
10346
+ * @en Set entity handle (internal use)
9824
10347
  *
9825
- * 此方法供 Scene 在创建实体时调用。
9826
- *
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
- * 将实体恢复为默认行为。
10372
+ * @zh 设置实体为场景本地(随场景销毁),恢复默认行为
10373
+ * @en Mark entity as scene-local (destroyed with scene), restores default behavior
9855
10374
  *
9856
- * Mark entity as scene-local (destroyed with scene).
9857
- * Restores default behavior.
9858
- *
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
- * 标记组件为已修改
10553
+ * @zh 标记组件为已修改
10554
+ * @en Mark component(s) as modified
10032
10555
  *
10033
- * 便捷方法,自动从场景获取当前 epoch 并标记组件。
10034
- * 用于帧级变更检测系统。
10556
+ * @zh 便捷方法,自动从场景获取当前 epoch 并标记组件。用于帧级变更检测系统。
10557
+ * @en Convenience method that auto-gets epoch from scene and marks components. Used for frame-level change detection system.
10035
10558
  *
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.
10039
- *
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,84 +11538,115 @@ 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
11547
  type 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
11578
  type 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;
11599
+ /**
11600
+ * @zh 自动清理阈值(毫秒),空Scene超过此时间后将被自动清理
11601
+ * @en Auto cleanup threshold (ms), empty scenes exceeding this time will be auto-cleaned
11602
+ *
11603
+ * @default 300000 (5 minutes)
11604
+ */
11605
+ cleanupThresholdMs?: number;
11061
11606
  };
11062
11607
  /**
11063
- * World类 - ECS世界管理器
11608
+ * @zh World类 - ECS世界管理器
11609
+ * @en World class - ECS world manager
11064
11610
  *
11065
- * World是Scene的容器,每个World可以管理多个Scene。
11611
+ * @zh World是Scene的容器,每个World可以管理多个Scene。
11066
11612
  * World拥有独立的服务容器,用于管理World级别的全局服务。
11613
+ * @en World is a container for Scenes, each World can manage multiple Scenes.
11614
+ * World has its own service container for managing World-level global services.
11067
11615
  *
11068
- * 服务容器层级:
11616
+ * @zh 服务容器层级:
11069
11617
  * - Core.services: 应用程序全局服务
11070
11618
  * - World.services: World级别服务(每个World独立)
11071
11619
  * - Scene.services: Scene级别服务(每个Scene独立)
11620
+ * @en Service container hierarchy:
11621
+ * - Core.services: Application-wide global services
11622
+ * - World.services: World-level services (independent per World)
11623
+ * - Scene.services: Scene-level services (independent per Scene)
11072
11624
  *
11073
- * 这种设计允许创建独立的游戏世界,如:
11625
+ * @zh 这种设计允许创建独立的游戏世界,如:
11074
11626
  * - 游戏房间(每个房间一个World)
11075
11627
  * - 不同的游戏模式
11076
11628
  * - 独立的模拟环境
11629
+ * @en This design allows creating independent game worlds like:
11630
+ * - Game rooms (one World per room)
11631
+ * - Different game modes
11632
+ * - Independent simulation environments
11077
11633
  *
11078
11634
  * @example
11079
11635
  * ```typescript
11080
- * // 创建游戏房间的World
11636
+ * // @zh 创建游戏房间的World | @en Create World for game room
11081
11637
  * const roomWorld = new World({ name: 'Room_001' });
11082
11638
  *
11083
- * // 注册World级别的服务
11639
+ * // @zh 注册World级别的服务 | @en Register World-level service
11084
11640
  * roomWorld.services.registerSingleton(RoomManager);
11085
11641
  *
11086
- * // 在World中创建Scene
11642
+ * // @zh 在World中创建Scene | @en Create Scene in World
11087
11643
  * const gameScene = roomWorld.createScene('game', new Scene());
11088
11644
  * const uiScene = roomWorld.createScene('ui', new Scene());
11089
11645
  *
11090
- * // 在Scene中使用World级别的服务
11646
+ * // @zh 在Scene中使用World级别的服务 | @en Use World-level service in Scene
11091
11647
  * const roomManager = roomWorld.services.resolve(RoomManager);
11092
11648
  *
11093
- * // 更新整个World
11649
+ * // @zh 更新整个World | @en Update entire World
11094
11650
  * roomWorld.update(deltaTime);
11095
11651
  * ```
11096
11652
  */
@@ -11105,20 +11661,33 @@ declare class World {
11105
11661
  private _createdAt;
11106
11662
  constructor(config?: IWorldConfig);
11107
11663
  /**
11108
- * World级别的服务容器
11109
- * 用于管理World范围内的全局服务
11664
+ * @zh World级别的服务容器,用于管理World范围内的全局服务
11665
+ * @en World-level service container for managing World-scoped global services
11110
11666
  */
11111
11667
  get services(): ServiceContainer;
11112
11668
  /**
11113
- * 创建并添加Scene到World
11669
+ * @zh 创建并添加Scene到World
11670
+ * @en Create and add Scene to World
11671
+ *
11672
+ * @param sceneName - @zh Scene名称 @en Scene name
11673
+ * @param sceneInstance - @zh Scene实例(可选)@en Scene instance (optional)
11674
+ * @returns @zh 创建的Scene实例 @en Created Scene instance
11114
11675
  */
11115
11676
  createScene<T extends IScene>(sceneName: string, sceneInstance?: T): T;
11116
11677
  /**
11117
- * 移除Scene
11678
+ * @zh 移除Scene
11679
+ * @en Remove Scene
11680
+ *
11681
+ * @param sceneName - @zh Scene名称 @en Scene name
11682
+ * @returns @zh 是否成功移除 @en Whether removal was successful
11118
11683
  */
11119
11684
  removeScene(sceneName: string): boolean;
11120
11685
  /**
11121
- * 获取Scene
11686
+ * @zh 获取Scene
11687
+ * @en Get Scene
11688
+ *
11689
+ * @param sceneName - @zh Scene名称 @en Scene name
11690
+ * @returns @zh Scene实例或null @en Scene instance or null
11122
11691
  */
11123
11692
  getScene<T extends IScene>(sceneName: string): T | null;
11124
11693
  /**
@@ -11167,13 +11736,17 @@ declare class World {
11167
11736
  */
11168
11737
  stop(): void;
11169
11738
  /**
11170
- * 更新World中的全局System
11171
- * 注意:此方法由Core.update()调用,不应直接调用
11739
+ * @zh 更新World中的全局System
11740
+ * @en Update global systems in World
11741
+ *
11742
+ * @internal Called by Core.update()
11172
11743
  */
11173
11744
  updateGlobalSystems(): void;
11174
11745
  /**
11175
- * 更新World中的所有激活Scene
11176
- * 注意:此方法由Core.update()调用,不应直接调用
11746
+ * @zh 更新World中的所有激活Scene
11747
+ * @en Update all active scenes in World
11748
+ *
11749
+ * @internal Called by Core.update()
11177
11750
  */
11178
11751
  updateScenes(): void;
11179
11752
  /**
@@ -11192,21 +11765,32 @@ declare class World {
11192
11765
  createdAt: number;
11193
11766
  config: {
11194
11767
  /**
11195
- * World名称
11768
+ * @zh World名称
11769
+ * @en World name
11196
11770
  */
11197
11771
  name?: string;
11198
11772
  /**
11199
- * 是否启用调试模式
11773
+ * @zh 是否启用调试模式
11774
+ * @en Enable debug mode
11200
11775
  */
11201
11776
  debug?: boolean;
11202
11777
  /**
11203
- * 最大Scene数量限制
11778
+ * @zh 最大Scene数量限制
11779
+ * @en Maximum number of scenes
11204
11780
  */
11205
11781
  maxScenes?: number;
11206
11782
  /**
11207
- * 是否自动清理空Scene
11783
+ * @zh 是否自动清理空Scene
11784
+ * @en Auto cleanup empty scenes
11208
11785
  */
11209
11786
  autoCleanup?: boolean;
11787
+ /**
11788
+ * @zh 自动清理阈值(毫秒),空Scene超过此时间后将被自动清理
11789
+ * @en Auto cleanup threshold (ms), empty scenes exceeding this time will be auto-cleaned
11790
+ *
11791
+ * @default 300000 (5 minutes)
11792
+ */
11793
+ cleanupThresholdMs?: number;
11210
11794
  };
11211
11795
  scenes: {
11212
11796
  id: string;
@@ -11227,11 +11811,13 @@ declare class World {
11227
11811
  };
11228
11812
  };
11229
11813
  /**
11230
- * 检查是否应该执行自动清理
11814
+ * @zh 检查Scene是否可以被自动清理
11815
+ * @en Check if a scene is eligible for auto cleanup
11231
11816
  */
11232
- private shouldAutoCleanup;
11817
+ private _isSceneCleanupCandidate;
11233
11818
  /**
11234
- * 执行清理操作
11819
+ * @zh 执行自动清理操作
11820
+ * @en Execute auto cleanup operation
11235
11821
  */
11236
11822
  private cleanup;
11237
11823
  /**
@@ -11409,6 +11995,7 @@ declare class WorldManager implements IService {
11409
11995
  debug?: boolean;
11410
11996
  maxScenes?: number;
11411
11997
  autoCleanup?: boolean;
11998
+ cleanupThresholdMs?: number;
11412
11999
  };
11413
12000
  scenes: {
11414
12001
  id: string;
@@ -11666,15 +12253,19 @@ declare class EventBus implements IEventBus {
11666
12253
  * 提供全局访问的事件总线
11667
12254
  */
11668
12255
  declare class GlobalEventBus {
11669
- private static instance;
12256
+ private static _instance;
11670
12257
  /**
11671
- * 获取全局事件总线实例
11672
- * @param debugMode 是否启用调试模式
12258
+ * @zh 获取全局事件总线实例
12259
+ * @en Get global event bus instance
12260
+ *
12261
+ * @param debugMode - @zh 是否启用调试模式 @en Whether to enable debug mode
11673
12262
  */
11674
12263
  static getInstance(debugMode?: boolean): EventBus;
11675
12264
  /**
11676
- * 重置全局事件总线实例
11677
- * @param debugMode 是否启用调试模式
12265
+ * @zh 重置全局事件总线实例
12266
+ * @en Reset global event bus instance
12267
+ *
12268
+ * @param debugMode - @zh 是否启用调试模式 @en Whether to enable debug mode
11678
12269
  */
11679
12270
  static reset(debugMode?: boolean): EventBus;
11680
12271
  }
@@ -11744,51 +12335,61 @@ interface ComponentUsageTracker {
11744
12335
  * 全局组件池管理器
11745
12336
  */
11746
12337
  declare class ComponentPoolManager {
11747
- private static instance;
11748
- private pools;
11749
- private usageTracker;
11750
- private autoCleanupInterval;
11751
- private lastCleanupTime;
12338
+ private static _instance;
12339
+ private _pools;
12340
+ private _usageTracker;
12341
+ private _autoCleanupInterval;
12342
+ private _lastCleanupTime;
11752
12343
  private constructor();
11753
12344
  static getInstance(): ComponentPoolManager;
11754
12345
  /**
11755
- * 注册组件池
12346
+ * @zh 注册组件池
12347
+ * @en Register component pool
11756
12348
  */
11757
12349
  registerPool<T extends Component>(componentName: string, createFn: () => T, resetFn?: (component: T) => void, maxSize?: number, minSize?: number): void;
11758
12350
  /**
11759
- * 获取组件实例
12351
+ * @zh 获取组件实例
12352
+ * @en Acquire component instance
11760
12353
  */
11761
12354
  acquireComponent<T extends Component>(componentName: string): T | null;
11762
12355
  /**
11763
- * 释放组件实例
12356
+ * @zh 释放组件实例
12357
+ * @en Release component instance
11764
12358
  */
11765
12359
  releaseComponent<T extends Component>(componentName: string, component: T): void;
11766
12360
  /**
11767
- * 追踪使用情况
12361
+ * @zh 追踪使用情况
12362
+ * @en Track usage
11768
12363
  */
11769
- private trackUsage;
12364
+ private _trackUsage;
11770
12365
  /**
11771
- * 自动清理(定期调用)
12366
+ * @zh 自动清理(定期调用)
12367
+ * @en Auto cleanup (called periodically)
11772
12368
  */
11773
12369
  update(): void;
11774
12370
  /**
11775
- * 获取热点组件列表
12371
+ * @zh 获取热点组件列表
12372
+ * @en Get hot components list
11776
12373
  */
11777
12374
  getHotComponents(threshold?: number): string[];
11778
12375
  /**
11779
- * 预热所有池
12376
+ * @zh 预热所有池
12377
+ * @en Prewarm all pools
11780
12378
  */
11781
12379
  prewarmAll(count?: number): void;
11782
12380
  /**
11783
- * 清空所有池
12381
+ * @zh 清空所有池
12382
+ * @en Clear all pools
11784
12383
  */
11785
12384
  clearAll(): void;
11786
12385
  /**
11787
- * 重置管理器
12386
+ * @zh 重置管理器
12387
+ * @en Reset manager
11788
12388
  */
11789
12389
  reset(): void;
11790
12390
  /**
11791
- * 获取全局统计信息
12391
+ * @zh 获取全局统计信息
12392
+ * @en Get global stats
11792
12393
  */
11793
12394
  getGlobalStats(): Array<{
11794
12395
  componentName: string;
@@ -11796,14 +12397,16 @@ declare class ComponentPoolManager {
11796
12397
  usage: ComponentUsageTracker | undefined;
11797
12398
  }>;
11798
12399
  /**
11799
- * 获取池统计信息
12400
+ * @zh 获取池统计信息
12401
+ * @en Get pool stats
11800
12402
  */
11801
12403
  getPoolStats(): Map<string, {
11802
12404
  available: number;
11803
12405
  maxSize: number;
11804
12406
  }>;
11805
12407
  /**
11806
- * 获取池利用率信息
12408
+ * @zh 获取池利用率信息
12409
+ * @en Get pool utilization info
11807
12410
  */
11808
12411
  getPoolUtilization(): Map<string, {
11809
12412
  used: number;
@@ -11811,7 +12414,8 @@ declare class ComponentPoolManager {
11811
12414
  utilization: number;
11812
12415
  }>;
11813
12416
  /**
11814
- * 获取指定组件的池利用率
12417
+ * @zh 获取指定组件的池利用率
12418
+ * @en Get component pool utilization
11815
12419
  */
11816
12420
  getComponentUtilization(componentName: string): number;
11817
12421
  }
@@ -12632,65 +13236,68 @@ type IPluginMetadata = {
12632
13236
  };
12633
13237
 
12634
13238
  /**
12635
- * 游戏引擎核心类
13239
+ * @zh 游戏引擎核心类
13240
+ * @en Game engine core class
12636
13241
  *
12637
- * 职责:
13242
+ * @zh 职责:
12638
13243
  * - 提供全局服务(Timer、Performance、Pool等)
12639
13244
  * - 管理场景生命周期(内置SceneManager)
12640
13245
  * - 管理全局管理器的生命周期
12641
13246
  * - 提供统一的游戏循环更新入口
13247
+ * @en Responsibilities:
13248
+ * - Provide global services (Timer, Performance, Pool, etc.)
13249
+ * - Manage scene lifecycle (built-in SceneManager)
13250
+ * - Manage global manager lifecycles
13251
+ * - Provide unified game loop update entry
12642
13252
  *
12643
13253
  * @example
12644
13254
  * ```typescript
12645
- * // 初始化并设置场景
13255
+ * // @zh 初始化并设置场景 | @en Initialize and set scene
12646
13256
  * Core.create({ debug: true });
12647
13257
  * Core.setScene(new GameScene());
12648
13258
  *
12649
- * // 游戏循环(自动更新全局服务和场景)
13259
+ * // @zh 游戏循环(自动更新全局服务和场景)| @en Game loop (auto-updates global services and scene)
12650
13260
  * function gameLoop(deltaTime: number) {
12651
13261
  * Core.update(deltaTime);
12652
13262
  * }
12653
13263
  *
12654
- * // 使用定时器
13264
+ * // @zh 使用定时器 | @en Use timer
12655
13265
  * Core.schedule(1.0, false, null, (timer) => {
12656
- * console.log("1秒后执行");
13266
+ * console.log("Executed after 1 second");
12657
13267
  * });
12658
13268
  *
12659
- * // 切换场景
12660
- * Core.loadScene(new MenuScene()); // 延迟切换
12661
- * Core.setScene(new GameScene()); // 立即切换
13269
+ * // @zh 切换场景 | @en Switch scene
13270
+ * Core.loadScene(new MenuScene()); // @zh 延迟切换 | @en Deferred switch
13271
+ * Core.setScene(new GameScene()); // @zh 立即切换 | @en Immediate switch
12662
13272
  *
12663
- * // 获取当前场景
13273
+ * // @zh 获取当前场景 | @en Get current scene
12664
13274
  * const currentScene = Core.scene;
12665
13275
  * ```
12666
13276
  */
12667
13277
  declare class Core {
12668
13278
  /**
12669
- * 游戏暂停状态
12670
- *
12671
- * 当设置为true时,游戏循环将暂停执行。
13279
+ * @zh 游戏暂停状态,当设置为true时,游戏循环将暂停执行
13280
+ * @en Game paused state, when set to true, game loop will pause execution
12672
13281
  */
12673
13282
  static paused: boolean;
12674
13283
  /**
12675
- * 全局核心实例
12676
- *
12677
- * 可能为null表示Core尚未初始化或已被销毁
13284
+ * @zh 全局核心实例,可能为null表示Core尚未初始化或已被销毁
13285
+ * @en Global core instance, null means Core is not initialized or destroyed
12678
13286
  */
12679
13287
  private static _instance;
12680
13288
  /**
12681
- * Core专用日志器
13289
+ * @zh Core专用日志器
13290
+ * @en Core logger
12682
13291
  */
12683
- private static _logger;
13292
+ private static readonly _logger;
12684
13293
  /**
12685
- * 调试模式标志
12686
- *
12687
- * 在调试模式下会启用额外的性能监控和错误检查。
13294
+ * @zh 调试模式标志,在调试模式下会启用额外的性能监控和错误检查
13295
+ * @en Debug mode flag, enables additional performance monitoring and error checking in debug mode
12688
13296
  */
12689
13297
  readonly debug: boolean;
12690
13298
  /**
12691
- * 服务容器
12692
- *
12693
- * 管理所有服务的注册、解析和生命周期。
13299
+ * @zh 服务容器,管理所有服务的注册、解析和生命周期
13300
+ * @en Service container for managing registration, resolution, and lifecycle of all services
12694
13301
  */
12695
13302
  private _serviceContainer;
12696
13303
  private _timerManager;
@@ -12698,102 +13305,105 @@ declare class Core {
12698
13305
  private _poolManager;
12699
13306
  private _debugManager?;
12700
13307
  /**
12701
- * 场景管理器
12702
- *
12703
- * 管理当前场景的生命周期。
13308
+ * @zh 场景管理器,管理当前场景的生命周期
13309
+ * @en Scene manager for managing current scene lifecycle
12704
13310
  */
12705
13311
  private _sceneManager;
12706
13312
  /**
12707
- * World管理器
12708
- *
12709
- * 管理多个独立的World实例(可选)。
13313
+ * @zh World管理器,管理多个独立的World实例(可选)
13314
+ * @en World manager for managing multiple independent World instances (optional)
12710
13315
  */
12711
13316
  private _worldManager;
12712
13317
  /**
12713
- * 插件管理器
12714
- *
12715
- * 管理所有插件的生命周期。
13318
+ * @zh 插件管理器,管理所有插件的生命周期
13319
+ * @en Plugin manager for managing all plugin lifecycles
12716
13320
  */
12717
13321
  private _pluginManager;
12718
13322
  /**
12719
- * 插件服务注册表
12720
- *
12721
- * 基于 ServiceToken 的类型安全服务注册表。
12722
- * Type-safe service registry based on ServiceToken.
13323
+ * @zh 插件服务注册表,基于 ServiceToken 的类型安全服务注册表
13324
+ * @en Plugin service registry, type-safe service registry based on ServiceToken
12723
13325
  */
12724
13326
  private _pluginServiceRegistry;
12725
13327
  /**
12726
- * Core配置
13328
+ * @zh Core配置
13329
+ * @en Core configuration
12727
13330
  */
12728
13331
  private _config;
12729
13332
  /**
12730
- * 创建核心实例
13333
+ * @zh 创建核心实例
13334
+ * @en Create core instance
12731
13335
  *
12732
- * @param config - Core配置对象
13336
+ * @param config - @zh Core配置对象 @en Core configuration object
12733
13337
  */
12734
13338
  private constructor();
12735
13339
  /**
12736
- * 获取核心实例
13340
+ * @zh 获取核心实例
13341
+ * @en Get core instance
12737
13342
  *
12738
- * @returns 全局核心实例
13343
+ * @returns @zh 全局核心实例 @en Global core instance
12739
13344
  */
12740
13345
  static get Instance(): Core | null;
12741
13346
  /**
12742
- * 获取服务容器
13347
+ * @zh 获取服务容器
13348
+ * @en Get service container
12743
13349
  *
12744
- * 用于注册和解析自定义服务。
13350
+ * @zh 用于注册和解析自定义服务。
13351
+ * @en Used for registering and resolving custom services.
12745
13352
  *
12746
- * @returns 服务容器实例
12747
- * @throws 如果Core实例未创建
13353
+ * @returns @zh 服务容器实例 @en Service container instance
13354
+ * @throws @zh 如果Core实例未创建 @en If Core instance is not created
12748
13355
  *
12749
13356
  * @example
12750
13357
  * ```typescript
12751
- * // 注册自定义服务
13358
+ * // @zh 注册自定义服务 | @en Register custom service
12752
13359
  * Core.services.registerSingleton(MyService);
12753
13360
  *
12754
- * // 解析服务
13361
+ * // @zh 解析服务 | @en Resolve service
12755
13362
  * const myService = Core.services.resolve(MyService);
12756
13363
  * ```
12757
13364
  */
12758
13365
  static get services(): ServiceContainer;
12759
13366
  /**
12760
- * 获取插件服务注册表
13367
+ * @zh 获取插件服务注册表
13368
+ * @en Get plugin service registry
12761
13369
  *
12762
- * 用于基于 ServiceToken 的类型安全服务注册和获取。
12763
- * For type-safe service registration and retrieval based on ServiceToken.
13370
+ * @zh 用于基于 ServiceToken 的类型安全服务注册和获取。
13371
+ * @en For type-safe service registration and retrieval based on ServiceToken.
12764
13372
  *
12765
- * @returns PluginServiceRegistry 实例
12766
- * @throws 如果 Core 实例未创建
13373
+ * @returns @zh PluginServiceRegistry 实例 @en PluginServiceRegistry instance
13374
+ * @throws @zh 如果 Core 实例未创建 @en If Core instance is not created
12767
13375
  *
12768
13376
  * @example
12769
13377
  * ```typescript
12770
13378
  * import { createServiceToken } from '@esengine/ecs-framework';
12771
13379
  *
12772
- * // 定义服务令牌
13380
+ * // @zh 定义服务令牌 | @en Define service token
12773
13381
  * const MyServiceToken = createServiceToken<IMyService>('myService');
12774
13382
  *
12775
- * // 注册服务
13383
+ * // @zh 注册服务 | @en Register service
12776
13384
  * Core.pluginServices.register(MyServiceToken, myServiceInstance);
12777
13385
  *
12778
- * // 获取服务(可选)
13386
+ * // @zh 获取服务(可选)| @en Get service (optional)
12779
13387
  * const service = Core.pluginServices.get(MyServiceToken);
12780
13388
  *
12781
- * // 获取服务(必需,不存在则抛异常)
13389
+ * // @zh 获取服务(必需,不存在则抛异常)| @en Get service (required, throws if not found)
12782
13390
  * const service = Core.pluginServices.require(MyServiceToken);
12783
13391
  * ```
12784
13392
  */
12785
13393
  static get pluginServices(): PluginServiceRegistry;
12786
13394
  /**
12787
- * 获取World管理器
13395
+ * @zh 获取World管理器
13396
+ * @en Get World manager
12788
13397
  *
12789
- * 用于管理多个独立的World实例(高级用户)。
13398
+ * @zh 用于管理多个独立的World实例(高级用户)。
13399
+ * @en For managing multiple independent World instances (advanced users).
12790
13400
  *
12791
- * @returns WorldManager实例
12792
- * @throws 如果Core实例未创建
13401
+ * @returns @zh WorldManager实例 @en WorldManager instance
13402
+ * @throws @zh 如果Core实例未创建 @en If Core instance is not created
12793
13403
  *
12794
13404
  * @example
12795
13405
  * ```typescript
12796
- * // 创建多个游戏房间
13406
+ * // @zh 创建多个游戏房间 | @en Create multiple game rooms
12797
13407
  * const wm = Core.worldManager;
12798
13408
  * const room1 = wm.createWorld('room_001');
12799
13409
  * room1.createScene('game', new GameScene());
@@ -12802,16 +13412,18 @@ declare class Core {
12802
13412
  */
12803
13413
  static get worldManager(): WorldManager;
12804
13414
  /**
12805
- * 创建Core实例
13415
+ * @zh 创建Core实例
13416
+ * @en Create Core instance
12806
13417
  *
12807
- * 如果实例已存在,则返回现有实例。
13418
+ * @zh 如果实例已存在,则返回现有实例。
13419
+ * @en If instance already exists, returns the existing instance.
12808
13420
  *
12809
- * @param config - Core配置,也可以直接传入boolean表示debug模式(向后兼容)
12810
- * @returns Core实例
13421
+ * @param config - @zh Core配置,也可以直接传入boolean表示debug模式(向后兼容) @en Core config, can also pass boolean for debug mode (backward compatible)
13422
+ * @returns @zh Core实例 @en Core instance
12811
13423
  *
12812
13424
  * @example
12813
13425
  * ```typescript
12814
- * // 方式1:使用配置对象
13426
+ * // @zh 方式1:使用配置对象 | @en Method 1: Use config object
12815
13427
  * Core.create({
12816
13428
  * debug: true,
12817
13429
  * debugConfig: {
@@ -12820,166 +13432,180 @@ declare class Core {
12820
13432
  * }
12821
13433
  * });
12822
13434
  *
12823
- * // 方式2:简单模式(向后兼容)
13435
+ * // @zh 方式2:简单模式(向后兼容)| @en Method 2: Simple mode (backward compatible)
12824
13436
  * Core.create(true); // debug = true
12825
13437
  * ```
12826
13438
  */
12827
13439
  static create(config?: ICoreConfig | boolean): Core;
12828
13440
  /**
12829
- * 设置当前场景
13441
+ * @zh 设置当前场景
13442
+ * @en Set current scene
12830
13443
  *
12831
- * @param scene - 要设置的场景
12832
- * @returns 设置的场景实例
13444
+ * @param scene - @zh 要设置的场景 @en The scene to set
13445
+ * @returns @zh 设置的场景实例 @en The scene instance that was set
12833
13446
  *
12834
13447
  * @example
12835
13448
  * ```typescript
12836
13449
  * Core.create({ debug: true });
12837
13450
  *
12838
- * // 创建并设置场景
13451
+ * // @zh 创建并设置场景 | @en Create and set scene
12839
13452
  * const gameScene = new GameScene();
12840
13453
  * Core.setScene(gameScene);
12841
13454
  * ```
12842
13455
  */
12843
13456
  static setScene<T extends IScene>(scene: T): T;
12844
13457
  /**
12845
- * 获取当前场景
13458
+ * @zh 获取当前场景
13459
+ * @en Get current scene
12846
13460
  *
12847
- * @returns 当前场景,如果没有场景则返回null
13461
+ * @returns @zh 当前场景,如果没有场景则返回null @en Current scene, or null if no scene
12848
13462
  */
12849
13463
  static get scene(): IScene | null;
12850
13464
  /**
12851
- * 获取ECS流式API
13465
+ * @zh 获取ECS流式API
13466
+ * @en Get ECS fluent API
12852
13467
  *
12853
- * @returns ECS API实例,如果当前没有场景则返回null
13468
+ * @returns @zh ECS API实例,如果当前没有场景则返回null @en ECS API instance, or null if no scene
12854
13469
  *
12855
13470
  * @example
12856
13471
  * ```typescript
12857
- * // 使用流式API创建实体
13472
+ * // @zh 使用流式API创建实体 | @en Create entity with fluent API
12858
13473
  * const player = Core.ecsAPI?.createEntity('Player')
12859
13474
  * .addComponent(Position, 100, 100)
12860
13475
  * .addComponent(Velocity, 50, 0);
12861
13476
  *
12862
- * // 查询实体
13477
+ * // @zh 查询实体 | @en Query entities
12863
13478
  * const enemies = Core.ecsAPI?.query(Enemy, Transform);
12864
13479
  *
12865
- * // 发射事件
13480
+ * // @zh 发射事件 | @en Emit event
12866
13481
  * Core.ecsAPI?.emit('game:start', { level: 1 });
12867
13482
  * ```
12868
13483
  */
12869
13484
  static get ecsAPI(): ECSFluentAPI | null;
12870
13485
  /**
12871
- * 延迟加载场景(下一帧切换)
13486
+ * @zh 延迟加载场景(下一帧切换)
13487
+ * @en Load scene with delay (switch on next frame)
12872
13488
  *
12873
- * @param scene - 要加载的场景
13489
+ * @param scene - @zh 要加载的场景 @en The scene to load
12874
13490
  *
12875
13491
  * @example
12876
13492
  * ```typescript
12877
- * // 延迟切换场景(在下一帧生效)
13493
+ * // @zh 延迟切换场景(在下一帧生效)| @en Deferred scene switch (takes effect next frame)
12878
13494
  * Core.loadScene(new MenuScene());
12879
13495
  * ```
12880
13496
  */
12881
13497
  static loadScene<T extends IScene>(scene: T): void;
12882
13498
  /**
12883
- * 更新游戏逻辑
13499
+ * @zh 更新游戏逻辑
13500
+ * @en Update game logic
12884
13501
  *
12885
- * 此方法应该在游戏引擎的更新循环中调用。
12886
- * 会自动更新全局服务和当前场景。
13502
+ * @zh 此方法应该在游戏引擎的更新循环中调用。会自动更新全局服务和当前场景。
13503
+ * @en This method should be called in the game engine's update loop. Automatically updates global services and current scene.
12887
13504
  *
12888
- * @param deltaTime - 外部引擎提供的帧时间间隔(秒)
13505
+ * @param deltaTime - @zh 外部引擎提供的帧时间间隔(秒)@en Frame delta time in seconds from external engine
12889
13506
  *
12890
13507
  * @example
12891
13508
  * ```typescript
12892
- * // 初始化
13509
+ * // @zh 初始化 | @en Initialize
12893
13510
  * Core.create({ debug: true });
12894
13511
  * Core.setScene(new GameScene());
12895
13512
  *
12896
- * // Laya引擎集成
13513
+ * // @zh Laya引擎集成 | @en Laya engine integration
12897
13514
  * Laya.timer.frameLoop(1, this, () => {
12898
13515
  * const deltaTime = Laya.timer.delta / 1000;
12899
- * Core.update(deltaTime); // 自动更新全局服务和场景
13516
+ * Core.update(deltaTime);
12900
13517
  * });
12901
13518
  *
12902
- * // Cocos Creator集成
13519
+ * // @zh Cocos Creator集成 | @en Cocos Creator integration
12903
13520
  * update(deltaTime: number) {
12904
- * Core.update(deltaTime); // 自动更新全局服务和场景
13521
+ * Core.update(deltaTime);
12905
13522
  * }
12906
13523
  * ```
12907
13524
  */
12908
13525
  static update(deltaTime: number): void;
12909
13526
  /**
12910
- * 调度定时器
13527
+ * @zh 调度定时器
13528
+ * @en Schedule a timer
12911
13529
  *
12912
- * 创建一个定时器,在指定时间后执行回调函数。
13530
+ * @zh 创建一个定时器,在指定时间后执行回调函数。
13531
+ * @en Create a timer that executes a callback after the specified time.
12913
13532
  *
12914
- * @param timeInSeconds - 延迟时间(秒)
12915
- * @param repeats - 是否重复执行,默认为false
12916
- * @param context - 回调函数的上下文,默认为null
12917
- * @param onTime - 定时器触发时的回调函数
12918
- * @returns 创建的定时器实例
12919
- * @throws 如果Core实例未创建或onTime回调未提供
13533
+ * @param timeInSeconds - @zh 延迟时间(秒)@en Delay time in seconds
13534
+ * @param repeats - @zh 是否重复执行,默认为false @en Whether to repeat, defaults to false
13535
+ * @param context - @zh 回调函数的上下文 @en Context for the callback
13536
+ * @param onTime - @zh 定时器触发时的回调函数 @en Callback when timer fires
13537
+ * @returns @zh 创建的定时器实例 @en The created timer instance
13538
+ * @throws @zh 如果Core实例未创建或onTime回调未提供 @en If Core instance not created or onTime not provided
12920
13539
  *
12921
13540
  * @example
12922
13541
  * ```typescript
12923
- * // 一次性定时器
13542
+ * // @zh 一次性定时器 | @en One-time timer
12924
13543
  * Core.schedule(1.0, false, null, (timer) => {
12925
- * console.log("1秒后执行一次");
13544
+ * console.log("Executed after 1 second");
12926
13545
  * });
12927
13546
  *
12928
- * // 重复定时器
13547
+ * // @zh 重复定时器 | @en Repeating timer
12929
13548
  * Core.schedule(0.5, true, null, (timer) => {
12930
- * console.log("0.5秒执行一次");
13549
+ * console.log("Executed every 0.5 seconds");
12931
13550
  * });
12932
13551
  * ```
12933
13552
  */
12934
13553
  static schedule<TContext = unknown>(timeInSeconds: number, repeats?: boolean, context?: TContext, onTime?: (timer: ITimer<TContext>) => void): Timer<TContext>;
12935
13554
  /**
12936
- * 启用调试功能
13555
+ * @zh 启用调试功能
13556
+ * @en Enable debug features
12937
13557
  *
12938
- * @param config 调试配置
13558
+ * @param config - @zh 调试配置 @en Debug configuration
12939
13559
  */
12940
13560
  static enableDebug(config: IECSDebugConfig): void;
12941
13561
  /**
12942
- * 禁用调试功能
13562
+ * @zh 禁用调试功能
13563
+ * @en Disable debug features
12943
13564
  */
12944
13565
  static disableDebug(): void;
12945
13566
  /**
12946
- * 获取调试数据
13567
+ * @zh 获取调试数据
13568
+ * @en Get debug data
12947
13569
  *
12948
- * @returns 当前调试数据,如果调试未启用则返回null
13570
+ * @returns @zh 当前调试数据,如果调试未启用则返回null @en Current debug data, or null if debug is disabled
12949
13571
  */
12950
13572
  static getDebugData(): unknown;
12951
13573
  /**
12952
- * 检查调试是否启用
13574
+ * @zh 检查调试是否启用
13575
+ * @en Check if debug is enabled
12953
13576
  *
12954
- * @returns 调试状态
13577
+ * @returns @zh 调试状态 @en Debug status
12955
13578
  */
12956
13579
  static get isDebugEnabled(): boolean;
12957
13580
  /**
12958
- * 获取性能监视器实例
13581
+ * @zh 获取性能监视器实例
13582
+ * @en Get performance monitor instance
12959
13583
  *
12960
- * @returns 性能监视器,如果Core未初始化则返回null
13584
+ * @returns @zh 性能监视器,如果Core未初始化则返回null @en Performance monitor, or null if Core not initialized
12961
13585
  */
12962
13586
  static get performanceMonitor(): PerformanceMonitor | null;
12963
13587
  /**
12964
- * 安装插件
13588
+ * @zh 安装插件
13589
+ * @en Install plugin
12965
13590
  *
12966
- * @param plugin - 插件实例
12967
- * @throws 如果Core实例未创建或插件安装失败
13591
+ * @param plugin - @zh 插件实例 @en Plugin instance
13592
+ * @throws @zh 如果Core实例未创建或插件安装失败 @en If Core instance not created or plugin installation fails
12968
13593
  *
12969
13594
  * @example
12970
13595
  * ```typescript
12971
13596
  * Core.create({ debug: true });
12972
13597
  *
12973
- * // 安装插件
13598
+ * // @zh 安装插件 | @en Install plugin
12974
13599
  * await Core.installPlugin(new MyPlugin());
12975
13600
  * ```
12976
13601
  */
12977
13602
  static installPlugin(plugin: IPlugin): Promise<void>;
12978
13603
  /**
12979
- * 卸载插件
13604
+ * @zh 卸载插件
13605
+ * @en Uninstall plugin
12980
13606
  *
12981
- * @param name - 插件名称
12982
- * @throws 如果Core实例未创建或插件卸载失败
13607
+ * @param name - @zh 插件名称 @en Plugin name
13608
+ * @throws @zh 如果Core实例未创建或插件卸载失败 @en If Core instance not created or plugin uninstallation fails
12983
13609
  *
12984
13610
  * @example
12985
13611
  * ```typescript
@@ -12988,10 +13614,11 @@ declare class Core {
12988
13614
  */
12989
13615
  static uninstallPlugin(name: string): Promise<void>;
12990
13616
  /**
12991
- * 获取插件实例
13617
+ * @zh 获取插件实例
13618
+ * @en Get plugin instance
12992
13619
  *
12993
- * @param name - 插件名称
12994
- * @returns 插件实例,如果未安装则返回undefined
13620
+ * @param name - @zh 插件名称 @en Plugin name
13621
+ * @returns @zh 插件实例,如果未安装则返回undefined @en Plugin instance, or undefined if not installed
12995
13622
  *
12996
13623
  * @example
12997
13624
  * ```typescript
@@ -13003,10 +13630,11 @@ declare class Core {
13003
13630
  */
13004
13631
  static getPlugin(name: string): IPlugin | undefined;
13005
13632
  /**
13006
- * 检查插件是否已安装
13633
+ * @zh 检查插件是否已安装
13634
+ * @en Check if plugin is installed
13007
13635
  *
13008
- * @param name - 插件名称
13009
- * @returns 是否已安装
13636
+ * @param name - @zh 插件名称 @en Plugin name
13637
+ * @returns @zh 是否已安装 @en Whether installed
13010
13638
  *
13011
13639
  * @example
13012
13640
  * ```typescript
@@ -13017,21 +13645,26 @@ declare class Core {
13017
13645
  */
13018
13646
  static isPluginInstalled(name: string): boolean;
13019
13647
  /**
13020
- * 初始化核心系统
13648
+ * @zh 初始化核心系统
13649
+ * @en Initialize core system
13021
13650
  *
13022
- * 执行核心系统的初始化逻辑。
13651
+ * @zh 执行核心系统的初始化逻辑。
13652
+ * @en Execute core system initialization logic.
13023
13653
  */
13024
13654
  protected initialize(): void;
13025
13655
  /**
13026
- * 内部更新方法
13656
+ * @zh 内部更新方法
13657
+ * @en Internal update method
13027
13658
  *
13028
- * @param deltaTime - 帧时间间隔(秒)
13659
+ * @param deltaTime - @zh 帧时间间隔(秒)@en Frame delta time in seconds
13029
13660
  */
13030
13661
  private updateInternal;
13031
13662
  /**
13032
- * 销毁Core实例
13663
+ * @zh 销毁Core实例
13664
+ * @en Destroy Core instance
13033
13665
  *
13034
- * 清理所有资源,通常在应用程序关闭时调用。
13666
+ * @zh 清理所有资源,通常在应用程序关闭时调用。
13667
+ * @en Clean up all resources, typically called when the application closes.
13035
13668
  */
13036
13669
  static destroy(): void;
13037
13670
  }
@@ -13297,9 +13930,10 @@ declare class RuntimeModeService implements IRuntimeMode {
13297
13930
  * @internal
13298
13931
  */
13299
13932
  updateMode(config: RuntimeModeConfig): void;
13933
+ private static readonly _logger;
13300
13934
  /**
13301
- * 通知模式变化
13302
- * Notify mode change
13935
+ * @zh 通知模式变化
13936
+ * @en Notify mode change
13303
13937
  */
13304
13938
  private _notifyChange;
13305
13939
  /**
@@ -15088,8 +15722,8 @@ declare class BinarySerializer {
15088
15722
  * 性能分析器 SDK
15089
15723
  */
15090
15724
  declare class ProfilerSDK {
15091
- private static instance;
15092
- private config;
15725
+ private static _instance;
15726
+ private _config;
15093
15727
  private currentFrame;
15094
15728
  private frameHistory;
15095
15729
  private frameNumber;
@@ -15103,11 +15737,13 @@ declare class ProfilerSDK {
15103
15737
  private performanceObserver;
15104
15738
  private constructor();
15105
15739
  /**
15106
- * 获取单例实例
15740
+ * @zh 获取单例实例
15741
+ * @en Get singleton instance
15107
15742
  */
15108
15743
  static getInstance(config?: Partial<ProfilerConfig>): ProfilerSDK;
15109
15744
  /**
15110
- * 重置实例(测试用)
15745
+ * @zh 重置实例(测试用)
15746
+ * @en Reset instance (for testing)
15111
15747
  */
15112
15748
  static resetInstance(): void;
15113
15749
  /**
@@ -15147,7 +15783,8 @@ declare class ProfilerSDK {
15147
15783
  */
15148
15784
  static setEnabled(enabled: boolean): void;
15149
15785
  /**
15150
- * 检查是否启用
15786
+ * @zh 检查是否启用
15787
+ * @en Check if enabled
15151
15788
  */
15152
15789
  static isEnabled(): boolean;
15153
15790
  /**
@@ -15167,11 +15804,13 @@ declare class ProfilerSDK {
15167
15804
  */
15168
15805
  static reset(): void;
15169
15806
  /**
15170
- * 开始采样
15807
+ * @zh 开始采样
15808
+ * @en Begin sample
15171
15809
  */
15172
15810
  beginSample(name: string, category?: ProfileCategory): SampleHandle | null;
15173
15811
  /**
15174
- * 结束采样
15812
+ * @zh 结束采样
15813
+ * @en End sample
15175
15814
  */
15176
15815
  endSample(handle: SampleHandle): void;
15177
15816
  /**
@@ -15183,23 +15822,28 @@ declare class ProfilerSDK {
15183
15822
  */
15184
15823
  measureAsync<T>(name: string, fn: () => Promise<T>, category?: ProfileCategory): Promise<T>;
15185
15824
  /**
15186
- * 开始帧
15825
+ * @zh 开始帧
15826
+ * @en Begin frame
15187
15827
  */
15188
15828
  beginFrame(): void;
15189
15829
  /**
15190
- * 结束帧
15830
+ * @zh 结束帧
15831
+ * @en End frame
15191
15832
  */
15192
15833
  endFrame(): void;
15193
15834
  /**
15194
- * 递增计数器
15835
+ * @zh 递增计数器
15836
+ * @en Increment counter
15195
15837
  */
15196
15838
  incrementCounter(name: string, value?: number, category?: ProfileCategory): void;
15197
15839
  /**
15198
- * 设置仪表值
15840
+ * @zh 设置仪表值
15841
+ * @en Set gauge value
15199
15842
  */
15200
15843
  setGauge(name: string, value: number, category?: ProfileCategory): void;
15201
15844
  /**
15202
- * 设置启用状态
15845
+ * @zh 设置启用状态
15846
+ * @en Set enabled state
15203
15847
  */
15204
15848
  setEnabled(enabled: boolean): void;
15205
15849
  /**
@@ -15211,10 +15855,13 @@ declare class ProfilerSDK {
15211
15855
  */
15212
15856
  generateReport(frameCount?: number): ProfileReport;
15213
15857
  /**
15214
- * 从帧历史构建调用图
15215
- * 注意:totalTime 存储的是平均耗时(总耗时/调用次数),而不是累计总耗时
15858
+ * @zh 从帧历史构建调用图
15859
+ * @en Build call graph from frame history
15860
+ *
15861
+ * @zh 注意:totalTime 存储的是平均耗时(总耗时/调用次数),而不是累计总耗时
15862
+ * @en Note: totalTime stores average time (total/count), not cumulative total
15216
15863
  */
15217
- private buildCallGraphFromFrames;
15864
+ private _buildCallGraphFromFrames;
15218
15865
  /**
15219
15866
  * 获取调用图数据
15220
15867
  */
@@ -15238,15 +15885,15 @@ declare class ProfilerSDK {
15238
15885
  * 释放资源
15239
15886
  */
15240
15887
  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;
15888
+ private _captureMemory;
15889
+ private _resetFrameCounters;
15890
+ private _calculateSampleStats;
15891
+ private _calculateCategoryStats;
15892
+ private _updateCallGraph;
15893
+ private _aggregateSampleStats;
15894
+ private _aggregateCategoryStats;
15895
+ private _setupLongTaskObserver;
15896
+ private _createEmptyReport;
15250
15897
  }
15251
15898
 
15252
15899
  /**
@@ -15289,18 +15936,20 @@ interface SampleData {
15289
15936
  * 自动性能分析器
15290
15937
  */
15291
15938
  declare class AutoProfiler {
15292
- private static instance;
15293
- private config;
15939
+ private static _instance;
15940
+ private _config;
15294
15941
  private wrappedObjects;
15295
15942
  private samplingProfiler;
15296
15943
  private registeredClasses;
15297
15944
  private constructor();
15298
15945
  /**
15299
- * 获取单例实例
15946
+ * @zh 获取单例实例
15947
+ * @en Get singleton instance
15300
15948
  */
15301
15949
  static getInstance(config?: Partial<AutoProfilerConfig>): AutoProfiler;
15302
15950
  /**
15303
- * 重置实例
15951
+ * @zh 重置实例
15952
+ * @en Reset instance
15304
15953
  */
15305
15954
  static resetInstance(): void;
15306
15955
  /**
@@ -15329,23 +15978,28 @@ declare class AutoProfiler {
15329
15978
  */
15330
15979
  static stopSampling(): SampleData[];
15331
15980
  /**
15332
- * 设置启用状态
15981
+ * @zh 设置启用状态
15982
+ * @en Set enabled state
15333
15983
  */
15334
15984
  setEnabled(enabled: boolean): void;
15335
15985
  /**
15336
- * 注册类以进行自动分析
15986
+ * @zh 注册类以进行自动分析
15987
+ * @en Register class for automatic profiling
15337
15988
  */
15338
15989
  registerClass<T extends new (...args: any[]) => any>(constructor: T, category?: ProfileCategory, className?: string): T;
15339
15990
  /**
15340
- * 包装对象实例的所有方法
15991
+ * @zh 包装对象实例的所有方法
15992
+ * @en Wrap all methods of an object instance
15341
15993
  */
15342
15994
  wrapInstance<T extends object>(instance: T, className: string, category?: ProfileCategory): T;
15343
15995
  /**
15344
- * 包装单个函数
15996
+ * @zh 包装单个函数
15997
+ * @en Wrap a single function
15345
15998
  */
15346
15999
  wrapFunction<T extends (...args: any[]) => any>(fn: T, name: string, category?: ProfileCategory): T;
15347
16000
  /**
15348
- * 启动采样分析器
16001
+ * @zh 启动采样分析器
16002
+ * @en Start sampling profiler
15349
16003
  */
15350
16004
  startSampling(): void;
15351
16005
  /**
@@ -15357,21 +16011,25 @@ declare class AutoProfiler {
15357
16011
  */
15358
16012
  dispose(): void;
15359
16013
  /**
15360
- * 创建包装后的方法
16014
+ * @zh 创建包装后的方法
16015
+ * @en Create wrapped method
15361
16016
  */
15362
- private createWrappedMethod;
16017
+ private _createWrappedMethod;
15363
16018
  /**
15364
- * 获取对象的所有方法名
16019
+ * @zh 获取对象的所有方法名
16020
+ * @en Get all method names of an object
15365
16021
  */
15366
- private getAllMethodNames;
16022
+ private _getAllMethodNames;
15367
16023
  /**
15368
- * 获取属性描述符
16024
+ * @zh 获取属性描述符
16025
+ * @en Get property descriptor
15369
16026
  */
15370
- private getPropertyDescriptor;
16027
+ private _getPropertyDescriptor;
15371
16028
  /**
15372
- * 判断是否应该排除该方法
16029
+ * @zh 判断是否应该排除该方法
16030
+ * @en Check if method should be excluded
15373
16031
  */
15374
- private shouldExcludeMethod;
16032
+ private _shouldExcludeMethod;
15375
16033
  }
15376
16034
  /**
15377
16035
  * @Profile 装饰器
@@ -15449,189 +16107,23 @@ declare function isValidGUID(value: string): boolean;
15449
16107
  declare const EMPTY_GUID = "00000000-0000-0000-0000-000000000000";
15450
16108
 
15451
16109
  /**
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
- * 自动检测当前运行环境并返回对应的平台信息
16110
+ * @zh 平台检测器 - 自动检测当前运行环境并返回对应的平台信息
16111
+ * @en Platform Detector - Automatically detect the current runtime environment
15623
16112
  */
15624
16113
  declare class PlatformDetector {
16114
+ private static readonly miniGameGlobals;
15625
16115
  /**
15626
16116
  * 检测当前平台
15627
16117
  */
15628
16118
  static detect(): PlatformDetectionResult;
15629
16119
  /**
15630
- * 检测是否为微信小游戏环境
16120
+ * @zh 检测是否为微信小游戏环境
16121
+ * @en Check if running in WeChat Mini Game environment
15631
16122
  */
15632
16123
  private static isWeChatMiniGame;
15633
16124
  /**
15634
- * 检测是否为字节跳动小游戏环境
16125
+ * @zh 检测是否为字节跳动小游戏环境
16126
+ * @en Check if running in ByteDance Mini Game environment
15635
16127
  */
15636
16128
  private static isByteDanceMiniGame;
15637
16129
  /**
@@ -15639,11 +16131,13 @@ declare class PlatformDetector {
15639
16131
  */
15640
16132
  private static isNodeJS;
15641
16133
  /**
15642
- * 检测是否为支付宝小游戏环境
16134
+ * @zh 检测是否为支付宝小游戏环境
16135
+ * @en Check if running in Alipay Mini Game environment
15643
16136
  */
15644
16137
  private static isAlipayMiniGame;
15645
16138
  /**
15646
- * 检测是否为百度小游戏环境
16139
+ * @zh 检测是否为百度小游戏环境
16140
+ * @en Check if running in Baidu Mini Game environment
15647
16141
  */
15648
16142
  private static isBaiduMiniGame;
15649
16143
  /**
@@ -15667,9 +16161,10 @@ declare class PlatformDetector {
15667
16161
  */
15668
16162
  static isEditorEnvironment(): boolean;
15669
16163
  /**
15670
- * 获取详细的环境信息(用于调试)
16164
+ * @zh 获取详细的环境信息(用于调试)
16165
+ * @en Get detailed environment information for debugging
15671
16166
  */
15672
- static getDetailedInfo(): Record<string, any>;
16167
+ static getDetailedInfo(): Record<string, unknown>;
15673
16168
  }
15674
16169
 
15675
16170
  /**
@@ -15677,37 +16172,46 @@ declare class PlatformDetector {
15677
16172
  * 用户需要手动注册平台适配器
15678
16173
  */
15679
16174
  declare class PlatformManager {
15680
- private static instance;
15681
- private adapter;
15682
- private readonly logger;
16175
+ private static _instance;
16176
+ private _adapter;
16177
+ private readonly _logger;
15683
16178
  private constructor();
15684
16179
  /**
15685
- * 获取单例实例
16180
+ * @zh 获取单例实例
16181
+ * @en Get singleton instance
15686
16182
  */
15687
16183
  static getInstance(): PlatformManager;
15688
16184
  /**
15689
- * 获取当前平台适配器
16185
+ * @zh 获取当前平台适配器
16186
+ * @en Get current platform adapter
15690
16187
  */
15691
16188
  getAdapter(): IPlatformAdapter;
15692
16189
  /**
15693
- * 注册平台适配器
16190
+ * @zh 注册平台适配器
16191
+ * @en Register platform adapter
15694
16192
  */
15695
16193
  registerAdapter(adapter: IPlatformAdapter): void;
15696
16194
  /**
15697
- * 检查是否已注册适配器
16195
+ * @zh 检查是否已注册适配器
16196
+ * @en Check if adapter is registered
15698
16197
  */
15699
16198
  hasAdapter(): boolean;
15700
16199
  /**
15701
- * 获取平台适配器信息(用于调试)
16200
+ * @zh 获取平台适配器信息(用于调试)
16201
+ * @en Get platform adapter info (for debugging)
15702
16202
  */
15703
16203
  getAdapterInfo(): any;
15704
16204
  /**
15705
- * 检查当前平台是否支持特定功能
16205
+ * @zh 检查当前平台是否支持特定功能
16206
+ * @en Check if current platform supports specific feature
15706
16207
  */
15707
16208
  supportsFeature(feature: 'worker' | 'shared-array-buffer' | 'transferable-objects' | 'module-worker'): boolean;
15708
16209
  /**
15709
- * 获取基础的Worker配置信息(不做自动决策)
15710
- * 用户应该根据自己的业务需求来配置Worker参数
16210
+ * @zh 获取基础的Worker配置信息(不做自动决策)
16211
+ * @en Get basic Worker configuration (no auto-decision)
16212
+ *
16213
+ * @zh 用户应该根据自己的业务需求来配置Worker参数
16214
+ * @en Users should configure Worker parameters based on their business requirements
15711
16215
  */
15712
16216
  getBasicWorkerConfig(): {
15713
16217
  platformSupportsWorker: boolean;
@@ -15716,7 +16220,8 @@ declare class PlatformManager {
15716
16220
  platformLimitations: any;
15717
16221
  };
15718
16222
  /**
15719
- * 异步获取完整的平台配置信息(包含性能信息)
16223
+ * @zh 异步获取完整的平台配置信息(包含性能信息)
16224
+ * @en Async get full platform configuration (includes performance info)
15720
16225
  */
15721
16226
  getFullPlatformConfig(): Promise<any>;
15722
16227
  }
@@ -15737,5 +16242,5 @@ declare function getFullPlatformConfig(): Promise<any>;
15737
16242
  declare function supportsFeature(feature: 'worker' | 'shared-array-buffer' | 'transferable-objects' | 'module-worker'): boolean;
15738
16243
  declare function hasAdapter(): boolean;
15739
16244
 
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 };
16245
+ 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 };
16246
+ 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 };