@esengine/blueprint 4.0.1 → 4.2.0
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/dist/index.d.ts +435 -82
- package/dist/index.js +2827 -602
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Entity, IScene } from '@esengine/ecs-framework';
|
|
1
|
+
import { Entity, IScene, Component, EntitySystem } from '@esengine/ecs-framework';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Blueprint Pin Types
|
|
@@ -218,10 +218,10 @@ interface BlueprintAsset {
|
|
|
218
218
|
connections: BlueprintConnection[];
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
221
|
-
* Creates an empty blueprint asset
|
|
222
|
-
*
|
|
221
|
+
* Creates an empty blueprint asset with default Event Begin Play node
|
|
222
|
+
* 创建带有默认 Event Begin Play 节点的空蓝图资产
|
|
223
223
|
*/
|
|
224
|
-
declare function createEmptyBlueprint(name: string): BlueprintAsset;
|
|
224
|
+
declare function createEmptyBlueprint(name: string, includeBeginPlay?: boolean): BlueprintAsset;
|
|
225
225
|
/**
|
|
226
226
|
* Validates a blueprint asset structure
|
|
227
227
|
* 验证蓝图资产结构
|
|
@@ -285,6 +285,8 @@ declare class ExecutionContext {
|
|
|
285
285
|
private _localVariables;
|
|
286
286
|
/** Global variables (shared) (全局变量,共享) */
|
|
287
287
|
private static _globalVariables;
|
|
288
|
+
/** Component class registry (组件类注册表) */
|
|
289
|
+
private static _componentRegistry;
|
|
288
290
|
/** Node output cache for current execution (当前执行的节点输出缓存) */
|
|
289
291
|
private _outputCache;
|
|
290
292
|
/** Connection lookup by target (按目标的连接查找) */
|
|
@@ -353,6 +355,29 @@ declare class ExecutionContext {
|
|
|
353
355
|
* 清除全局变量(用于场景重置)
|
|
354
356
|
*/
|
|
355
357
|
static clearGlobalVariables(): void;
|
|
358
|
+
/**
|
|
359
|
+
* Get a component class by name
|
|
360
|
+
* 通过名称获取组件类
|
|
361
|
+
*
|
|
362
|
+
* @zh 首先检查 @BlueprintExpose 装饰的组件,然后检查手动注册的组件
|
|
363
|
+
* @en First checks @BlueprintExpose decorated components, then manually registered ones
|
|
364
|
+
*/
|
|
365
|
+
getComponentClass(typeName: string): (new () => Component) | undefined;
|
|
366
|
+
/**
|
|
367
|
+
* Register a component class for dynamic creation
|
|
368
|
+
* 注册组件类以支持动态创建
|
|
369
|
+
*/
|
|
370
|
+
static registerComponentClass(typeName: string, componentClass: new () => Component): void;
|
|
371
|
+
/**
|
|
372
|
+
* Unregister a component class
|
|
373
|
+
* 取消注册组件类
|
|
374
|
+
*/
|
|
375
|
+
static unregisterComponentClass(typeName: string): void;
|
|
376
|
+
/**
|
|
377
|
+
* Get all registered component classes
|
|
378
|
+
* 获取所有已注册的组件类
|
|
379
|
+
*/
|
|
380
|
+
static getRegisteredComponentClasses(): Map<string, new () => Component>;
|
|
356
381
|
}
|
|
357
382
|
|
|
358
383
|
/**
|
|
@@ -552,101 +577,126 @@ declare class BlueprintVM {
|
|
|
552
577
|
}
|
|
553
578
|
|
|
554
579
|
/**
|
|
555
|
-
*
|
|
556
|
-
*
|
|
580
|
+
* @zh 蓝图组件 - 将蓝图附加到实体
|
|
581
|
+
* @en Blueprint Component - Attaches a blueprint to an entity
|
|
557
582
|
*/
|
|
558
583
|
|
|
559
584
|
/**
|
|
560
|
-
*
|
|
561
|
-
*
|
|
585
|
+
* @zh 蓝图组件,用于将可视化脚本附加到 ECS 实体
|
|
586
|
+
* @en Blueprint component for attaching visual scripts to ECS entities
|
|
587
|
+
*
|
|
588
|
+
* @example
|
|
589
|
+
* ```typescript
|
|
590
|
+
* const entity = scene.createEntity('Player');
|
|
591
|
+
* const blueprint = new BlueprintComponent();
|
|
592
|
+
* blueprint.blueprintAsset = await loadBlueprintAsset('player.bp');
|
|
593
|
+
* blueprint.autoStart = true;
|
|
594
|
+
* entity.addComponent(blueprint);
|
|
595
|
+
* ```
|
|
562
596
|
*/
|
|
563
|
-
|
|
564
|
-
/**
|
|
565
|
-
|
|
566
|
-
|
|
597
|
+
declare class BlueprintComponent extends Component {
|
|
598
|
+
/**
|
|
599
|
+
* @zh 蓝图资产引用
|
|
600
|
+
* @en Blueprint asset reference
|
|
601
|
+
*/
|
|
567
602
|
blueprintAsset: BlueprintAsset | null;
|
|
568
|
-
/**
|
|
603
|
+
/**
|
|
604
|
+
* @zh 用于序列化的蓝图资产路径
|
|
605
|
+
* @en Blueprint asset path for serialization
|
|
606
|
+
*/
|
|
569
607
|
blueprintPath: string;
|
|
570
|
-
/**
|
|
608
|
+
/**
|
|
609
|
+
* @zh 实体创建时自动开始执行
|
|
610
|
+
* @en Auto-start execution when entity is created
|
|
611
|
+
*/
|
|
571
612
|
autoStart: boolean;
|
|
572
|
-
/**
|
|
613
|
+
/**
|
|
614
|
+
* @zh 启用 VM 调试模式
|
|
615
|
+
* @en Enable debug mode for VM
|
|
616
|
+
*/
|
|
573
617
|
debug: boolean;
|
|
574
|
-
/**
|
|
618
|
+
/**
|
|
619
|
+
* @zh 运行时 VM 实例
|
|
620
|
+
* @en Runtime VM instance
|
|
621
|
+
*/
|
|
575
622
|
vm: BlueprintVM | null;
|
|
576
|
-
/**
|
|
623
|
+
/**
|
|
624
|
+
* @zh 蓝图是否已启动
|
|
625
|
+
* @en Whether the blueprint has started
|
|
626
|
+
*/
|
|
577
627
|
isStarted: boolean;
|
|
628
|
+
/**
|
|
629
|
+
* @zh 初始化蓝图 VM
|
|
630
|
+
* @en Initialize blueprint VM
|
|
631
|
+
*/
|
|
632
|
+
initialize(entity: Entity, scene: IScene): void;
|
|
633
|
+
/**
|
|
634
|
+
* @zh 开始执行蓝图
|
|
635
|
+
* @en Start blueprint execution
|
|
636
|
+
*/
|
|
637
|
+
start(): void;
|
|
638
|
+
/**
|
|
639
|
+
* @zh 停止执行蓝图
|
|
640
|
+
* @en Stop blueprint execution
|
|
641
|
+
*/
|
|
642
|
+
stop(): void;
|
|
643
|
+
/**
|
|
644
|
+
* @zh 更新蓝图
|
|
645
|
+
* @en Update blueprint
|
|
646
|
+
*/
|
|
647
|
+
tick(deltaTime: number): void;
|
|
648
|
+
/**
|
|
649
|
+
* @zh 清理蓝图资源
|
|
650
|
+
* @en Cleanup blueprint resources
|
|
651
|
+
*/
|
|
652
|
+
cleanup(): void;
|
|
578
653
|
}
|
|
579
|
-
/**
|
|
580
|
-
* Creates a blueprint component data object
|
|
581
|
-
* 创建蓝图组件数据对象
|
|
582
|
-
*/
|
|
583
|
-
declare function createBlueprintComponentData(): IBlueprintComponent;
|
|
584
|
-
/**
|
|
585
|
-
* Initialize the VM for a blueprint component
|
|
586
|
-
* 为蓝图组件初始化 VM
|
|
587
|
-
*/
|
|
588
|
-
declare function initializeBlueprintVM(component: IBlueprintComponent, entity: Entity, scene: IScene): void;
|
|
589
|
-
/**
|
|
590
|
-
* Start blueprint execution
|
|
591
|
-
* 开始蓝图执行
|
|
592
|
-
*/
|
|
593
|
-
declare function startBlueprint(component: IBlueprintComponent): void;
|
|
594
|
-
/**
|
|
595
|
-
* Stop blueprint execution
|
|
596
|
-
* 停止蓝图执行
|
|
597
|
-
*/
|
|
598
|
-
declare function stopBlueprint(component: IBlueprintComponent): void;
|
|
599
|
-
/**
|
|
600
|
-
* Update blueprint execution
|
|
601
|
-
* 更新蓝图执行
|
|
602
|
-
*/
|
|
603
|
-
declare function tickBlueprint(component: IBlueprintComponent, deltaTime: number): void;
|
|
604
|
-
/**
|
|
605
|
-
* Clean up blueprint resources
|
|
606
|
-
* 清理蓝图资源
|
|
607
|
-
*/
|
|
608
|
-
declare function cleanupBlueprint(component: IBlueprintComponent): void;
|
|
609
654
|
|
|
610
655
|
/**
|
|
611
|
-
*
|
|
612
|
-
*
|
|
656
|
+
* @zh 蓝图系统 - 处理所有带有 BlueprintComponent 的实体
|
|
657
|
+
* @en Blueprint System - Processes all entities with BlueprintComponent
|
|
613
658
|
*/
|
|
614
659
|
|
|
615
660
|
/**
|
|
616
|
-
*
|
|
617
|
-
*
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
*
|
|
629
|
-
*
|
|
661
|
+
* @zh 蓝图执行系统
|
|
662
|
+
* @en Blueprint execution system
|
|
663
|
+
*
|
|
664
|
+
* @zh 自动处理所有带有 BlueprintComponent 的实体,管理蓝图的初始化、执行和清理
|
|
665
|
+
* @en Automatically processes all entities with BlueprintComponent, manages blueprint initialization, execution and cleanup
|
|
666
|
+
*
|
|
667
|
+
* @example
|
|
668
|
+
* ```typescript
|
|
669
|
+
* import { BlueprintSystem } from '@esengine/blueprint';
|
|
670
|
+
*
|
|
671
|
+
* // 添加到场景
|
|
672
|
+
* scene.addSystem(new BlueprintSystem());
|
|
673
|
+
*
|
|
674
|
+
* // 为实体添加蓝图
|
|
675
|
+
* const entity = scene.createEntity('Player');
|
|
676
|
+
* const blueprint = new BlueprintComponent();
|
|
677
|
+
* blueprint.blueprintAsset = await loadBlueprintAsset('player.bp');
|
|
678
|
+
* entity.addComponent(blueprint);
|
|
679
|
+
* ```
|
|
630
680
|
*/
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
681
|
+
declare class BlueprintSystem extends EntitySystem {
|
|
682
|
+
private _componentsRegistered;
|
|
683
|
+
constructor();
|
|
684
|
+
/**
|
|
685
|
+
* @zh 系统初始化时注册所有组件节点
|
|
686
|
+
* @en Register all component nodes when system initializes
|
|
687
|
+
*/
|
|
688
|
+
protected onInitialize(): void;
|
|
689
|
+
/**
|
|
690
|
+
* @zh 处理所有带有蓝图组件的实体
|
|
691
|
+
* @en Process all entities with blueprint components
|
|
692
|
+
*/
|
|
693
|
+
protected process(entities: readonly Entity[]): void;
|
|
694
|
+
/**
|
|
695
|
+
* @zh 实体移除时清理蓝图资源
|
|
696
|
+
* @en Cleanup blueprint resources when entity is removed
|
|
697
|
+
*/
|
|
698
|
+
protected onRemoved(entity: Entity): void;
|
|
634
699
|
}
|
|
635
|
-
/**
|
|
636
|
-
* Creates a blueprint execution system
|
|
637
|
-
* 创建蓝图执行系统
|
|
638
|
-
*/
|
|
639
|
-
declare function createBlueprintSystem(scene: IScene): IBlueprintSystem;
|
|
640
|
-
/**
|
|
641
|
-
* Utility to manually trigger blueprint events
|
|
642
|
-
* 手动触发蓝图事件的工具
|
|
643
|
-
*/
|
|
644
|
-
declare function triggerBlueprintEvent(entity: IBlueprintEntity, eventType: string, data?: Record<string, unknown>): void;
|
|
645
|
-
/**
|
|
646
|
-
* Utility to trigger custom events by name
|
|
647
|
-
* 按名称触发自定义事件的工具
|
|
648
|
-
*/
|
|
649
|
-
declare function triggerCustomBlueprintEvent(entity: IBlueprintEntity, eventName: string, data?: Record<string, unknown>): void;
|
|
650
700
|
|
|
651
701
|
/**
|
|
652
702
|
* @zh 蓝图触发器类型定义
|
|
@@ -2280,4 +2330,307 @@ declare const defaultFragmentRegistry: FragmentRegistry;
|
|
|
2280
2330
|
*/
|
|
2281
2331
|
declare function createFragmentRegistry(): IFragmentRegistry;
|
|
2282
2332
|
|
|
2283
|
-
|
|
2333
|
+
/**
|
|
2334
|
+
* @zh 蓝图装饰器 - 用于标记可在蓝图中使用的组件、属性和方法
|
|
2335
|
+
* @en Blueprint Decorators - Mark components, properties and methods for blueprint use
|
|
2336
|
+
*
|
|
2337
|
+
* @example
|
|
2338
|
+
* ```typescript
|
|
2339
|
+
* import { BlueprintExpose, BlueprintProperty, BlueprintMethod } from '@esengine/blueprint';
|
|
2340
|
+
*
|
|
2341
|
+
* @ECSComponent('Health')
|
|
2342
|
+
* @BlueprintExpose({ displayName: '生命值组件', category: 'gameplay' })
|
|
2343
|
+
* export class HealthComponent extends Component {
|
|
2344
|
+
*
|
|
2345
|
+
* @BlueprintProperty({ displayName: '当前生命值', type: 'float' })
|
|
2346
|
+
* current: number = 100;
|
|
2347
|
+
*
|
|
2348
|
+
* @BlueprintProperty({ displayName: '最大生命值', type: 'float', readonly: true })
|
|
2349
|
+
* max: number = 100;
|
|
2350
|
+
*
|
|
2351
|
+
* @BlueprintMethod({
|
|
2352
|
+
* displayName: '治疗',
|
|
2353
|
+
* params: [{ name: 'amount', type: 'float' }]
|
|
2354
|
+
* })
|
|
2355
|
+
* heal(amount: number): void {
|
|
2356
|
+
* this.current = Math.min(this.current + amount, this.max);
|
|
2357
|
+
* }
|
|
2358
|
+
*
|
|
2359
|
+
* @BlueprintMethod({
|
|
2360
|
+
* displayName: '受伤',
|
|
2361
|
+
* params: [{ name: 'amount', type: 'float' }],
|
|
2362
|
+
* returnType: 'bool'
|
|
2363
|
+
* })
|
|
2364
|
+
* takeDamage(amount: number): boolean {
|
|
2365
|
+
* this.current -= amount;
|
|
2366
|
+
* return this.current <= 0;
|
|
2367
|
+
* }
|
|
2368
|
+
* }
|
|
2369
|
+
* ```
|
|
2370
|
+
*/
|
|
2371
|
+
|
|
2372
|
+
/**
|
|
2373
|
+
* @zh 参数定义
|
|
2374
|
+
* @en Parameter definition
|
|
2375
|
+
*/
|
|
2376
|
+
interface BlueprintParamDef {
|
|
2377
|
+
/** @zh 参数名称 @en Parameter name */
|
|
2378
|
+
name: string;
|
|
2379
|
+
/** @zh 显示名称 @en Display name */
|
|
2380
|
+
displayName?: string;
|
|
2381
|
+
/** @zh 引脚类型 @en Pin type */
|
|
2382
|
+
type?: BlueprintPinType;
|
|
2383
|
+
/** @zh 默认值 @en Default value */
|
|
2384
|
+
defaultValue?: unknown;
|
|
2385
|
+
}
|
|
2386
|
+
/**
|
|
2387
|
+
* @zh 蓝图暴露选项
|
|
2388
|
+
* @en Blueprint expose options
|
|
2389
|
+
*/
|
|
2390
|
+
interface BlueprintExposeOptions {
|
|
2391
|
+
/** @zh 组件显示名称 @en Component display name */
|
|
2392
|
+
displayName?: string;
|
|
2393
|
+
/** @zh 组件描述 @en Component description */
|
|
2394
|
+
description?: string;
|
|
2395
|
+
/** @zh 组件分类 @en Component category */
|
|
2396
|
+
category?: string;
|
|
2397
|
+
/** @zh 组件颜色 @en Component color */
|
|
2398
|
+
color?: string;
|
|
2399
|
+
/** @zh 组件图标 @en Component icon */
|
|
2400
|
+
icon?: string;
|
|
2401
|
+
}
|
|
2402
|
+
/**
|
|
2403
|
+
* @zh 蓝图属性选项
|
|
2404
|
+
* @en Blueprint property options
|
|
2405
|
+
*/
|
|
2406
|
+
interface BlueprintPropertyOptions {
|
|
2407
|
+
/** @zh 属性显示名称 @en Property display name */
|
|
2408
|
+
displayName?: string;
|
|
2409
|
+
/** @zh 属性描述 @en Property description */
|
|
2410
|
+
description?: string;
|
|
2411
|
+
/** @zh 引脚类型 @en Pin type */
|
|
2412
|
+
type?: BlueprintPinType;
|
|
2413
|
+
/** @zh 是否只读(不生成 Set 节点)@en Readonly (no Set node generated) */
|
|
2414
|
+
readonly?: boolean;
|
|
2415
|
+
/** @zh 默认值 @en Default value */
|
|
2416
|
+
defaultValue?: unknown;
|
|
2417
|
+
}
|
|
2418
|
+
/**
|
|
2419
|
+
* @zh 蓝图方法选项
|
|
2420
|
+
* @en Blueprint method options
|
|
2421
|
+
*/
|
|
2422
|
+
interface BlueprintMethodOptions {
|
|
2423
|
+
/** @zh 方法显示名称 @en Method display name */
|
|
2424
|
+
displayName?: string;
|
|
2425
|
+
/** @zh 方法描述 @en Method description */
|
|
2426
|
+
description?: string;
|
|
2427
|
+
/** @zh 是否是纯函数(无副作用)@en Is pure function (no side effects) */
|
|
2428
|
+
isPure?: boolean;
|
|
2429
|
+
/** @zh 参数列表 @en Parameter list */
|
|
2430
|
+
params?: BlueprintParamDef[];
|
|
2431
|
+
/** @zh 返回值类型 @en Return type */
|
|
2432
|
+
returnType?: BlueprintPinType;
|
|
2433
|
+
}
|
|
2434
|
+
/**
|
|
2435
|
+
* @zh 属性元数据
|
|
2436
|
+
* @en Property metadata
|
|
2437
|
+
*/
|
|
2438
|
+
interface PropertyMetadata {
|
|
2439
|
+
propertyKey: string;
|
|
2440
|
+
displayName: string;
|
|
2441
|
+
description?: string;
|
|
2442
|
+
pinType: BlueprintPinType;
|
|
2443
|
+
readonly: boolean;
|
|
2444
|
+
defaultValue?: unknown;
|
|
2445
|
+
}
|
|
2446
|
+
/**
|
|
2447
|
+
* @zh 方法元数据
|
|
2448
|
+
* @en Method metadata
|
|
2449
|
+
*/
|
|
2450
|
+
interface MethodMetadata {
|
|
2451
|
+
methodKey: string;
|
|
2452
|
+
displayName: string;
|
|
2453
|
+
description?: string;
|
|
2454
|
+
isPure: boolean;
|
|
2455
|
+
params: BlueprintParamDef[];
|
|
2456
|
+
returnType: BlueprintPinType;
|
|
2457
|
+
}
|
|
2458
|
+
/**
|
|
2459
|
+
* @zh 组件蓝图元数据
|
|
2460
|
+
* @en Component blueprint metadata
|
|
2461
|
+
*/
|
|
2462
|
+
interface ComponentBlueprintMetadata extends BlueprintExposeOptions {
|
|
2463
|
+
componentName: string;
|
|
2464
|
+
properties: PropertyMetadata[];
|
|
2465
|
+
methods: MethodMetadata[];
|
|
2466
|
+
}
|
|
2467
|
+
/**
|
|
2468
|
+
* @zh 获取所有已注册的蓝图组件
|
|
2469
|
+
* @en Get all registered blueprint components
|
|
2470
|
+
*/
|
|
2471
|
+
declare function getRegisteredBlueprintComponents(): Map<Function, ComponentBlueprintMetadata>;
|
|
2472
|
+
/**
|
|
2473
|
+
* @zh 获取组件的蓝图元数据
|
|
2474
|
+
* @en Get blueprint metadata for a component
|
|
2475
|
+
*/
|
|
2476
|
+
declare function getBlueprintMetadata(componentClass: Function): ComponentBlueprintMetadata | undefined;
|
|
2477
|
+
/**
|
|
2478
|
+
* @zh 清除所有注册的蓝图组件(用于测试)
|
|
2479
|
+
* @en Clear all registered blueprint components (for testing)
|
|
2480
|
+
*/
|
|
2481
|
+
declare function clearRegisteredComponents(): void;
|
|
2482
|
+
/**
|
|
2483
|
+
* @zh 标记组件可在蓝图中使用
|
|
2484
|
+
* @en Mark component as usable in blueprint
|
|
2485
|
+
*
|
|
2486
|
+
* @example
|
|
2487
|
+
* ```typescript
|
|
2488
|
+
* @ECSComponent('Player')
|
|
2489
|
+
* @BlueprintExpose({ displayName: '玩家', category: 'gameplay' })
|
|
2490
|
+
* export class PlayerComponent extends Component { }
|
|
2491
|
+
* ```
|
|
2492
|
+
*/
|
|
2493
|
+
declare function BlueprintExpose(options?: BlueprintExposeOptions): ClassDecorator;
|
|
2494
|
+
/**
|
|
2495
|
+
* @zh 标记属性可在蓝图中访问
|
|
2496
|
+
* @en Mark property as accessible in blueprint
|
|
2497
|
+
*
|
|
2498
|
+
* @example
|
|
2499
|
+
* ```typescript
|
|
2500
|
+
* @BlueprintProperty({ displayName: '生命值', type: 'float' })
|
|
2501
|
+
* health: number = 100;
|
|
2502
|
+
*
|
|
2503
|
+
* @BlueprintProperty({ displayName: '名称', type: 'string', readonly: true })
|
|
2504
|
+
* name: string = 'Player';
|
|
2505
|
+
* ```
|
|
2506
|
+
*/
|
|
2507
|
+
declare function BlueprintProperty(options?: BlueprintPropertyOptions): PropertyDecorator;
|
|
2508
|
+
/**
|
|
2509
|
+
* @zh 标记方法可在蓝图中调用
|
|
2510
|
+
* @en Mark method as callable in blueprint
|
|
2511
|
+
*
|
|
2512
|
+
* @example
|
|
2513
|
+
* ```typescript
|
|
2514
|
+
* @BlueprintMethod({
|
|
2515
|
+
* displayName: '攻击',
|
|
2516
|
+
* params: [
|
|
2517
|
+
* { name: 'target', type: 'entity' },
|
|
2518
|
+
* { name: 'damage', type: 'float' }
|
|
2519
|
+
* ],
|
|
2520
|
+
* returnType: 'bool'
|
|
2521
|
+
* })
|
|
2522
|
+
* attack(target: Entity, damage: number): boolean { }
|
|
2523
|
+
*
|
|
2524
|
+
* @BlueprintMethod({ displayName: '获取速度', isPure: true, returnType: 'float' })
|
|
2525
|
+
* getSpeed(): number { return this.speed; }
|
|
2526
|
+
* ```
|
|
2527
|
+
*/
|
|
2528
|
+
declare function BlueprintMethod(options?: BlueprintMethodOptions): MethodDecorator;
|
|
2529
|
+
/**
|
|
2530
|
+
* @zh 从 TypeScript 类型名推断蓝图引脚类型
|
|
2531
|
+
* @en Infer blueprint pin type from TypeScript type name
|
|
2532
|
+
*/
|
|
2533
|
+
declare function inferPinType(typeName: string): BlueprintPinType;
|
|
2534
|
+
|
|
2535
|
+
/**
|
|
2536
|
+
* @zh 组件节点生成器 - 自动为标记的组件生成蓝图节点
|
|
2537
|
+
* @en Component Node Generator - Auto-generate blueprint nodes for marked components
|
|
2538
|
+
*
|
|
2539
|
+
* @zh 根据 @BlueprintExpose、@BlueprintProperty、@BlueprintMethod 装饰器
|
|
2540
|
+
* 自动生成对应的 Get/Set/Call 节点并注册到 NodeRegistry
|
|
2541
|
+
*
|
|
2542
|
+
* @en Based on @BlueprintExpose, @BlueprintProperty, @BlueprintMethod decorators,
|
|
2543
|
+
* auto-generate corresponding Get/Set/Call nodes and register to NodeRegistry
|
|
2544
|
+
*/
|
|
2545
|
+
|
|
2546
|
+
/**
|
|
2547
|
+
* @zh 为组件生成所有蓝图节点
|
|
2548
|
+
* @en Generate all blueprint nodes for a component
|
|
2549
|
+
*/
|
|
2550
|
+
declare function generateComponentNodes(componentClass: Function, metadata: ComponentBlueprintMetadata): void;
|
|
2551
|
+
/**
|
|
2552
|
+
* @zh 注册所有已标记的组件节点
|
|
2553
|
+
* @en Register all marked component nodes
|
|
2554
|
+
*
|
|
2555
|
+
* @zh 应该在蓝图系统初始化时调用,会扫描所有使用 @BlueprintExpose 装饰的组件
|
|
2556
|
+
* 并自动生成对应的蓝图节点
|
|
2557
|
+
*
|
|
2558
|
+
* @en Should be called during blueprint system initialization, scans all components
|
|
2559
|
+
* decorated with @BlueprintExpose and auto-generates corresponding blueprint nodes
|
|
2560
|
+
*/
|
|
2561
|
+
declare function registerAllComponentNodes(): void;
|
|
2562
|
+
/**
|
|
2563
|
+
* @zh 手动注册单个组件
|
|
2564
|
+
* @en Manually register a single component
|
|
2565
|
+
*/
|
|
2566
|
+
declare function registerComponentNodes(componentClass: Function): void;
|
|
2567
|
+
|
|
2568
|
+
/**
|
|
2569
|
+
* @esengine/blueprint - Visual scripting system for ECS Framework
|
|
2570
|
+
*
|
|
2571
|
+
* @zh 蓝图可视化脚本系统 - 与 ECS 框架深度集成
|
|
2572
|
+
* @en Visual scripting system - Deep integration with ECS framework
|
|
2573
|
+
*
|
|
2574
|
+
* @zh 此包提供完整的可视化脚本功能:
|
|
2575
|
+
* - 内置 ECS 操作节点(Entity、Component、Flow)
|
|
2576
|
+
* - 组件自动节点生成(使用装饰器标记)
|
|
2577
|
+
* - 运行时蓝图执行
|
|
2578
|
+
*
|
|
2579
|
+
* @en This package provides complete visual scripting features:
|
|
2580
|
+
* - Built-in ECS operation nodes (Entity, Component, Flow)
|
|
2581
|
+
* - Auto component node generation (using decorators)
|
|
2582
|
+
* - Runtime blueprint execution
|
|
2583
|
+
*
|
|
2584
|
+
* @example 基础使用 | Basic Usage:
|
|
2585
|
+
* ```typescript
|
|
2586
|
+
* import { BlueprintSystem, BlueprintComponent } from '@esengine/blueprint';
|
|
2587
|
+
* import { Scene, Core } from '@esengine/ecs-framework';
|
|
2588
|
+
*
|
|
2589
|
+
* // 创建场景并添加蓝图系统
|
|
2590
|
+
* const scene = new Scene();
|
|
2591
|
+
* scene.addSystem(new BlueprintSystem());
|
|
2592
|
+
* Core.setScene(scene);
|
|
2593
|
+
*
|
|
2594
|
+
* // 为实体添加蓝图
|
|
2595
|
+
* const entity = scene.createEntity('Player');
|
|
2596
|
+
* const blueprint = new BlueprintComponent();
|
|
2597
|
+
* blueprint.blueprintAsset = await loadBlueprintAsset('player.bp');
|
|
2598
|
+
* entity.addComponent(blueprint);
|
|
2599
|
+
* ```
|
|
2600
|
+
*
|
|
2601
|
+
* @example 标记组件 | Mark Components:
|
|
2602
|
+
* ```typescript
|
|
2603
|
+
* import { BlueprintExpose, BlueprintProperty, BlueprintMethod } from '@esengine/blueprint';
|
|
2604
|
+
* import { Component, ECSComponent } from '@esengine/ecs-framework';
|
|
2605
|
+
*
|
|
2606
|
+
* @ECSComponent('Health')
|
|
2607
|
+
* @BlueprintExpose({ displayName: '生命值' })
|
|
2608
|
+
* export class HealthComponent extends Component {
|
|
2609
|
+
* @BlueprintProperty({ displayName: '当前生命值' })
|
|
2610
|
+
* current: number = 100;
|
|
2611
|
+
*
|
|
2612
|
+
* @BlueprintMethod({ displayName: '治疗' })
|
|
2613
|
+
* heal(amount: number): void {
|
|
2614
|
+
* this.current += amount;
|
|
2615
|
+
* }
|
|
2616
|
+
* }
|
|
2617
|
+
* ```
|
|
2618
|
+
*
|
|
2619
|
+
* @packageDocumentation
|
|
2620
|
+
*/
|
|
2621
|
+
|
|
2622
|
+
/**
|
|
2623
|
+
* @zh 注册组件类以支持在蓝图中动态创建
|
|
2624
|
+
* @en Register a component class for dynamic creation in blueprints
|
|
2625
|
+
*
|
|
2626
|
+
* @example
|
|
2627
|
+
* ```typescript
|
|
2628
|
+
* import { registerComponentClass } from '@esengine/blueprint';
|
|
2629
|
+
* import { MyComponent } from './MyComponent';
|
|
2630
|
+
*
|
|
2631
|
+
* registerComponentClass('MyComponent', MyComponent);
|
|
2632
|
+
* ```
|
|
2633
|
+
*/
|
|
2634
|
+
declare function registerComponentClass(typeName: string, componentClass: new () => Component): void;
|
|
2635
|
+
|
|
2636
|
+
export { AlwaysFalseCondition, AlwaysTrueCondition, type BlueprintAsset, BlueprintComponent, BlueprintComposer, type BlueprintCompositionAsset, type BlueprintConnection, BlueprintExpose, type BlueprintExposeOptions, BlueprintFragment, type BlueprintFragmentAsset, type BlueprintFragmentConfig, type BlueprintMetadata, BlueprintMethod, type BlueprintMethodOptions, type BlueprintNode, type BlueprintNodeCategory, type BlueprintNodeTemplate, type BlueprintParamDef, type BlueprintPin, type BlueprintPinDefinition, type BlueprintPinDirection, type BlueprintPinType, BlueprintProperty, type BlueprintPropertyOptions, type BlueprintRuntimePin, BlueprintSystem, BlueprintTrigger, BlueprintVM, type BlueprintVariable, CollisionEntityCondition, type ComponentBlueprintMetadata, CompositeCondition, type CompositionError, type CompositionValidationResult, type CompositionWarning, ConditionBuilder, type ConditionLogic, CustomEventCondition, type DispatchResult, EntityIdCondition, EntityTriggerManager, type EventType, ExecutionContext, type ExecutionResult, type ExposedPin, type FragmentFilter, FragmentRegistry, type FragmentSlot, FunctionCondition, type IBlueprintComposer, type IBlueprintFragment, type IBlueprintTrigger, type ICollisionTriggerContext, type ICustomTriggerContext, type IEntityTriggerManager, type IFragmentRegistry, type IInputTriggerContext, type IMessageTriggerContext, type INodeExecutor, type IStateTriggerContext, type ITickTriggerContext, type ITimerTriggerContext, type ITriggerCondition, type ITriggerContext, type ITriggerDispatcher, type ITriggerRegistry, InputActionCondition, MessageNameCondition, type MethodMetadata, type NodeDefinition, NodeRegistry, NotCondition, type PropertyMetadata, RegisterNode, type SlotConnection, StateNameCondition, TimerIdCondition, type TriggerCallback, type TriggerConfig, type TriggerContext, TriggerDispatcher, TriggerRegistry, type TriggerResult, type TriggerType, TriggerTypeCondition, TriggerTypes, type VariableScope, arePinTypesCompatible, clearRegisteredComponents, condition, createCollisionContext, createCollisionTrigger, createComposer, createCustomContext, createCustomTrigger, createEmptyBlueprint, createEntityTriggerManager, createExposedPin, createFragment, createFragmentRegistry, createInputContext, createInputTrigger, createMessageContext, createMessageTrigger, createStateContext, createStateEnterTrigger, createStateExitTrigger, createTickContext, createTickTrigger, createTimerContext, createTimerTrigger, createTrigger, createTriggerDispatcher, defaultFragmentRegistry, fragmentFromAsset, fragmentToAsset, generateComponentNodes, getBlueprintMetadata, getNodeCategoryColor, getPinTypeColor, getRegisteredBlueprintComponents, inferPinType, registerAllComponentNodes, registerComponentClass, registerComponentNodes, validateBlueprintAsset };
|