@esengine/ecs-framework 2.2.13 → 2.2.15
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/LICENSE +21 -0
- package/index.cjs +1 -1
- package/index.cjs.map +1 -1
- package/index.d.ts +708 -103
- package/index.es5.js +2 -2
- package/index.es5.js.map +1 -1
- package/index.mjs +1 -1
- package/index.mjs.map +1 -1
- package/index.umd.js +2 -2
- package/index.umd.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @esengine/ecs-framework v2.2.
|
|
2
|
+
* @esengine/ecs-framework v2.2.15
|
|
3
3
|
* TypeScript definitions
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -692,8 +692,6 @@ interface ISceneDebugData {
|
|
|
692
692
|
sceneEntityCount: number;
|
|
693
693
|
/** 场景系统数 */
|
|
694
694
|
sceneSystemCount: number;
|
|
695
|
-
/** 场景内存使用量 */
|
|
696
|
-
sceneMemory: number;
|
|
697
695
|
/** 场景启动时间 */
|
|
698
696
|
sceneUptime: number;
|
|
699
697
|
}
|
|
@@ -919,16 +917,16 @@ declare class BitMask64Utils {
|
|
|
919
917
|
private static getSegmentByBitIndex;
|
|
920
918
|
}
|
|
921
919
|
|
|
920
|
+
/**
|
|
921
|
+
* SoA存储器支持的TypedArray类型
|
|
922
|
+
*/
|
|
923
|
+
type SupportedTypedArray = Float32Array | Float64Array | Int32Array | Uint32Array | Int16Array | Uint16Array | Int8Array | Uint8Array | Uint8ClampedArray;
|
|
924
|
+
|
|
922
925
|
/**
|
|
923
926
|
* 启用SoA优化装饰器
|
|
924
927
|
* 默认关闭SoA,只有在大规模批量操作场景下才建议开启
|
|
925
928
|
*/
|
|
926
929
|
declare function EnableSoA<T extends ComponentType>(target: T): T;
|
|
927
|
-
/**
|
|
928
|
-
* 高精度数值装饰器
|
|
929
|
-
* 标记字段需要保持完整精度,存储为复杂对象而非TypedArray
|
|
930
|
-
*/
|
|
931
|
-
declare function HighPrecision(target: any, propertyKey: string | symbol): void;
|
|
932
930
|
/**
|
|
933
931
|
* 64位浮点数装饰器
|
|
934
932
|
* 标记字段使用Float64Array存储(更高精度但更多内存)
|
|
@@ -994,51 +992,11 @@ declare function SerializeArray(target: any, propertyKey: string | symbol): void
|
|
|
994
992
|
* 标记字段需要深拷贝处理(适用于嵌套对象)
|
|
995
993
|
*/
|
|
996
994
|
declare function DeepCopy(target: any, propertyKey: string | symbol): void;
|
|
997
|
-
/**
|
|
998
|
-
* 自动类型推断装饰器
|
|
999
|
-
* 根据字段的默认值和数值范围自动选择最优的TypedArray类型
|
|
1000
|
-
*
|
|
1001
|
-
* @param options 类型推断选项
|
|
1002
|
-
* @param options.minValue 数值的最小值(用于范围优化)
|
|
1003
|
-
* @param options.maxValue 数值的最大值(用于范围优化)
|
|
1004
|
-
* @param options.precision 是否需要浮点精度(true: 使用浮点数组, false: 使用整数数组)
|
|
1005
|
-
* @param options.signed 是否需要符号位(仅在整数模式下有效)
|
|
1006
|
-
*/
|
|
1007
|
-
declare function AutoTyped(options?: {
|
|
1008
|
-
minValue?: number;
|
|
1009
|
-
maxValue?: number;
|
|
1010
|
-
precision?: boolean;
|
|
1011
|
-
signed?: boolean;
|
|
1012
|
-
}): (target: any, propertyKey: string | symbol) => void;
|
|
1013
|
-
/**
|
|
1014
|
-
* 自动类型推断器
|
|
1015
|
-
* 根据数值类型和范围自动选择最优的TypedArray类型
|
|
1016
|
-
*/
|
|
1017
|
-
declare class TypeInference {
|
|
1018
|
-
/**
|
|
1019
|
-
* 根据数值范围推断最优的TypedArray类型
|
|
1020
|
-
*/
|
|
1021
|
-
static inferOptimalType(value: any, options?: {
|
|
1022
|
-
minValue?: number;
|
|
1023
|
-
maxValue?: number;
|
|
1024
|
-
precision?: boolean;
|
|
1025
|
-
signed?: boolean;
|
|
1026
|
-
}): string;
|
|
1027
|
-
/**
|
|
1028
|
-
* 根据推断的类型名创建对应的TypedArray构造函数
|
|
1029
|
-
*/
|
|
1030
|
-
static getTypedArrayConstructor(typeName: string): typeof Float32Array | typeof Float64Array | typeof Int32Array | typeof Uint32Array | typeof Int16Array | typeof Uint16Array | typeof Int8Array | typeof Uint8Array | typeof Uint8ClampedArray;
|
|
1031
|
-
}
|
|
1032
|
-
/**
|
|
1033
|
-
* SoA存储器支持的TypedArray类型
|
|
1034
|
-
*/
|
|
1035
|
-
type SupportedTypedArray = Float32Array | Float64Array | Int32Array | Uint32Array | Int16Array | Uint16Array | Int8Array | Uint8Array | Uint8ClampedArray;
|
|
1036
995
|
/**
|
|
1037
996
|
* SoA存储器(需要装饰器启用)
|
|
1038
997
|
* 使用Structure of Arrays存储模式,在大规模批量操作时提供优异性能
|
|
1039
998
|
*/
|
|
1040
999
|
declare class SoAStorage<T extends Component> {
|
|
1041
|
-
private static readonly _logger;
|
|
1042
1000
|
private fields;
|
|
1043
1001
|
private stringFields;
|
|
1044
1002
|
private serializedFields;
|
|
@@ -1049,23 +1007,24 @@ declare class SoAStorage<T extends Component> {
|
|
|
1049
1007
|
private _size;
|
|
1050
1008
|
private _capacity;
|
|
1051
1009
|
readonly type: ComponentType<T>;
|
|
1010
|
+
private fieldTypes;
|
|
1011
|
+
private serializeMapFields;
|
|
1012
|
+
private serializeSetFields;
|
|
1013
|
+
private serializeArrayFields;
|
|
1052
1014
|
constructor(componentType: ComponentType<T>);
|
|
1053
1015
|
private initializeFields;
|
|
1054
1016
|
addComponent(entityId: number, component: T): void;
|
|
1055
1017
|
private updateComponentAtIndex;
|
|
1018
|
+
getComponent(entityId: number): T | null;
|
|
1056
1019
|
/**
|
|
1057
|
-
*
|
|
1058
|
-
|
|
1059
|
-
private serializeValue;
|
|
1060
|
-
/**
|
|
1061
|
-
* 反序列化JSON字符串为值
|
|
1020
|
+
* 创建组件的 Proxy 视图
|
|
1021
|
+
* 读写操作直接映射到底层 TypedArray,无数据复制
|
|
1062
1022
|
*/
|
|
1063
|
-
private
|
|
1023
|
+
private createProxyView;
|
|
1064
1024
|
/**
|
|
1065
|
-
*
|
|
1025
|
+
* 获取组件的快照副本(用于序列化等需要独立副本的场景)
|
|
1066
1026
|
*/
|
|
1067
|
-
|
|
1068
|
-
getComponent(entityId: number): T | null;
|
|
1027
|
+
getComponentSnapshot(entityId: number): T | null;
|
|
1069
1028
|
private getFieldType;
|
|
1070
1029
|
hasComponent(entityId: number): boolean;
|
|
1071
1030
|
removeComponent(entityId: number): T | null;
|
|
@@ -1697,6 +1656,12 @@ declare class EntityList {
|
|
|
1697
1656
|
* @param isAdd 是否为添加操作
|
|
1698
1657
|
*/
|
|
1699
1658
|
private updateNameIndex;
|
|
1659
|
+
/**
|
|
1660
|
+
* 重新排序实体
|
|
1661
|
+
* @param entityId 要移动的实体ID
|
|
1662
|
+
* @param newIndex 新的索引位置
|
|
1663
|
+
*/
|
|
1664
|
+
reorderEntity(entityId: number, newIndex: number): void;
|
|
1700
1665
|
/**
|
|
1701
1666
|
* 获取实体列表的统计信息
|
|
1702
1667
|
* @returns 统计信息
|
|
@@ -5217,7 +5182,7 @@ declare class Scene implements IScene {
|
|
|
5217
5182
|
* 在场景中添加一个EntitySystem处理器
|
|
5218
5183
|
*
|
|
5219
5184
|
* 支持两种使用方式:
|
|
5220
|
-
* 1. 传入类型(推荐):自动使用DI创建实例,支持@Injectable和@
|
|
5185
|
+
* 1. 传入类型(推荐):自动使用DI创建实例,支持@Injectable和@InjectProperty装饰器
|
|
5221
5186
|
* 2. 传入实例:直接使用提供的实例
|
|
5222
5187
|
*
|
|
5223
5188
|
* @param systemTypeOrInstance 系统类型或系统实例
|
|
@@ -5228,7 +5193,10 @@ declare class Scene implements IScene {
|
|
|
5228
5193
|
* // 方式1:传入类型,自动DI(推荐)
|
|
5229
5194
|
* @Injectable()
|
|
5230
5195
|
* class PhysicsSystem extends EntitySystem {
|
|
5231
|
-
*
|
|
5196
|
+
* @InjectProperty(CollisionSystem)
|
|
5197
|
+
* private collision!: CollisionSystem;
|
|
5198
|
+
*
|
|
5199
|
+
* constructor() {
|
|
5232
5200
|
* super(Matcher.empty().all(Transform));
|
|
5233
5201
|
* }
|
|
5234
5202
|
* }
|
|
@@ -5261,7 +5229,10 @@ declare class Scene implements IScene {
|
|
|
5261
5229
|
* @Injectable()
|
|
5262
5230
|
* @ECSSystem('Physics', { updateOrder: 10 })
|
|
5263
5231
|
* class PhysicsSystem extends EntitySystem implements IService {
|
|
5264
|
-
*
|
|
5232
|
+
* @InjectProperty(CollisionSystem)
|
|
5233
|
+
* private collision!: CollisionSystem;
|
|
5234
|
+
*
|
|
5235
|
+
* constructor() {
|
|
5265
5236
|
* super(Matcher.empty().all(Transform, RigidBody));
|
|
5266
5237
|
* }
|
|
5267
5238
|
* dispose() {}
|
|
@@ -5294,7 +5265,7 @@ declare class Scene implements IScene {
|
|
|
5294
5265
|
/**
|
|
5295
5266
|
* 获取指定类型的EntitySystem处理器
|
|
5296
5267
|
*
|
|
5297
|
-
* @deprecated 推荐使用依赖注入代替此方法。使用 `scene.services.resolve(SystemType)`
|
|
5268
|
+
* @deprecated 推荐使用依赖注入代替此方法。使用 `scene.services.resolve(SystemType)` 或使用 `@InjectProperty(SystemType)` 装饰器。
|
|
5298
5269
|
*
|
|
5299
5270
|
* @param type 处理器类型
|
|
5300
5271
|
* @returns 处理器实例,如果未找到则返回null
|
|
@@ -5303,8 +5274,11 @@ declare class Scene implements IScene {
|
|
|
5303
5274
|
* ```typescript
|
|
5304
5275
|
* @Injectable()
|
|
5305
5276
|
* class MySystem extends EntitySystem {
|
|
5306
|
-
*
|
|
5307
|
-
*
|
|
5277
|
+
* @InjectProperty(PhysicsSystem)
|
|
5278
|
+
* private physics!: PhysicsSystem;
|
|
5279
|
+
*
|
|
5280
|
+
* constructor() {
|
|
5281
|
+
* super(Matcher.empty());
|
|
5308
5282
|
* }
|
|
5309
5283
|
* }
|
|
5310
5284
|
* ```
|
|
@@ -7227,15 +7201,27 @@ declare abstract class WorkerEntitySystem<TEntityData = any> extends EntitySyste
|
|
|
7227
7201
|
* 存储组件类型名称的Symbol键
|
|
7228
7202
|
*/
|
|
7229
7203
|
declare const COMPONENT_TYPE_NAME: unique symbol;
|
|
7204
|
+
/**
|
|
7205
|
+
* 存储组件依赖的Symbol键
|
|
7206
|
+
*/
|
|
7207
|
+
declare const COMPONENT_DEPENDENCIES: unique symbol;
|
|
7230
7208
|
/**
|
|
7231
7209
|
* 存储系统类型名称的Symbol键
|
|
7232
7210
|
*/
|
|
7233
7211
|
declare const SYSTEM_TYPE_NAME: unique symbol;
|
|
7212
|
+
/**
|
|
7213
|
+
* 组件装饰器配置选项
|
|
7214
|
+
*/
|
|
7215
|
+
interface ComponentOptions {
|
|
7216
|
+
/** 依赖的其他组件名称列表 */
|
|
7217
|
+
requires?: string[];
|
|
7218
|
+
}
|
|
7234
7219
|
/**
|
|
7235
7220
|
* 组件类型装饰器
|
|
7236
7221
|
* 用于为组件类指定固定的类型名称,避免在代码混淆后失效
|
|
7237
7222
|
*
|
|
7238
7223
|
* @param typeName 组件类型名称
|
|
7224
|
+
* @param options 组件配置选项
|
|
7239
7225
|
* @example
|
|
7240
7226
|
* ```typescript
|
|
7241
7227
|
* @ECSComponent('Position')
|
|
@@ -7243,9 +7229,19 @@ declare const SYSTEM_TYPE_NAME: unique symbol;
|
|
|
7243
7229
|
* x: number = 0;
|
|
7244
7230
|
* y: number = 0;
|
|
7245
7231
|
* }
|
|
7232
|
+
*
|
|
7233
|
+
* // 带依赖声明
|
|
7234
|
+
* @ECSComponent('SpriteAnimator', { requires: ['Sprite'] })
|
|
7235
|
+
* class SpriteAnimatorComponent extends Component {
|
|
7236
|
+
* // ...
|
|
7237
|
+
* }
|
|
7246
7238
|
* ```
|
|
7247
7239
|
*/
|
|
7248
|
-
declare function ECSComponent(typeName: string): <T extends new (...args: any[]) => Component>(target: T) => T;
|
|
7240
|
+
declare function ECSComponent(typeName: string, options?: ComponentOptions): <T extends new (...args: any[]) => Component>(target: T) => T;
|
|
7241
|
+
/**
|
|
7242
|
+
* 获取组件的依赖列表
|
|
7243
|
+
*/
|
|
7244
|
+
declare function getComponentDependencies(componentType: ComponentType$1): string[] | undefined;
|
|
7249
7245
|
/**
|
|
7250
7246
|
* System元数据配置
|
|
7251
7247
|
*/
|
|
@@ -7275,11 +7271,14 @@ interface SystemMetadata {
|
|
|
7275
7271
|
* }
|
|
7276
7272
|
* }
|
|
7277
7273
|
*
|
|
7278
|
-
* //
|
|
7274
|
+
* // 配置更新顺序和依赖注入
|
|
7279
7275
|
* @Injectable()
|
|
7280
7276
|
* @ECSSystem('Physics', { updateOrder: 10 })
|
|
7281
7277
|
* class PhysicsSystem extends EntitySystem {
|
|
7282
|
-
*
|
|
7278
|
+
* @InjectProperty(CollisionSystem)
|
|
7279
|
+
* private collision!: CollisionSystem;
|
|
7280
|
+
*
|
|
7281
|
+
* constructor() {
|
|
7283
7282
|
* super(Matcher.empty().all(Transform, RigidBody));
|
|
7284
7283
|
* }
|
|
7285
7284
|
* }
|
|
@@ -7365,6 +7364,573 @@ declare function getEntityRefMetadata(component: any): EntityRefMetadata | null;
|
|
|
7365
7364
|
*/
|
|
7366
7365
|
declare function hasEntityRef(component: any): boolean;
|
|
7367
7366
|
|
|
7367
|
+
/*! *****************************************************************************
|
|
7368
|
+
Copyright (C) Microsoft. All rights reserved.
|
|
7369
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
7370
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
7371
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
7372
|
+
|
|
7373
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
7374
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
7375
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
7376
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
7377
|
+
|
|
7378
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
7379
|
+
and limitations under the License.
|
|
7380
|
+
***************************************************************************** */
|
|
7381
|
+
|
|
7382
|
+
|
|
7383
|
+
|
|
7384
|
+
declare global {
|
|
7385
|
+
namespace Reflect {
|
|
7386
|
+
/**
|
|
7387
|
+
* Applies a set of decorators to a target object.
|
|
7388
|
+
* @param decorators An array of decorators.
|
|
7389
|
+
* @param target The target object.
|
|
7390
|
+
* @returns The result of applying the provided decorators.
|
|
7391
|
+
* @remarks Decorators are applied in reverse order of their positions in the array.
|
|
7392
|
+
* @example
|
|
7393
|
+
*
|
|
7394
|
+
* class Example { }
|
|
7395
|
+
*
|
|
7396
|
+
* // constructor
|
|
7397
|
+
* Example = Reflect.decorate(decoratorsArray, Example);
|
|
7398
|
+
*
|
|
7399
|
+
*/
|
|
7400
|
+
function decorate(decorators: ClassDecorator[], target: Function): Function;
|
|
7401
|
+
/**
|
|
7402
|
+
* Applies a set of decorators to a property of a target object.
|
|
7403
|
+
* @param decorators An array of decorators.
|
|
7404
|
+
* @param target The target object.
|
|
7405
|
+
* @param propertyKey The property key to decorate.
|
|
7406
|
+
* @param attributes A property descriptor.
|
|
7407
|
+
* @remarks Decorators are applied in reverse order.
|
|
7408
|
+
* @example
|
|
7409
|
+
*
|
|
7410
|
+
* class Example {
|
|
7411
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
7412
|
+
* // static staticProperty;
|
|
7413
|
+
* // property;
|
|
7414
|
+
*
|
|
7415
|
+
* static staticMethod() { }
|
|
7416
|
+
* method() { }
|
|
7417
|
+
* }
|
|
7418
|
+
*
|
|
7419
|
+
* // property (on constructor)
|
|
7420
|
+
* Reflect.decorate(decoratorsArray, Example, "staticProperty");
|
|
7421
|
+
*
|
|
7422
|
+
* // property (on prototype)
|
|
7423
|
+
* Reflect.decorate(decoratorsArray, Example.prototype, "property");
|
|
7424
|
+
*
|
|
7425
|
+
* // method (on constructor)
|
|
7426
|
+
* Object.defineProperty(Example, "staticMethod",
|
|
7427
|
+
* Reflect.decorate(decoratorsArray, Example, "staticMethod",
|
|
7428
|
+
* Object.getOwnPropertyDescriptor(Example, "staticMethod")));
|
|
7429
|
+
*
|
|
7430
|
+
* // method (on prototype)
|
|
7431
|
+
* Object.defineProperty(Example.prototype, "method",
|
|
7432
|
+
* Reflect.decorate(decoratorsArray, Example.prototype, "method",
|
|
7433
|
+
* Object.getOwnPropertyDescriptor(Example.prototype, "method")));
|
|
7434
|
+
*
|
|
7435
|
+
*/
|
|
7436
|
+
function decorate(decorators: (PropertyDecorator | MethodDecorator)[], target: Object, propertyKey: string | symbol, attributes?: PropertyDescriptor): PropertyDescriptor;
|
|
7437
|
+
/**
|
|
7438
|
+
* A default metadata decorator factory that can be used on a class, class member, or parameter.
|
|
7439
|
+
* @param metadataKey The key for the metadata entry.
|
|
7440
|
+
* @param metadataValue The value for the metadata entry.
|
|
7441
|
+
* @returns A decorator function.
|
|
7442
|
+
* @remarks
|
|
7443
|
+
* If `metadataKey` is already defined for the target and target key, the
|
|
7444
|
+
* metadataValue for that key will be overwritten.
|
|
7445
|
+
* @example
|
|
7446
|
+
*
|
|
7447
|
+
* // constructor
|
|
7448
|
+
* @Reflect.metadata(key, value)
|
|
7449
|
+
* class Example {
|
|
7450
|
+
* }
|
|
7451
|
+
*
|
|
7452
|
+
* // property (on constructor, TypeScript only)
|
|
7453
|
+
* class Example {
|
|
7454
|
+
* @Reflect.metadata(key, value)
|
|
7455
|
+
* static staticProperty;
|
|
7456
|
+
* }
|
|
7457
|
+
*
|
|
7458
|
+
* // property (on prototype, TypeScript only)
|
|
7459
|
+
* class Example {
|
|
7460
|
+
* @Reflect.metadata(key, value)
|
|
7461
|
+
* property;
|
|
7462
|
+
* }
|
|
7463
|
+
*
|
|
7464
|
+
* // method (on constructor)
|
|
7465
|
+
* class Example {
|
|
7466
|
+
* @Reflect.metadata(key, value)
|
|
7467
|
+
* static staticMethod() { }
|
|
7468
|
+
* }
|
|
7469
|
+
*
|
|
7470
|
+
* // method (on prototype)
|
|
7471
|
+
* class Example {
|
|
7472
|
+
* @Reflect.metadata(key, value)
|
|
7473
|
+
* method() { }
|
|
7474
|
+
* }
|
|
7475
|
+
*
|
|
7476
|
+
*/
|
|
7477
|
+
function metadata(metadataKey: any, metadataValue: any): {
|
|
7478
|
+
(target: Function): void;
|
|
7479
|
+
(target: Object, propertyKey: string | symbol): void;
|
|
7480
|
+
};
|
|
7481
|
+
/**
|
|
7482
|
+
* Define a unique metadata entry on the target.
|
|
7483
|
+
* @param metadataKey A key used to store and retrieve metadata.
|
|
7484
|
+
* @param metadataValue A value that contains attached metadata.
|
|
7485
|
+
* @param target The target object on which to define metadata.
|
|
7486
|
+
* @example
|
|
7487
|
+
*
|
|
7488
|
+
* class Example {
|
|
7489
|
+
* }
|
|
7490
|
+
*
|
|
7491
|
+
* // constructor
|
|
7492
|
+
* Reflect.defineMetadata("custom:annotation", options, Example);
|
|
7493
|
+
*
|
|
7494
|
+
* // decorator factory as metadata-producing annotation.
|
|
7495
|
+
* function MyAnnotation(options): ClassDecorator {
|
|
7496
|
+
* return target => Reflect.defineMetadata("custom:annotation", options, target);
|
|
7497
|
+
* }
|
|
7498
|
+
*
|
|
7499
|
+
*/
|
|
7500
|
+
function defineMetadata(metadataKey: any, metadataValue: any, target: Object): void;
|
|
7501
|
+
/**
|
|
7502
|
+
* Define a unique metadata entry on the target.
|
|
7503
|
+
* @param metadataKey A key used to store and retrieve metadata.
|
|
7504
|
+
* @param metadataValue A value that contains attached metadata.
|
|
7505
|
+
* @param target The target object on which to define metadata.
|
|
7506
|
+
* @param propertyKey The property key for the target.
|
|
7507
|
+
* @example
|
|
7508
|
+
*
|
|
7509
|
+
* class Example {
|
|
7510
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
7511
|
+
* // static staticProperty;
|
|
7512
|
+
* // property;
|
|
7513
|
+
*
|
|
7514
|
+
* static staticMethod(p) { }
|
|
7515
|
+
* method(p) { }
|
|
7516
|
+
* }
|
|
7517
|
+
*
|
|
7518
|
+
* // property (on constructor)
|
|
7519
|
+
* Reflect.defineMetadata("custom:annotation", Number, Example, "staticProperty");
|
|
7520
|
+
*
|
|
7521
|
+
* // property (on prototype)
|
|
7522
|
+
* Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "property");
|
|
7523
|
+
*
|
|
7524
|
+
* // method (on constructor)
|
|
7525
|
+
* Reflect.defineMetadata("custom:annotation", Number, Example, "staticMethod");
|
|
7526
|
+
*
|
|
7527
|
+
* // method (on prototype)
|
|
7528
|
+
* Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "method");
|
|
7529
|
+
*
|
|
7530
|
+
* // decorator factory as metadata-producing annotation.
|
|
7531
|
+
* function MyAnnotation(options): PropertyDecorator {
|
|
7532
|
+
* return (target, key) => Reflect.defineMetadata("custom:annotation", options, target, key);
|
|
7533
|
+
* }
|
|
7534
|
+
*
|
|
7535
|
+
*/
|
|
7536
|
+
function defineMetadata(metadataKey: any, metadataValue: any, target: Object, propertyKey: string | symbol): void;
|
|
7537
|
+
/**
|
|
7538
|
+
* Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
|
|
7539
|
+
* @param metadataKey A key used to store and retrieve metadata.
|
|
7540
|
+
* @param target The target object on which the metadata is defined.
|
|
7541
|
+
* @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
|
|
7542
|
+
* @example
|
|
7543
|
+
*
|
|
7544
|
+
* class Example {
|
|
7545
|
+
* }
|
|
7546
|
+
*
|
|
7547
|
+
* // constructor
|
|
7548
|
+
* result = Reflect.hasMetadata("custom:annotation", Example);
|
|
7549
|
+
*
|
|
7550
|
+
*/
|
|
7551
|
+
function hasMetadata(metadataKey: any, target: Object): boolean;
|
|
7552
|
+
/**
|
|
7553
|
+
* Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
|
|
7554
|
+
* @param metadataKey A key used to store and retrieve metadata.
|
|
7555
|
+
* @param target The target object on which the metadata is defined.
|
|
7556
|
+
* @param propertyKey The property key for the target.
|
|
7557
|
+
* @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
|
|
7558
|
+
* @example
|
|
7559
|
+
*
|
|
7560
|
+
* class Example {
|
|
7561
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
7562
|
+
* // static staticProperty;
|
|
7563
|
+
* // property;
|
|
7564
|
+
*
|
|
7565
|
+
* static staticMethod(p) { }
|
|
7566
|
+
* method(p) { }
|
|
7567
|
+
* }
|
|
7568
|
+
*
|
|
7569
|
+
* // property (on constructor)
|
|
7570
|
+
* result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty");
|
|
7571
|
+
*
|
|
7572
|
+
* // property (on prototype)
|
|
7573
|
+
* result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property");
|
|
7574
|
+
*
|
|
7575
|
+
* // method (on constructor)
|
|
7576
|
+
* result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod");
|
|
7577
|
+
*
|
|
7578
|
+
* // method (on prototype)
|
|
7579
|
+
* result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method");
|
|
7580
|
+
*
|
|
7581
|
+
*/
|
|
7582
|
+
function hasMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean;
|
|
7583
|
+
/**
|
|
7584
|
+
* Gets a value indicating whether the target object has the provided metadata key defined.
|
|
7585
|
+
* @param metadataKey A key used to store and retrieve metadata.
|
|
7586
|
+
* @param target The target object on which the metadata is defined.
|
|
7587
|
+
* @returns `true` if the metadata key was defined on the target object; otherwise, `false`.
|
|
7588
|
+
* @example
|
|
7589
|
+
*
|
|
7590
|
+
* class Example {
|
|
7591
|
+
* }
|
|
7592
|
+
*
|
|
7593
|
+
* // constructor
|
|
7594
|
+
* result = Reflect.hasOwnMetadata("custom:annotation", Example);
|
|
7595
|
+
*
|
|
7596
|
+
*/
|
|
7597
|
+
function hasOwnMetadata(metadataKey: any, target: Object): boolean;
|
|
7598
|
+
/**
|
|
7599
|
+
* Gets a value indicating whether the target object has the provided metadata key defined.
|
|
7600
|
+
* @param metadataKey A key used to store and retrieve metadata.
|
|
7601
|
+
* @param target The target object on which the metadata is defined.
|
|
7602
|
+
* @param propertyKey The property key for the target.
|
|
7603
|
+
* @returns `true` if the metadata key was defined on the target object; otherwise, `false`.
|
|
7604
|
+
* @example
|
|
7605
|
+
*
|
|
7606
|
+
* class Example {
|
|
7607
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
7608
|
+
* // static staticProperty;
|
|
7609
|
+
* // property;
|
|
7610
|
+
*
|
|
7611
|
+
* static staticMethod(p) { }
|
|
7612
|
+
* method(p) { }
|
|
7613
|
+
* }
|
|
7614
|
+
*
|
|
7615
|
+
* // property (on constructor)
|
|
7616
|
+
* result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty");
|
|
7617
|
+
*
|
|
7618
|
+
* // property (on prototype)
|
|
7619
|
+
* result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property");
|
|
7620
|
+
*
|
|
7621
|
+
* // method (on constructor)
|
|
7622
|
+
* result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod");
|
|
7623
|
+
*
|
|
7624
|
+
* // method (on prototype)
|
|
7625
|
+
* result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method");
|
|
7626
|
+
*
|
|
7627
|
+
*/
|
|
7628
|
+
function hasOwnMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean;
|
|
7629
|
+
/**
|
|
7630
|
+
* Gets the metadata value for the provided metadata key on the target object or its prototype chain.
|
|
7631
|
+
* @param metadataKey A key used to store and retrieve metadata.
|
|
7632
|
+
* @param target The target object on which the metadata is defined.
|
|
7633
|
+
* @returns The metadata value for the metadata key if found; otherwise, `undefined`.
|
|
7634
|
+
* @example
|
|
7635
|
+
*
|
|
7636
|
+
* class Example {
|
|
7637
|
+
* }
|
|
7638
|
+
*
|
|
7639
|
+
* // constructor
|
|
7640
|
+
* result = Reflect.getMetadata("custom:annotation", Example);
|
|
7641
|
+
*
|
|
7642
|
+
*/
|
|
7643
|
+
function getMetadata(metadataKey: any, target: Object): any;
|
|
7644
|
+
/**
|
|
7645
|
+
* Gets the metadata value for the provided metadata key on the target object or its prototype chain.
|
|
7646
|
+
* @param metadataKey A key used to store and retrieve metadata.
|
|
7647
|
+
* @param target The target object on which the metadata is defined.
|
|
7648
|
+
* @param propertyKey The property key for the target.
|
|
7649
|
+
* @returns The metadata value for the metadata key if found; otherwise, `undefined`.
|
|
7650
|
+
* @example
|
|
7651
|
+
*
|
|
7652
|
+
* class Example {
|
|
7653
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
7654
|
+
* // static staticProperty;
|
|
7655
|
+
* // property;
|
|
7656
|
+
*
|
|
7657
|
+
* static staticMethod(p) { }
|
|
7658
|
+
* method(p) { }
|
|
7659
|
+
* }
|
|
7660
|
+
*
|
|
7661
|
+
* // property (on constructor)
|
|
7662
|
+
* result = Reflect.getMetadata("custom:annotation", Example, "staticProperty");
|
|
7663
|
+
*
|
|
7664
|
+
* // property (on prototype)
|
|
7665
|
+
* result = Reflect.getMetadata("custom:annotation", Example.prototype, "property");
|
|
7666
|
+
*
|
|
7667
|
+
* // method (on constructor)
|
|
7668
|
+
* result = Reflect.getMetadata("custom:annotation", Example, "staticMethod");
|
|
7669
|
+
*
|
|
7670
|
+
* // method (on prototype)
|
|
7671
|
+
* result = Reflect.getMetadata("custom:annotation", Example.prototype, "method");
|
|
7672
|
+
*
|
|
7673
|
+
*/
|
|
7674
|
+
function getMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): any;
|
|
7675
|
+
/**
|
|
7676
|
+
* Gets the metadata value for the provided metadata key on the target object.
|
|
7677
|
+
* @param metadataKey A key used to store and retrieve metadata.
|
|
7678
|
+
* @param target The target object on which the metadata is defined.
|
|
7679
|
+
* @returns The metadata value for the metadata key if found; otherwise, `undefined`.
|
|
7680
|
+
* @example
|
|
7681
|
+
*
|
|
7682
|
+
* class Example {
|
|
7683
|
+
* }
|
|
7684
|
+
*
|
|
7685
|
+
* // constructor
|
|
7686
|
+
* result = Reflect.getOwnMetadata("custom:annotation", Example);
|
|
7687
|
+
*
|
|
7688
|
+
*/
|
|
7689
|
+
function getOwnMetadata(metadataKey: any, target: Object): any;
|
|
7690
|
+
/**
|
|
7691
|
+
* Gets the metadata value for the provided metadata key on the target object.
|
|
7692
|
+
* @param metadataKey A key used to store and retrieve metadata.
|
|
7693
|
+
* @param target The target object on which the metadata is defined.
|
|
7694
|
+
* @param propertyKey The property key for the target.
|
|
7695
|
+
* @returns The metadata value for the metadata key if found; otherwise, `undefined`.
|
|
7696
|
+
* @example
|
|
7697
|
+
*
|
|
7698
|
+
* class Example {
|
|
7699
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
7700
|
+
* // static staticProperty;
|
|
7701
|
+
* // property;
|
|
7702
|
+
*
|
|
7703
|
+
* static staticMethod(p) { }
|
|
7704
|
+
* method(p) { }
|
|
7705
|
+
* }
|
|
7706
|
+
*
|
|
7707
|
+
* // property (on constructor)
|
|
7708
|
+
* result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty");
|
|
7709
|
+
*
|
|
7710
|
+
* // property (on prototype)
|
|
7711
|
+
* result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property");
|
|
7712
|
+
*
|
|
7713
|
+
* // method (on constructor)
|
|
7714
|
+
* result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod");
|
|
7715
|
+
*
|
|
7716
|
+
* // method (on prototype)
|
|
7717
|
+
* result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method");
|
|
7718
|
+
*
|
|
7719
|
+
*/
|
|
7720
|
+
function getOwnMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): any;
|
|
7721
|
+
/**
|
|
7722
|
+
* Gets the metadata keys defined on the target object or its prototype chain.
|
|
7723
|
+
* @param target The target object on which the metadata is defined.
|
|
7724
|
+
* @returns An array of unique metadata keys.
|
|
7725
|
+
* @example
|
|
7726
|
+
*
|
|
7727
|
+
* class Example {
|
|
7728
|
+
* }
|
|
7729
|
+
*
|
|
7730
|
+
* // constructor
|
|
7731
|
+
* result = Reflect.getMetadataKeys(Example);
|
|
7732
|
+
*
|
|
7733
|
+
*/
|
|
7734
|
+
function getMetadataKeys(target: Object): any[];
|
|
7735
|
+
/**
|
|
7736
|
+
* Gets the metadata keys defined on the target object or its prototype chain.
|
|
7737
|
+
* @param target The target object on which the metadata is defined.
|
|
7738
|
+
* @param propertyKey The property key for the target.
|
|
7739
|
+
* @returns An array of unique metadata keys.
|
|
7740
|
+
* @example
|
|
7741
|
+
*
|
|
7742
|
+
* class Example {
|
|
7743
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
7744
|
+
* // static staticProperty;
|
|
7745
|
+
* // property;
|
|
7746
|
+
*
|
|
7747
|
+
* static staticMethod(p) { }
|
|
7748
|
+
* method(p) { }
|
|
7749
|
+
* }
|
|
7750
|
+
*
|
|
7751
|
+
* // property (on constructor)
|
|
7752
|
+
* result = Reflect.getMetadataKeys(Example, "staticProperty");
|
|
7753
|
+
*
|
|
7754
|
+
* // property (on prototype)
|
|
7755
|
+
* result = Reflect.getMetadataKeys(Example.prototype, "property");
|
|
7756
|
+
*
|
|
7757
|
+
* // method (on constructor)
|
|
7758
|
+
* result = Reflect.getMetadataKeys(Example, "staticMethod");
|
|
7759
|
+
*
|
|
7760
|
+
* // method (on prototype)
|
|
7761
|
+
* result = Reflect.getMetadataKeys(Example.prototype, "method");
|
|
7762
|
+
*
|
|
7763
|
+
*/
|
|
7764
|
+
function getMetadataKeys(target: Object, propertyKey: string | symbol): any[];
|
|
7765
|
+
/**
|
|
7766
|
+
* Gets the unique metadata keys defined on the target object.
|
|
7767
|
+
* @param target The target object on which the metadata is defined.
|
|
7768
|
+
* @returns An array of unique metadata keys.
|
|
7769
|
+
* @example
|
|
7770
|
+
*
|
|
7771
|
+
* class Example {
|
|
7772
|
+
* }
|
|
7773
|
+
*
|
|
7774
|
+
* // constructor
|
|
7775
|
+
* result = Reflect.getOwnMetadataKeys(Example);
|
|
7776
|
+
*
|
|
7777
|
+
*/
|
|
7778
|
+
function getOwnMetadataKeys(target: Object): any[];
|
|
7779
|
+
/**
|
|
7780
|
+
* Gets the unique metadata keys defined on the target object.
|
|
7781
|
+
* @param target The target object on which the metadata is defined.
|
|
7782
|
+
* @param propertyKey The property key for the target.
|
|
7783
|
+
* @returns An array of unique metadata keys.
|
|
7784
|
+
* @example
|
|
7785
|
+
*
|
|
7786
|
+
* class Example {
|
|
7787
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
7788
|
+
* // static staticProperty;
|
|
7789
|
+
* // property;
|
|
7790
|
+
*
|
|
7791
|
+
* static staticMethod(p) { }
|
|
7792
|
+
* method(p) { }
|
|
7793
|
+
* }
|
|
7794
|
+
*
|
|
7795
|
+
* // property (on constructor)
|
|
7796
|
+
* result = Reflect.getOwnMetadataKeys(Example, "staticProperty");
|
|
7797
|
+
*
|
|
7798
|
+
* // property (on prototype)
|
|
7799
|
+
* result = Reflect.getOwnMetadataKeys(Example.prototype, "property");
|
|
7800
|
+
*
|
|
7801
|
+
* // method (on constructor)
|
|
7802
|
+
* result = Reflect.getOwnMetadataKeys(Example, "staticMethod");
|
|
7803
|
+
*
|
|
7804
|
+
* // method (on prototype)
|
|
7805
|
+
* result = Reflect.getOwnMetadataKeys(Example.prototype, "method");
|
|
7806
|
+
*
|
|
7807
|
+
*/
|
|
7808
|
+
function getOwnMetadataKeys(target: Object, propertyKey: string | symbol): any[];
|
|
7809
|
+
/**
|
|
7810
|
+
* Deletes the metadata entry from the target object with the provided key.
|
|
7811
|
+
* @param metadataKey A key used to store and retrieve metadata.
|
|
7812
|
+
* @param target The target object on which the metadata is defined.
|
|
7813
|
+
* @returns `true` if the metadata entry was found and deleted; otherwise, false.
|
|
7814
|
+
* @example
|
|
7815
|
+
*
|
|
7816
|
+
* class Example {
|
|
7817
|
+
* }
|
|
7818
|
+
*
|
|
7819
|
+
* // constructor
|
|
7820
|
+
* result = Reflect.deleteMetadata("custom:annotation", Example);
|
|
7821
|
+
*
|
|
7822
|
+
*/
|
|
7823
|
+
function deleteMetadata(metadataKey: any, target: Object): boolean;
|
|
7824
|
+
/**
|
|
7825
|
+
* Deletes the metadata entry from the target object with the provided key.
|
|
7826
|
+
* @param metadataKey A key used to store and retrieve metadata.
|
|
7827
|
+
* @param target The target object on which the metadata is defined.
|
|
7828
|
+
* @param propertyKey The property key for the target.
|
|
7829
|
+
* @returns `true` if the metadata entry was found and deleted; otherwise, false.
|
|
7830
|
+
* @example
|
|
7831
|
+
*
|
|
7832
|
+
* class Example {
|
|
7833
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
7834
|
+
* // static staticProperty;
|
|
7835
|
+
* // property;
|
|
7836
|
+
*
|
|
7837
|
+
* static staticMethod(p) { }
|
|
7838
|
+
* method(p) { }
|
|
7839
|
+
* }
|
|
7840
|
+
*
|
|
7841
|
+
* // property (on constructor)
|
|
7842
|
+
* result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty");
|
|
7843
|
+
*
|
|
7844
|
+
* // property (on prototype)
|
|
7845
|
+
* result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property");
|
|
7846
|
+
*
|
|
7847
|
+
* // method (on constructor)
|
|
7848
|
+
* result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod");
|
|
7849
|
+
*
|
|
7850
|
+
* // method (on prototype)
|
|
7851
|
+
* result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method");
|
|
7852
|
+
*
|
|
7853
|
+
*/
|
|
7854
|
+
function deleteMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean;
|
|
7855
|
+
}
|
|
7856
|
+
}
|
|
7857
|
+
|
|
7858
|
+
type PropertyType = 'number' | 'integer' | 'string' | 'boolean' | 'color' | 'vector2' | 'vector3' | 'enum' | 'asset' | 'animationClips';
|
|
7859
|
+
/**
|
|
7860
|
+
* Action button configuration for property fields
|
|
7861
|
+
* 属性字段的操作按钮配置
|
|
7862
|
+
*/
|
|
7863
|
+
interface PropertyAction {
|
|
7864
|
+
/** Action identifier | 操作标识符 */
|
|
7865
|
+
id: string;
|
|
7866
|
+
/** Button label | 按钮标签 */
|
|
7867
|
+
label: string;
|
|
7868
|
+
/** Button tooltip | 按钮提示 */
|
|
7869
|
+
tooltip?: string;
|
|
7870
|
+
/** Icon name from Lucide | Lucide图标名称 */
|
|
7871
|
+
icon?: string;
|
|
7872
|
+
}
|
|
7873
|
+
/**
|
|
7874
|
+
* 控制关系声明
|
|
7875
|
+
* Control relationship declaration
|
|
7876
|
+
*/
|
|
7877
|
+
interface PropertyControl {
|
|
7878
|
+
/** 被控制的组件名称 | Target component name */
|
|
7879
|
+
component: string;
|
|
7880
|
+
/** 被控制的属性名称 | Target property name */
|
|
7881
|
+
property: string;
|
|
7882
|
+
}
|
|
7883
|
+
interface PropertyOptions {
|
|
7884
|
+
/** 属性类型 */
|
|
7885
|
+
type: PropertyType;
|
|
7886
|
+
/** 显示标签 */
|
|
7887
|
+
label?: string;
|
|
7888
|
+
/** 最小值 (number/integer) */
|
|
7889
|
+
min?: number;
|
|
7890
|
+
/** 最大值 (number/integer) */
|
|
7891
|
+
max?: number;
|
|
7892
|
+
/** 步进值 (number/integer) */
|
|
7893
|
+
step?: number;
|
|
7894
|
+
/** 枚举选项 (enum) */
|
|
7895
|
+
options?: Array<{
|
|
7896
|
+
label: string;
|
|
7897
|
+
value: any;
|
|
7898
|
+
}>;
|
|
7899
|
+
/** 是否只读 */
|
|
7900
|
+
readOnly?: boolean;
|
|
7901
|
+
/** 资源文件扩展名 (asset) */
|
|
7902
|
+
fileExtension?: string;
|
|
7903
|
+
/** Action buttons for this property | 属性的操作按钮 */
|
|
7904
|
+
actions?: PropertyAction[];
|
|
7905
|
+
/** 此属性控制的其他组件属性 | Properties this field controls */
|
|
7906
|
+
controls?: PropertyControl[];
|
|
7907
|
+
}
|
|
7908
|
+
declare const PROPERTY_METADATA: unique symbol;
|
|
7909
|
+
/**
|
|
7910
|
+
* 属性装饰器 - 声明组件属性的编辑器元数据
|
|
7911
|
+
*
|
|
7912
|
+
* @example
|
|
7913
|
+
* ```typescript
|
|
7914
|
+
* @ECSComponent('Transform')
|
|
7915
|
+
* export class TransformComponent extends Component {
|
|
7916
|
+
* @Property({ type: 'vector3', label: 'Position' })
|
|
7917
|
+
* public position: Vector3 = { x: 0, y: 0, z: 0 };
|
|
7918
|
+
*
|
|
7919
|
+
* @Property({ type: 'number', label: 'Speed', min: 0, max: 100 })
|
|
7920
|
+
* public speed: number = 10;
|
|
7921
|
+
* }
|
|
7922
|
+
* ```
|
|
7923
|
+
*/
|
|
7924
|
+
declare function Property(options: PropertyOptions): PropertyDecorator;
|
|
7925
|
+
/**
|
|
7926
|
+
* 获取组件类的所有属性元数据
|
|
7927
|
+
*/
|
|
7928
|
+
declare function getPropertyMetadata(target: Function): Record<string, PropertyOptions> | undefined;
|
|
7929
|
+
/**
|
|
7930
|
+
* 检查组件类是否有属性元数据
|
|
7931
|
+
*/
|
|
7932
|
+
declare function hasPropertyMetadata(target: Function): boolean;
|
|
7933
|
+
|
|
7368
7934
|
/**
|
|
7369
7935
|
* 实体构建器 - 提供流式API创建和配置实体
|
|
7370
7936
|
*/
|
|
@@ -8005,15 +8571,15 @@ declare class World {
|
|
|
8005
8571
|
/**
|
|
8006
8572
|
* 创建并添加Scene到World
|
|
8007
8573
|
*/
|
|
8008
|
-
createScene<T extends IScene>(
|
|
8574
|
+
createScene<T extends IScene>(sceneName: string, sceneInstance?: T): T;
|
|
8009
8575
|
/**
|
|
8010
8576
|
* 移除Scene
|
|
8011
8577
|
*/
|
|
8012
|
-
removeScene(
|
|
8578
|
+
removeScene(sceneName: string): boolean;
|
|
8013
8579
|
/**
|
|
8014
8580
|
* 获取Scene
|
|
8015
8581
|
*/
|
|
8016
|
-
getScene<T extends IScene>(
|
|
8582
|
+
getScene<T extends IScene>(sceneName: string): T | null;
|
|
8017
8583
|
/**
|
|
8018
8584
|
* 获取所有Scene ID
|
|
8019
8585
|
*/
|
|
@@ -8029,11 +8595,11 @@ declare class World {
|
|
|
8029
8595
|
/**
|
|
8030
8596
|
* 设置Scene激活状态
|
|
8031
8597
|
*/
|
|
8032
|
-
setSceneActive(
|
|
8598
|
+
setSceneActive(sceneName: string, active: boolean): void;
|
|
8033
8599
|
/**
|
|
8034
8600
|
* 检查Scene是否激活
|
|
8035
8601
|
*/
|
|
8036
|
-
isSceneActive(
|
|
8602
|
+
isSceneActive(sceneName: string): boolean;
|
|
8037
8603
|
/**
|
|
8038
8604
|
* 获取活跃Scene数量
|
|
8039
8605
|
*/
|
|
@@ -8204,15 +8770,15 @@ declare class WorldManager implements IService {
|
|
|
8204
8770
|
/**
|
|
8205
8771
|
* 创建新World
|
|
8206
8772
|
*/
|
|
8207
|
-
createWorld(
|
|
8773
|
+
createWorld(worldName: string, config?: IWorldConfig): World;
|
|
8208
8774
|
/**
|
|
8209
8775
|
* 移除World
|
|
8210
8776
|
*/
|
|
8211
|
-
removeWorld(
|
|
8777
|
+
removeWorld(worldName: string): boolean;
|
|
8212
8778
|
/**
|
|
8213
8779
|
* 获取World
|
|
8214
8780
|
*/
|
|
8215
|
-
getWorld(
|
|
8781
|
+
getWorld(worldName: string): World | null;
|
|
8216
8782
|
/**
|
|
8217
8783
|
* 获取所有World ID
|
|
8218
8784
|
*/
|
|
@@ -8224,11 +8790,11 @@ declare class WorldManager implements IService {
|
|
|
8224
8790
|
/**
|
|
8225
8791
|
* 设置World激活状态
|
|
8226
8792
|
*/
|
|
8227
|
-
setWorldActive(
|
|
8793
|
+
setWorldActive(worldName: string, active: boolean): void;
|
|
8228
8794
|
/**
|
|
8229
8795
|
* 检查World是否激活
|
|
8230
8796
|
*/
|
|
8231
|
-
isWorldActive(
|
|
8797
|
+
isWorldActive(worldName: string): boolean;
|
|
8232
8798
|
/**
|
|
8233
8799
|
* 更新所有活跃的World
|
|
8234
8800
|
*
|
|
@@ -9551,20 +10117,6 @@ declare class WebSocketManager {
|
|
|
9551
10117
|
private handleConnectionFailure;
|
|
9552
10118
|
}
|
|
9553
10119
|
|
|
9554
|
-
/**
|
|
9555
|
-
* 调试配置服务
|
|
9556
|
-
*
|
|
9557
|
-
* 管理调试系统的配置信息
|
|
9558
|
-
*/
|
|
9559
|
-
declare class DebugConfigService implements IService {
|
|
9560
|
-
private _config;
|
|
9561
|
-
constructor();
|
|
9562
|
-
setConfig(config: IECSDebugConfig): void;
|
|
9563
|
-
getConfig(): IECSDebugConfig;
|
|
9564
|
-
isEnabled(): boolean;
|
|
9565
|
-
dispose(): void;
|
|
9566
|
-
}
|
|
9567
|
-
|
|
9568
10120
|
/**
|
|
9569
10121
|
* 调试管理器
|
|
9570
10122
|
*
|
|
@@ -9580,12 +10132,13 @@ declare class DebugManager implements IService, IUpdatable {
|
|
|
9580
10132
|
private sceneCollector;
|
|
9581
10133
|
private sceneManager;
|
|
9582
10134
|
private performanceMonitor;
|
|
10135
|
+
private configService;
|
|
9583
10136
|
private frameCounter;
|
|
9584
10137
|
private lastSendTime;
|
|
9585
10138
|
private sendInterval;
|
|
9586
10139
|
private isRunning;
|
|
9587
10140
|
private originalConsole;
|
|
9588
|
-
|
|
10141
|
+
onInitialize(): void;
|
|
9589
10142
|
/**
|
|
9590
10143
|
* 启动调试管理器
|
|
9591
10144
|
*/
|
|
@@ -9683,6 +10236,20 @@ declare class DebugManager implements IService, IUpdatable {
|
|
|
9683
10236
|
dispose(): void;
|
|
9684
10237
|
}
|
|
9685
10238
|
|
|
10239
|
+
/**
|
|
10240
|
+
* 调试配置服务
|
|
10241
|
+
*
|
|
10242
|
+
* 管理调试系统的配置信息
|
|
10243
|
+
*/
|
|
10244
|
+
declare class DebugConfigService implements IService {
|
|
10245
|
+
private _config;
|
|
10246
|
+
constructor();
|
|
10247
|
+
setConfig(config: IECSDebugConfig): void;
|
|
10248
|
+
getConfig(): IECSDebugConfig;
|
|
10249
|
+
isEnabled(): boolean;
|
|
10250
|
+
dispose(): void;
|
|
10251
|
+
}
|
|
10252
|
+
|
|
9686
10253
|
/**
|
|
9687
10254
|
* 插件状态
|
|
9688
10255
|
*/
|
|
@@ -10434,7 +11001,7 @@ declare class DebugPlugin implements IPlugin, IService {
|
|
|
10434
11001
|
* @param filter - 查询过滤器
|
|
10435
11002
|
*/
|
|
10436
11003
|
queryEntities(filter: {
|
|
10437
|
-
|
|
11004
|
+
sceneName?: string;
|
|
10438
11005
|
tag?: number;
|
|
10439
11006
|
name?: string;
|
|
10440
11007
|
hasComponent?: string;
|
|
@@ -10452,7 +11019,7 @@ declare class DebugPlugin implements IPlugin, IService {
|
|
|
10452
11019
|
/**
|
|
10453
11020
|
* 依赖注入装饰器
|
|
10454
11021
|
*
|
|
10455
|
-
* 提供 @Injectable、@
|
|
11022
|
+
* 提供 @Injectable、@InjectProperty 和 @Updatable 装饰器,用于标记可注入的类和依赖注入点
|
|
10456
11023
|
*/
|
|
10457
11024
|
|
|
10458
11025
|
/**
|
|
@@ -10505,10 +11072,11 @@ interface UpdatableMetadata {
|
|
|
10505
11072
|
*
|
|
10506
11073
|
* @Injectable()
|
|
10507
11074
|
* class PhysicsSystem extends EntitySystem {
|
|
10508
|
-
*
|
|
10509
|
-
*
|
|
10510
|
-
*
|
|
10511
|
-
*
|
|
11075
|
+
* @InjectProperty(TimeService)
|
|
11076
|
+
* private timeService!: TimeService;
|
|
11077
|
+
*
|
|
11078
|
+
* constructor() {
|
|
11079
|
+
* super(Matcher.empty());
|
|
10512
11080
|
* }
|
|
10513
11081
|
* }
|
|
10514
11082
|
* ```
|
|
@@ -10545,13 +11113,43 @@ declare function Injectable(): ClassDecorator;
|
|
|
10545
11113
|
*/
|
|
10546
11114
|
declare function Updatable(priority?: number): ClassDecorator;
|
|
10547
11115
|
/**
|
|
10548
|
-
* @
|
|
11116
|
+
* @InjectProperty() 装饰器
|
|
11117
|
+
*
|
|
11118
|
+
* 通过属性装饰器注入依赖
|
|
11119
|
+
*
|
|
11120
|
+
* 注入时机:在构造函数执行后、onInitialize() 调用前完成
|
|
11121
|
+
*
|
|
11122
|
+
* @param serviceType 服务类型
|
|
11123
|
+
*
|
|
11124
|
+
* @example
|
|
11125
|
+
* ```typescript
|
|
11126
|
+
* @Injectable()
|
|
11127
|
+
* class PhysicsSystem extends EntitySystem {
|
|
11128
|
+
* @InjectProperty(TimeService)
|
|
11129
|
+
* private timeService!: TimeService;
|
|
10549
11130
|
*
|
|
10550
|
-
*
|
|
11131
|
+
* @InjectProperty(CollisionService)
|
|
11132
|
+
* private collision!: CollisionService;
|
|
10551
11133
|
*
|
|
10552
|
-
*
|
|
11134
|
+
* constructor() {
|
|
11135
|
+
* super(Matcher.empty());
|
|
11136
|
+
* }
|
|
11137
|
+
*
|
|
11138
|
+
* public onInitialize(): void {
|
|
11139
|
+
* // 此时属性已注入完成,可以安全使用
|
|
11140
|
+
* console.log(this.timeService.getDeltaTime());
|
|
11141
|
+
* }
|
|
11142
|
+
* }
|
|
11143
|
+
* ```
|
|
11144
|
+
*/
|
|
11145
|
+
declare function InjectProperty(serviceType: ServiceType<IService>): PropertyDecorator;
|
|
11146
|
+
/**
|
|
11147
|
+
* 获取属性注入元数据
|
|
11148
|
+
*
|
|
11149
|
+
* @param target 目标类
|
|
11150
|
+
* @returns 属性名到服务类型的映射
|
|
10553
11151
|
*/
|
|
10554
|
-
declare function
|
|
11152
|
+
declare function getPropertyInjectMetadata(target: Constructor): Map<string | symbol, ServiceType<IService>>;
|
|
10555
11153
|
/**
|
|
10556
11154
|
* 创建实例并自动注入依赖
|
|
10557
11155
|
*
|
|
@@ -10565,6 +11163,13 @@ declare function Inject(serviceType: ServiceType<IService> | string | symbol): P
|
|
|
10565
11163
|
* ```
|
|
10566
11164
|
*/
|
|
10567
11165
|
declare function createInstance<T>(constructor: new (...args: any[]) => T, container: ServiceContainer): T;
|
|
11166
|
+
/**
|
|
11167
|
+
* 为实例注入属性依赖
|
|
11168
|
+
*
|
|
11169
|
+
* @param instance 目标实例
|
|
11170
|
+
* @param container 服务容器
|
|
11171
|
+
*/
|
|
11172
|
+
declare function injectProperties<T extends object>(instance: T, container: ServiceContainer): void;
|
|
10568
11173
|
/**
|
|
10569
11174
|
* 检查类是否标记为可更新
|
|
10570
11175
|
*
|
|
@@ -11253,5 +11858,5 @@ declare function getFullPlatformConfig(): Promise<any>;
|
|
|
11253
11858
|
declare function supportsFeature(feature: 'worker' | 'shared-array-buffer' | 'transferable-objects' | 'module-worker'): boolean;
|
|
11254
11859
|
declare function hasAdapter(): boolean;
|
|
11255
11860
|
|
|
11256
|
-
export {
|
|
11257
|
-
export type { AnyComponentConstructor, BitMask64Data, ComponentChange, ComponentConstructor, ComponentDebugInfo, ComponentInstance, ComponentMigrationFunction, ComponentType$1 as ComponentType, ComponentTypeMap, ComponentTypeName, ComponentTypeNames, DataOnly, DeepPartial, DeepReadonly, DeserializationStrategy, ECSDebugStats, EntityChange, EntityDebugInfo, EntityRefMetadata, EntityRefRecord, EntityWithComponents, EventListenerConfig, EventStats, ExtractComponents, FieldSerializeOptions, IComponent, IComponentDebugData, IComponentEventData, ICoreConfig, IECSDebugConfig, IECSDebugData, IEntityDebugData, IEntityEventData, IEntityHierarchyNode, IEventBus, IEventData, IEventListenerConfig, IEventStats, ILogger, IPerformanceDebugData, IPerformanceEventData, IPlatformAdapter, IPlugin, IPluginMetadata, IPoolable, IScene, ISceneConfig, ISceneDebugData, ISceneEventData, ISceneFactory, IService, ISystemBase, ISystemDebugData, ISystemEventData, ITimer, IUpdatable, IWorldConfig, IWorldManagerConfig, IncrementalSerializationFormat, IncrementalSerializationOptions, IncrementalSnapshot, InjectableMetadata, LoggerColorConfig, LoggerConfig, MigrationFunction, PartialComponent, PerformanceData, PerformanceStats, PerformanceThresholds, PerformanceWarning, PlatformConfig, PlatformDetectionResult, PlatformWorker, PoolStats, QueryResult$1 as QueryResult, ReactiveQueryChange, ReactiveQueryConfig, ReactiveQueryListener, ReadonlyComponent, SceneDataChange, SceneDebugInfo, SceneDeserializationOptions, SceneMigrationFunction, SceneSerializationOptions, SerializableComponent, SerializableFields, SerializableOptions, SerializationFormat, SerializationMetadata, SerializedComponent, SerializedEntity, SerializedScene, ServiceType, SharedArrayBufferProcessFunction, SupportedTypedArray, SystemDebugInfo, SystemEntityType, SystemLifecycleHooks, SystemMetadata, TypeSafeBuilder, TypedEventHandler, TypedQueryCondition, UpdatableMetadata, ValidComponent, ValidComponentArray, WorkerCreationOptions, WorkerProcessFunction, WorkerSystemConfig };
|
|
11861
|
+
export { BinarySerializer, BitMask64Utils, Bits, COMPONENT_DEPENDENCIES, COMPONENT_TYPE_NAME, ChangeOperation, Colors, Component, ComponentDataCollector, ComponentPool, ComponentPoolManager, ComponentRegistry, ComponentSerializer, ComponentSparseSet, ComponentStorage, ConsoleLogger, Core, DebugConfigService, DebugManager, DebugPlugin, DeepCopy, ECSComponent, ECSEventType, ECSFluentAPI, ECSSystem, ENTITY_REF_METADATA, EVENT_TYPES, Emitter, EnableSoA, Entity, EntityDataCollector, EntityList, EntityProcessorList, EntityRef, EntitySerializer, EntitySystem, EventBus, EventPriority, EventTypeValidator, Float32, Float64, FuncPack, GlobalEventBus, GlobalManager, IdentifierPool, IgnoreSerialization, IncrementalSerializer, InjectProperty, Injectable, Int16, Int32, Int8, IntervalSystem, LogLevel, Logger, LoggerManager, Matcher, MigrationBuilder, NumberExtension, PROPERTY_METADATA, PassiveSystem, PerformanceDataCollector, PerformanceMonitor, PerformanceWarningType, PlatformDetector, PlatformManager, PluginManager, PluginState, Pool, PoolManager, ProcessingSystem, Property, QuerySystem, ReactiveQuery, ReactiveQueryChangeType, ReferenceTracker, SERIALIZABLE_METADATA, SERIALIZE_FIELD, SERIALIZE_OPTIONS, SYSTEM_TYPE_NAME, Scene, SceneDataCollector, SceneManager, SceneSerializer, Serializable, Serialize, SerializeArray, SerializeAsMap, SerializeAsSet, SerializeMap, SerializeSet, ServiceContainer, ServiceLifetime, SoAStorage, SparseSet, SystemDataCollector, Time, Timer, TimerManager, TypeSafeEventSystem, TypeUtils, TypedEntityBuilder, TypedQueryBuilder, TypedQueryResult, Uint16, Uint32, Uint8, Uint8Clamped, Updatable, VersionMigrationManager, WebSocketManager, WorkerEntitySystem, World, WorldManager, addAndConfigure, buildEntity, createECSAPI, createInstance, createLogger, createQuery, getBasicWorkerConfig, getComponentDependencies, getComponentInstanceTypeName, getComponentTypeName, getComponents, getCurrentAdapter, getEntityRefMetadata, getFullPlatformConfig, getOrAddComponent, getPropertyInjectMetadata, getPropertyMetadata, getSceneByEntityId, getSerializationMetadata, getSystemInstanceTypeName, getSystemMetadata, getSystemTypeName, getUpdatableMetadata, hasAdapter, hasAnyComponent, hasComponents, hasEntityRef, hasPropertyMetadata, injectProperties, isComponentArray, isComponentType, isSerializable, isUpdatable, queryFor, queryForAll, registerInjectable, registerPlatformAdapter, requireComponent, resetLoggerColors, setGlobalLogLevel, setLoggerColors, setLoggerFactory, supportsFeature, tryGetComponent, updateComponent };
|
|
11862
|
+
export type { AnyComponentConstructor, BitMask64Data, ComponentChange, ComponentConstructor, ComponentDebugInfo, ComponentInstance, ComponentMigrationFunction, ComponentOptions, ComponentType$1 as ComponentType, ComponentTypeMap, ComponentTypeName, ComponentTypeNames, DataOnly, DeepPartial, DeepReadonly, DeserializationStrategy, ECSDebugStats, EntityChange, EntityDebugInfo, EntityRefMetadata, EntityRefRecord, EntityWithComponents, EventListenerConfig, EventStats, ExtractComponents, FieldSerializeOptions, IComponent, IComponentDebugData, IComponentEventData, ICoreConfig, IECSDebugConfig, IECSDebugData, IEntityDebugData, IEntityEventData, IEntityHierarchyNode, IEventBus, IEventData, IEventListenerConfig, IEventStats, ILogger, IPerformanceDebugData, IPerformanceEventData, IPlatformAdapter, IPlugin, IPluginMetadata, IPoolable, IScene, ISceneConfig, ISceneDebugData, ISceneEventData, ISceneFactory, IService, ISystemBase, ISystemDebugData, ISystemEventData, ITimer, IUpdatable, IWorldConfig, IWorldManagerConfig, IncrementalSerializationFormat, IncrementalSerializationOptions, IncrementalSnapshot, InjectableMetadata, LoggerColorConfig, LoggerConfig, MigrationFunction, PartialComponent, PerformanceData, PerformanceStats, PerformanceThresholds, PerformanceWarning, PlatformConfig, PlatformDetectionResult, PlatformWorker, PoolStats, PropertyControl, PropertyOptions, PropertyType, QueryResult$1 as QueryResult, ReactiveQueryChange, ReactiveQueryConfig, ReactiveQueryListener, ReadonlyComponent, SceneDataChange, SceneDebugInfo, SceneDeserializationOptions, SceneMigrationFunction, SceneSerializationOptions, SerializableComponent, SerializableFields, SerializableOptions, SerializationFormat, SerializationMetadata, SerializedComponent, SerializedEntity, SerializedScene, ServiceType, SharedArrayBufferProcessFunction, SupportedTypedArray, SystemDebugInfo, SystemEntityType, SystemLifecycleHooks, SystemMetadata, TypeSafeBuilder, TypedEventHandler, TypedQueryCondition, UpdatableMetadata, ValidComponent, ValidComponentArray, WorkerCreationOptions, WorkerProcessFunction, WorkerSystemConfig };
|