@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.js
CHANGED
|
@@ -64,7 +64,19 @@ function getNodeCategoryColor(category) {
|
|
|
64
64
|
__name(getNodeCategoryColor, "getNodeCategoryColor");
|
|
65
65
|
|
|
66
66
|
// src/types/blueprint.ts
|
|
67
|
-
function createEmptyBlueprint(name) {
|
|
67
|
+
function createEmptyBlueprint(name, includeBeginPlay = true) {
|
|
68
|
+
const nodes = [];
|
|
69
|
+
if (includeBeginPlay) {
|
|
70
|
+
nodes.push({
|
|
71
|
+
id: "node_beginplay_1",
|
|
72
|
+
type: "EventBeginPlay",
|
|
73
|
+
position: {
|
|
74
|
+
x: 100,
|
|
75
|
+
y: 200
|
|
76
|
+
},
|
|
77
|
+
data: {}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
68
80
|
return {
|
|
69
81
|
version: 1,
|
|
70
82
|
type: "blueprint",
|
|
@@ -74,7 +86,7 @@ function createEmptyBlueprint(name) {
|
|
|
74
86
|
modifiedAt: Date.now()
|
|
75
87
|
},
|
|
76
88
|
variables: [],
|
|
77
|
-
nodes
|
|
89
|
+
nodes,
|
|
78
90
|
connections: []
|
|
79
91
|
};
|
|
80
92
|
}
|
|
@@ -86,6 +98,109 @@ function validateBlueprintAsset(asset) {
|
|
|
86
98
|
}
|
|
87
99
|
__name(validateBlueprintAsset, "validateBlueprintAsset");
|
|
88
100
|
|
|
101
|
+
// src/registry/BlueprintDecorators.ts
|
|
102
|
+
var registeredComponents = /* @__PURE__ */ new Map();
|
|
103
|
+
function getRegisteredBlueprintComponents() {
|
|
104
|
+
return registeredComponents;
|
|
105
|
+
}
|
|
106
|
+
__name(getRegisteredBlueprintComponents, "getRegisteredBlueprintComponents");
|
|
107
|
+
function getBlueprintMetadata(componentClass) {
|
|
108
|
+
return registeredComponents.get(componentClass);
|
|
109
|
+
}
|
|
110
|
+
__name(getBlueprintMetadata, "getBlueprintMetadata");
|
|
111
|
+
function clearRegisteredComponents() {
|
|
112
|
+
registeredComponents.clear();
|
|
113
|
+
}
|
|
114
|
+
__name(clearRegisteredComponents, "clearRegisteredComponents");
|
|
115
|
+
function getOrCreateMetadata(constructor) {
|
|
116
|
+
let metadata = registeredComponents.get(constructor);
|
|
117
|
+
if (!metadata) {
|
|
118
|
+
metadata = {
|
|
119
|
+
componentName: constructor.__componentName__ ?? constructor.name,
|
|
120
|
+
properties: [],
|
|
121
|
+
methods: []
|
|
122
|
+
};
|
|
123
|
+
registeredComponents.set(constructor, metadata);
|
|
124
|
+
}
|
|
125
|
+
return metadata;
|
|
126
|
+
}
|
|
127
|
+
__name(getOrCreateMetadata, "getOrCreateMetadata");
|
|
128
|
+
function BlueprintExpose(options = {}) {
|
|
129
|
+
return function(target) {
|
|
130
|
+
const metadata = getOrCreateMetadata(target);
|
|
131
|
+
Object.assign(metadata, options);
|
|
132
|
+
metadata.componentName = target.__componentName__ ?? target.name;
|
|
133
|
+
return target;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
__name(BlueprintExpose, "BlueprintExpose");
|
|
137
|
+
function BlueprintProperty(options = {}) {
|
|
138
|
+
return function(target, propertyKey) {
|
|
139
|
+
const key = String(propertyKey);
|
|
140
|
+
const metadata = getOrCreateMetadata(target.constructor);
|
|
141
|
+
const propMeta = {
|
|
142
|
+
propertyKey: key,
|
|
143
|
+
displayName: options.displayName ?? key,
|
|
144
|
+
description: options.description,
|
|
145
|
+
pinType: options.type ?? "any",
|
|
146
|
+
readonly: options.readonly ?? false,
|
|
147
|
+
defaultValue: options.defaultValue
|
|
148
|
+
};
|
|
149
|
+
const existingIndex = metadata.properties.findIndex((p) => p.propertyKey === key);
|
|
150
|
+
if (existingIndex >= 0) {
|
|
151
|
+
metadata.properties[existingIndex] = propMeta;
|
|
152
|
+
} else {
|
|
153
|
+
metadata.properties.push(propMeta);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
__name(BlueprintProperty, "BlueprintProperty");
|
|
158
|
+
function BlueprintMethod(options = {}) {
|
|
159
|
+
return function(target, propertyKey, descriptor) {
|
|
160
|
+
const key = String(propertyKey);
|
|
161
|
+
const metadata = getOrCreateMetadata(target.constructor);
|
|
162
|
+
const methodMeta = {
|
|
163
|
+
methodKey: key,
|
|
164
|
+
displayName: options.displayName ?? key,
|
|
165
|
+
description: options.description,
|
|
166
|
+
isPure: options.isPure ?? false,
|
|
167
|
+
params: options.params ?? [],
|
|
168
|
+
returnType: options.returnType ?? "any"
|
|
169
|
+
};
|
|
170
|
+
const existingIndex = metadata.methods.findIndex((m) => m.methodKey === key);
|
|
171
|
+
if (existingIndex >= 0) {
|
|
172
|
+
metadata.methods[existingIndex] = methodMeta;
|
|
173
|
+
} else {
|
|
174
|
+
metadata.methods.push(methodMeta);
|
|
175
|
+
}
|
|
176
|
+
return descriptor;
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
__name(BlueprintMethod, "BlueprintMethod");
|
|
180
|
+
function inferPinType(typeName) {
|
|
181
|
+
const typeMap = {
|
|
182
|
+
"number": "float",
|
|
183
|
+
"Number": "float",
|
|
184
|
+
"string": "string",
|
|
185
|
+
"String": "string",
|
|
186
|
+
"boolean": "bool",
|
|
187
|
+
"Boolean": "bool",
|
|
188
|
+
"Entity": "entity",
|
|
189
|
+
"Component": "component",
|
|
190
|
+
"Vector2": "vector2",
|
|
191
|
+
"Vec2": "vector2",
|
|
192
|
+
"Vector3": "vector3",
|
|
193
|
+
"Vec3": "vector3",
|
|
194
|
+
"Color": "color",
|
|
195
|
+
"Array": "array",
|
|
196
|
+
"Object": "object",
|
|
197
|
+
"void": "exec",
|
|
198
|
+
"undefined": "exec"
|
|
199
|
+
};
|
|
200
|
+
return typeMap[typeName] ?? "any";
|
|
201
|
+
}
|
|
202
|
+
__name(inferPinType, "inferPinType");
|
|
203
|
+
|
|
89
204
|
// src/runtime/ExecutionContext.ts
|
|
90
205
|
var _ExecutionContext = class _ExecutionContext {
|
|
91
206
|
constructor(blueprint, entity, scene) {
|
|
@@ -253,10 +368,49 @@ var _ExecutionContext = class _ExecutionContext {
|
|
|
253
368
|
static clearGlobalVariables() {
|
|
254
369
|
_ExecutionContext._globalVariables.clear();
|
|
255
370
|
}
|
|
371
|
+
/**
|
|
372
|
+
* Get a component class by name
|
|
373
|
+
* 通过名称获取组件类
|
|
374
|
+
*
|
|
375
|
+
* @zh 首先检查 @BlueprintExpose 装饰的组件,然后检查手动注册的组件
|
|
376
|
+
* @en First checks @BlueprintExpose decorated components, then manually registered ones
|
|
377
|
+
*/
|
|
378
|
+
getComponentClass(typeName) {
|
|
379
|
+
const blueprintComponents = getRegisteredBlueprintComponents();
|
|
380
|
+
for (const [componentClass, metadata] of blueprintComponents) {
|
|
381
|
+
if (metadata.componentName === typeName || componentClass.name === typeName) {
|
|
382
|
+
return componentClass;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
return _ExecutionContext._componentRegistry.get(typeName);
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Register a component class for dynamic creation
|
|
389
|
+
* 注册组件类以支持动态创建
|
|
390
|
+
*/
|
|
391
|
+
static registerComponentClass(typeName, componentClass) {
|
|
392
|
+
_ExecutionContext._componentRegistry.set(typeName, componentClass);
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Unregister a component class
|
|
396
|
+
* 取消注册组件类
|
|
397
|
+
*/
|
|
398
|
+
static unregisterComponentClass(typeName) {
|
|
399
|
+
_ExecutionContext._componentRegistry.delete(typeName);
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Get all registered component classes
|
|
403
|
+
* 获取所有已注册的组件类
|
|
404
|
+
*/
|
|
405
|
+
static getRegisteredComponentClasses() {
|
|
406
|
+
return new Map(_ExecutionContext._componentRegistry);
|
|
407
|
+
}
|
|
256
408
|
};
|
|
257
409
|
__name(_ExecutionContext, "ExecutionContext");
|
|
258
410
|
/** Global variables (shared) (全局变量,共享) */
|
|
259
411
|
__publicField(_ExecutionContext, "_globalVariables", /* @__PURE__ */ new Map());
|
|
412
|
+
/** Component class registry (组件类注册表) */
|
|
413
|
+
__publicField(_ExecutionContext, "_componentRegistry", /* @__PURE__ */ new Map());
|
|
260
414
|
var ExecutionContext = _ExecutionContext;
|
|
261
415
|
|
|
262
416
|
// src/runtime/NodeRegistry.ts
|
|
@@ -576,104 +730,622 @@ __name(_BlueprintVM, "BlueprintVM");
|
|
|
576
730
|
var BlueprintVM = _BlueprintVM;
|
|
577
731
|
|
|
578
732
|
// src/runtime/BlueprintComponent.ts
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
debug: false,
|
|
586
|
-
vm: null,
|
|
587
|
-
isStarted: false
|
|
588
|
-
};
|
|
733
|
+
import { Component, ECSComponent } from "@esengine/ecs-framework";
|
|
734
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
735
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
736
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
737
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
738
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
589
739
|
}
|
|
590
|
-
__name(
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
740
|
+
__name(_ts_decorate, "_ts_decorate");
|
|
741
|
+
var _BlueprintComponent = class _BlueprintComponent extends Component {
|
|
742
|
+
constructor() {
|
|
743
|
+
super(...arguments);
|
|
744
|
+
/**
|
|
745
|
+
* @zh 蓝图资产引用
|
|
746
|
+
* @en Blueprint asset reference
|
|
747
|
+
*/
|
|
748
|
+
__publicField(this, "blueprintAsset", null);
|
|
749
|
+
/**
|
|
750
|
+
* @zh 用于序列化的蓝图资产路径
|
|
751
|
+
* @en Blueprint asset path for serialization
|
|
752
|
+
*/
|
|
753
|
+
__publicField(this, "blueprintPath", "");
|
|
754
|
+
/**
|
|
755
|
+
* @zh 实体创建时自动开始执行
|
|
756
|
+
* @en Auto-start execution when entity is created
|
|
757
|
+
*/
|
|
758
|
+
__publicField(this, "autoStart", true);
|
|
759
|
+
/**
|
|
760
|
+
* @zh 启用 VM 调试模式
|
|
761
|
+
* @en Enable debug mode for VM
|
|
762
|
+
*/
|
|
763
|
+
__publicField(this, "debug", false);
|
|
764
|
+
/**
|
|
765
|
+
* @zh 运行时 VM 实例
|
|
766
|
+
* @en Runtime VM instance
|
|
767
|
+
*/
|
|
768
|
+
__publicField(this, "vm", null);
|
|
769
|
+
/**
|
|
770
|
+
* @zh 蓝图是否已启动
|
|
771
|
+
* @en Whether the blueprint has started
|
|
772
|
+
*/
|
|
773
|
+
__publicField(this, "isStarted", false);
|
|
594
774
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
775
|
+
/**
|
|
776
|
+
* @zh 初始化蓝图 VM
|
|
777
|
+
* @en Initialize blueprint VM
|
|
778
|
+
*/
|
|
779
|
+
initialize(entity, scene) {
|
|
780
|
+
if (!this.blueprintAsset) return;
|
|
781
|
+
this.vm = new BlueprintVM(this.blueprintAsset, entity, scene);
|
|
782
|
+
this.vm.debug = this.debug;
|
|
603
783
|
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
784
|
+
/**
|
|
785
|
+
* @zh 开始执行蓝图
|
|
786
|
+
* @en Start blueprint execution
|
|
787
|
+
*/
|
|
788
|
+
start() {
|
|
789
|
+
if (this.vm && !this.isStarted) {
|
|
790
|
+
this.vm.start();
|
|
791
|
+
this.isStarted = true;
|
|
792
|
+
}
|
|
610
793
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
794
|
+
/**
|
|
795
|
+
* @zh 停止执行蓝图
|
|
796
|
+
* @en Stop blueprint execution
|
|
797
|
+
*/
|
|
798
|
+
stop() {
|
|
799
|
+
if (this.vm && this.isStarted) {
|
|
800
|
+
this.vm.stop();
|
|
801
|
+
this.isStarted = false;
|
|
802
|
+
}
|
|
616
803
|
}
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
804
|
+
/**
|
|
805
|
+
* @zh 更新蓝图
|
|
806
|
+
* @en Update blueprint
|
|
807
|
+
*/
|
|
808
|
+
tick(deltaTime) {
|
|
809
|
+
if (this.vm && this.isStarted) {
|
|
810
|
+
this.vm.tick(deltaTime);
|
|
623
811
|
}
|
|
624
|
-
component.vm = null;
|
|
625
|
-
component.isStarted = false;
|
|
626
812
|
}
|
|
627
|
-
|
|
628
|
-
|
|
813
|
+
/**
|
|
814
|
+
* @zh 清理蓝图资源
|
|
815
|
+
* @en Cleanup blueprint resources
|
|
816
|
+
*/
|
|
817
|
+
cleanup() {
|
|
818
|
+
if (this.vm) {
|
|
819
|
+
if (this.isStarted) {
|
|
820
|
+
this.vm.stop();
|
|
821
|
+
}
|
|
822
|
+
this.vm = null;
|
|
823
|
+
this.isStarted = false;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
__name(_BlueprintComponent, "BlueprintComponent");
|
|
828
|
+
var BlueprintComponent = _BlueprintComponent;
|
|
829
|
+
BlueprintComponent = _ts_decorate([
|
|
830
|
+
ECSComponent("Blueprint")
|
|
831
|
+
], BlueprintComponent);
|
|
629
832
|
|
|
630
833
|
// src/runtime/BlueprintSystem.ts
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
834
|
+
import { EntitySystem, Matcher, ECSSystem, Time } from "@esengine/ecs-framework";
|
|
835
|
+
|
|
836
|
+
// src/registry/ComponentNodeGenerator.ts
|
|
837
|
+
function generateComponentNodes(componentClass, metadata) {
|
|
838
|
+
const { componentName, properties, methods } = metadata;
|
|
839
|
+
const category = metadata.category ?? "component";
|
|
840
|
+
const color = metadata.color ?? "#1e8b8b";
|
|
841
|
+
generateAddComponentNode(componentClass, componentName, metadata, color);
|
|
842
|
+
generateGetComponentNode(componentClass, componentName, metadata, color);
|
|
843
|
+
for (const prop of properties) {
|
|
844
|
+
generatePropertyGetNode(componentName, prop, category, color);
|
|
845
|
+
if (!prop.readonly) {
|
|
846
|
+
generatePropertySetNode(componentName, prop, category, color);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
for (const method of methods) {
|
|
850
|
+
generateMethodCallNode(componentName, method, category, color);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
__name(generateComponentNodes, "generateComponentNodes");
|
|
854
|
+
function generateAddComponentNode(componentClass, componentName, metadata, color) {
|
|
855
|
+
const nodeType = `Add_${componentName}`;
|
|
856
|
+
const displayName = metadata.displayName ?? componentName;
|
|
857
|
+
const propertyInputs = [];
|
|
858
|
+
const propertyDefaults = {};
|
|
859
|
+
for (const prop of metadata.properties) {
|
|
860
|
+
if (!prop.readonly) {
|
|
861
|
+
propertyInputs.push({
|
|
862
|
+
name: prop.propertyKey,
|
|
863
|
+
type: prop.pinType,
|
|
864
|
+
displayName: prop.displayName,
|
|
865
|
+
defaultValue: prop.defaultValue
|
|
866
|
+
});
|
|
867
|
+
propertyDefaults[prop.propertyKey] = prop.defaultValue;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
const template = {
|
|
871
|
+
type: nodeType,
|
|
872
|
+
title: `Add ${displayName}`,
|
|
873
|
+
category: "component",
|
|
874
|
+
color,
|
|
875
|
+
description: `Adds ${displayName} component to entity (\u4E3A\u5B9E\u4F53\u6DFB\u52A0 ${displayName} \u7EC4\u4EF6)`,
|
|
876
|
+
keywords: [
|
|
877
|
+
"add",
|
|
878
|
+
"component",
|
|
879
|
+
"create",
|
|
880
|
+
componentName.toLowerCase()
|
|
881
|
+
],
|
|
882
|
+
menuPath: [
|
|
883
|
+
"Components",
|
|
884
|
+
displayName,
|
|
885
|
+
`Add ${displayName}`
|
|
886
|
+
],
|
|
887
|
+
inputs: [
|
|
888
|
+
{
|
|
889
|
+
name: "exec",
|
|
890
|
+
type: "exec",
|
|
891
|
+
displayName: ""
|
|
892
|
+
},
|
|
893
|
+
{
|
|
894
|
+
name: "entity",
|
|
895
|
+
type: "entity",
|
|
896
|
+
displayName: "Entity"
|
|
897
|
+
},
|
|
898
|
+
...propertyInputs
|
|
899
|
+
],
|
|
900
|
+
outputs: [
|
|
901
|
+
{
|
|
902
|
+
name: "exec",
|
|
903
|
+
type: "exec",
|
|
904
|
+
displayName: ""
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
name: "component",
|
|
908
|
+
type: "component",
|
|
909
|
+
displayName
|
|
910
|
+
},
|
|
911
|
+
{
|
|
912
|
+
name: "success",
|
|
913
|
+
type: "bool",
|
|
914
|
+
displayName: "Success"
|
|
915
|
+
}
|
|
916
|
+
]
|
|
917
|
+
};
|
|
918
|
+
const propertyKeys = metadata.properties.filter((p) => !p.readonly).map((p) => p.propertyKey);
|
|
919
|
+
const executor = {
|
|
920
|
+
execute(node, context) {
|
|
921
|
+
const entity = context.evaluateInput(node.id, "entity", context.entity);
|
|
922
|
+
if (!entity || entity.isDestroyed) {
|
|
923
|
+
return {
|
|
924
|
+
outputs: {
|
|
925
|
+
component: null,
|
|
926
|
+
success: false
|
|
927
|
+
},
|
|
928
|
+
nextExec: "exec"
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
const existing = entity.components.find((c) => c.constructor === componentClass || c.constructor.name === componentName || c.constructor.__componentName__ === componentName);
|
|
932
|
+
if (existing) {
|
|
933
|
+
return {
|
|
934
|
+
outputs: {
|
|
935
|
+
component: existing,
|
|
936
|
+
success: false
|
|
937
|
+
},
|
|
938
|
+
nextExec: "exec"
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
try {
|
|
942
|
+
const component = new componentClass();
|
|
943
|
+
for (const key of propertyKeys) {
|
|
944
|
+
const value = context.evaluateInput(node.id, key, propertyDefaults[key]);
|
|
945
|
+
if (value !== void 0) {
|
|
946
|
+
component[key] = value;
|
|
947
|
+
}
|
|
641
948
|
}
|
|
642
|
-
|
|
643
|
-
|
|
949
|
+
entity.addComponent(component);
|
|
950
|
+
return {
|
|
951
|
+
outputs: {
|
|
952
|
+
component,
|
|
953
|
+
success: true
|
|
954
|
+
},
|
|
955
|
+
nextExec: "exec"
|
|
956
|
+
};
|
|
957
|
+
} catch (error) {
|
|
958
|
+
console.error(`[Blueprint] Failed to add ${componentName}:`, error);
|
|
959
|
+
return {
|
|
960
|
+
outputs: {
|
|
961
|
+
component: null,
|
|
962
|
+
success: false
|
|
963
|
+
},
|
|
964
|
+
nextExec: "exec"
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
};
|
|
969
|
+
NodeRegistry.instance.register(template, executor);
|
|
970
|
+
}
|
|
971
|
+
__name(generateAddComponentNode, "generateAddComponentNode");
|
|
972
|
+
function generateGetComponentNode(componentClass, componentName, metadata, color) {
|
|
973
|
+
const nodeType = `Get_${componentName}`;
|
|
974
|
+
const displayName = metadata.displayName ?? componentName;
|
|
975
|
+
const template = {
|
|
976
|
+
type: nodeType,
|
|
977
|
+
title: `Get ${displayName}`,
|
|
978
|
+
category: "component",
|
|
979
|
+
color,
|
|
980
|
+
isPure: true,
|
|
981
|
+
description: `Gets ${displayName} component from entity (\u4ECE\u5B9E\u4F53\u83B7\u53D6 ${displayName} \u7EC4\u4EF6)`,
|
|
982
|
+
keywords: [
|
|
983
|
+
"get",
|
|
984
|
+
"component",
|
|
985
|
+
componentName.toLowerCase()
|
|
986
|
+
],
|
|
987
|
+
menuPath: [
|
|
988
|
+
"Components",
|
|
989
|
+
displayName,
|
|
990
|
+
`Get ${displayName}`
|
|
991
|
+
],
|
|
992
|
+
inputs: [
|
|
993
|
+
{
|
|
994
|
+
name: "entity",
|
|
995
|
+
type: "entity",
|
|
996
|
+
displayName: "Entity"
|
|
997
|
+
}
|
|
998
|
+
],
|
|
999
|
+
outputs: [
|
|
1000
|
+
{
|
|
1001
|
+
name: "component",
|
|
1002
|
+
type: "component",
|
|
1003
|
+
displayName
|
|
1004
|
+
},
|
|
1005
|
+
{
|
|
1006
|
+
name: "found",
|
|
1007
|
+
type: "bool",
|
|
1008
|
+
displayName: "Found"
|
|
1009
|
+
}
|
|
1010
|
+
]
|
|
1011
|
+
};
|
|
1012
|
+
const executor = {
|
|
1013
|
+
execute(node, context) {
|
|
1014
|
+
const entity = context.evaluateInput(node.id, "entity", context.entity);
|
|
1015
|
+
if (!entity || entity.isDestroyed) {
|
|
1016
|
+
return {
|
|
1017
|
+
outputs: {
|
|
1018
|
+
component: null,
|
|
1019
|
+
found: false
|
|
1020
|
+
}
|
|
1021
|
+
};
|
|
1022
|
+
}
|
|
1023
|
+
const component = entity.components.find((c) => c.constructor === componentClass || c.constructor.name === componentName || c.constructor.__componentName__ === componentName);
|
|
1024
|
+
return {
|
|
1025
|
+
outputs: {
|
|
1026
|
+
component: component ?? null,
|
|
1027
|
+
found: component != null
|
|
644
1028
|
}
|
|
645
|
-
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
};
|
|
1032
|
+
NodeRegistry.instance.register(template, executor);
|
|
1033
|
+
}
|
|
1034
|
+
__name(generateGetComponentNode, "generateGetComponentNode");
|
|
1035
|
+
function generatePropertyGetNode(componentName, prop, category, color) {
|
|
1036
|
+
const nodeType = `Get_${componentName}_${prop.propertyKey}`;
|
|
1037
|
+
const { displayName, pinType } = prop;
|
|
1038
|
+
const template = {
|
|
1039
|
+
type: nodeType,
|
|
1040
|
+
title: `Get ${displayName}`,
|
|
1041
|
+
subtitle: componentName,
|
|
1042
|
+
category,
|
|
1043
|
+
color,
|
|
1044
|
+
isPure: true,
|
|
1045
|
+
description: prop.description ?? `Gets ${displayName} from ${componentName} (\u4ECE ${componentName} \u83B7\u53D6 ${displayName})`,
|
|
1046
|
+
keywords: [
|
|
1047
|
+
"get",
|
|
1048
|
+
"property",
|
|
1049
|
+
componentName.toLowerCase(),
|
|
1050
|
+
prop.propertyKey.toLowerCase()
|
|
1051
|
+
],
|
|
1052
|
+
menuPath: [
|
|
1053
|
+
"Components",
|
|
1054
|
+
componentName,
|
|
1055
|
+
`Get ${displayName}`
|
|
1056
|
+
],
|
|
1057
|
+
inputs: [
|
|
1058
|
+
{
|
|
1059
|
+
name: "component",
|
|
1060
|
+
type: "component",
|
|
1061
|
+
displayName: componentName
|
|
646
1062
|
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
1063
|
+
],
|
|
1064
|
+
outputs: [
|
|
1065
|
+
{
|
|
1066
|
+
name: "value",
|
|
1067
|
+
type: pinType,
|
|
1068
|
+
displayName
|
|
1069
|
+
}
|
|
1070
|
+
]
|
|
1071
|
+
};
|
|
1072
|
+
const propertyKey = prop.propertyKey;
|
|
1073
|
+
const defaultValue = prop.defaultValue;
|
|
1074
|
+
const executor = {
|
|
1075
|
+
execute(node, context) {
|
|
1076
|
+
const component = context.evaluateInput(node.id, "component", null);
|
|
1077
|
+
if (!component) {
|
|
1078
|
+
return {
|
|
1079
|
+
outputs: {
|
|
1080
|
+
value: defaultValue ?? null
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
}
|
|
1084
|
+
const value = component[propertyKey];
|
|
1085
|
+
return {
|
|
1086
|
+
outputs: {
|
|
1087
|
+
value
|
|
654
1088
|
}
|
|
1089
|
+
};
|
|
1090
|
+
}
|
|
1091
|
+
};
|
|
1092
|
+
NodeRegistry.instance.register(template, executor);
|
|
1093
|
+
}
|
|
1094
|
+
__name(generatePropertyGetNode, "generatePropertyGetNode");
|
|
1095
|
+
function generatePropertySetNode(componentName, prop, category, color) {
|
|
1096
|
+
const nodeType = `Set_${componentName}_${prop.propertyKey}`;
|
|
1097
|
+
const { displayName, pinType, defaultValue } = prop;
|
|
1098
|
+
const template = {
|
|
1099
|
+
type: nodeType,
|
|
1100
|
+
title: `Set ${displayName}`,
|
|
1101
|
+
subtitle: componentName,
|
|
1102
|
+
category,
|
|
1103
|
+
color,
|
|
1104
|
+
description: prop.description ?? `Sets ${displayName} on ${componentName} (\u8BBE\u7F6E ${componentName} \u7684 ${displayName})`,
|
|
1105
|
+
keywords: [
|
|
1106
|
+
"set",
|
|
1107
|
+
"property",
|
|
1108
|
+
componentName.toLowerCase(),
|
|
1109
|
+
prop.propertyKey.toLowerCase()
|
|
1110
|
+
],
|
|
1111
|
+
menuPath: [
|
|
1112
|
+
"Components",
|
|
1113
|
+
componentName,
|
|
1114
|
+
`Set ${displayName}`
|
|
1115
|
+
],
|
|
1116
|
+
inputs: [
|
|
1117
|
+
{
|
|
1118
|
+
name: "exec",
|
|
1119
|
+
type: "exec",
|
|
1120
|
+
displayName: ""
|
|
1121
|
+
},
|
|
1122
|
+
{
|
|
1123
|
+
name: "component",
|
|
1124
|
+
type: "component",
|
|
1125
|
+
displayName: componentName
|
|
1126
|
+
},
|
|
1127
|
+
{
|
|
1128
|
+
name: "value",
|
|
1129
|
+
type: pinType,
|
|
1130
|
+
displayName,
|
|
1131
|
+
defaultValue
|
|
655
1132
|
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
1133
|
+
],
|
|
1134
|
+
outputs: [
|
|
1135
|
+
{
|
|
1136
|
+
name: "exec",
|
|
1137
|
+
type: "exec",
|
|
1138
|
+
displayName: ""
|
|
1139
|
+
}
|
|
1140
|
+
]
|
|
1141
|
+
};
|
|
1142
|
+
const propertyKey = prop.propertyKey;
|
|
1143
|
+
const executor = {
|
|
1144
|
+
execute(node, context) {
|
|
1145
|
+
const component = context.evaluateInput(node.id, "component", null);
|
|
1146
|
+
const value = context.evaluateInput(node.id, "value", defaultValue);
|
|
1147
|
+
if (component) {
|
|
1148
|
+
component[propertyKey] = value;
|
|
1149
|
+
}
|
|
1150
|
+
return {
|
|
1151
|
+
nextExec: "exec"
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
NodeRegistry.instance.register(template, executor);
|
|
1156
|
+
}
|
|
1157
|
+
__name(generatePropertySetNode, "generatePropertySetNode");
|
|
1158
|
+
function generateMethodCallNode(componentName, method, category, color) {
|
|
1159
|
+
const nodeType = `Call_${componentName}_${method.methodKey}`;
|
|
1160
|
+
const { displayName, isPure, params, returnType } = method;
|
|
1161
|
+
const inputs = [];
|
|
1162
|
+
if (!isPure) {
|
|
1163
|
+
inputs.push({
|
|
1164
|
+
name: "exec",
|
|
1165
|
+
type: "exec",
|
|
1166
|
+
displayName: ""
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
inputs.push({
|
|
1170
|
+
name: "component",
|
|
1171
|
+
type: "component",
|
|
1172
|
+
displayName: componentName
|
|
1173
|
+
});
|
|
1174
|
+
const paramNames = [];
|
|
1175
|
+
for (const param of params) {
|
|
1176
|
+
inputs.push({
|
|
1177
|
+
name: param.name,
|
|
1178
|
+
type: param.type ?? "any",
|
|
1179
|
+
displayName: param.displayName ?? param.name,
|
|
1180
|
+
defaultValue: param.defaultValue
|
|
1181
|
+
});
|
|
1182
|
+
paramNames.push(param.name);
|
|
1183
|
+
}
|
|
1184
|
+
const outputs = [];
|
|
1185
|
+
if (!isPure) {
|
|
1186
|
+
outputs.push({
|
|
1187
|
+
name: "exec",
|
|
1188
|
+
type: "exec",
|
|
1189
|
+
displayName: ""
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
if (returnType !== "exec" && returnType !== "any") {
|
|
1193
|
+
outputs.push({
|
|
1194
|
+
name: "result",
|
|
1195
|
+
type: returnType,
|
|
1196
|
+
displayName: "Result"
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
const template = {
|
|
1200
|
+
type: nodeType,
|
|
1201
|
+
title: displayName,
|
|
1202
|
+
subtitle: componentName,
|
|
1203
|
+
category,
|
|
1204
|
+
color,
|
|
1205
|
+
isPure,
|
|
1206
|
+
description: method.description ?? `Calls ${displayName} on ${componentName} (\u8C03\u7528 ${componentName} \u7684 ${displayName})`,
|
|
1207
|
+
keywords: [
|
|
1208
|
+
"call",
|
|
1209
|
+
"method",
|
|
1210
|
+
componentName.toLowerCase(),
|
|
1211
|
+
method.methodKey.toLowerCase()
|
|
1212
|
+
],
|
|
1213
|
+
menuPath: [
|
|
1214
|
+
"Components",
|
|
1215
|
+
componentName,
|
|
1216
|
+
displayName
|
|
1217
|
+
],
|
|
1218
|
+
inputs,
|
|
1219
|
+
outputs
|
|
1220
|
+
};
|
|
1221
|
+
const methodKey = method.methodKey;
|
|
1222
|
+
const executor = {
|
|
1223
|
+
execute(node, context) {
|
|
1224
|
+
const component = context.evaluateInput(node.id, "component", null);
|
|
1225
|
+
if (!component) {
|
|
1226
|
+
return isPure ? {
|
|
1227
|
+
outputs: {
|
|
1228
|
+
result: null
|
|
1229
|
+
}
|
|
1230
|
+
} : {
|
|
1231
|
+
nextExec: "exec"
|
|
1232
|
+
};
|
|
1233
|
+
}
|
|
1234
|
+
const args = paramNames.map((name) => context.evaluateInput(node.id, name, void 0));
|
|
1235
|
+
const fn = component[methodKey];
|
|
1236
|
+
if (typeof fn !== "function") {
|
|
1237
|
+
console.warn(`Method ${methodKey} not found on component ${componentName}`);
|
|
1238
|
+
return isPure ? {
|
|
1239
|
+
outputs: {
|
|
1240
|
+
result: null
|
|
1241
|
+
}
|
|
1242
|
+
} : {
|
|
1243
|
+
nextExec: "exec"
|
|
1244
|
+
};
|
|
1245
|
+
}
|
|
1246
|
+
const result = fn.apply(component, args);
|
|
1247
|
+
return isPure ? {
|
|
1248
|
+
outputs: {
|
|
1249
|
+
result
|
|
1250
|
+
}
|
|
1251
|
+
} : {
|
|
1252
|
+
outputs: {
|
|
1253
|
+
result
|
|
1254
|
+
},
|
|
1255
|
+
nextExec: "exec"
|
|
1256
|
+
};
|
|
659
1257
|
}
|
|
660
1258
|
};
|
|
1259
|
+
NodeRegistry.instance.register(template, executor);
|
|
661
1260
|
}
|
|
662
|
-
__name(
|
|
663
|
-
function
|
|
664
|
-
const
|
|
665
|
-
|
|
666
|
-
|
|
1261
|
+
__name(generateMethodCallNode, "generateMethodCallNode");
|
|
1262
|
+
function registerAllComponentNodes() {
|
|
1263
|
+
const components = getRegisteredBlueprintComponents();
|
|
1264
|
+
for (const [componentClass, metadata] of components) {
|
|
1265
|
+
try {
|
|
1266
|
+
generateComponentNodes(componentClass, metadata);
|
|
1267
|
+
console.log(`[Blueprint] Registered component: ${metadata.componentName} (${metadata.properties.length} properties, ${metadata.methods.length} methods)`);
|
|
1268
|
+
} catch (error) {
|
|
1269
|
+
console.error(`[Blueprint] Failed to register component ${metadata.componentName}:`, error);
|
|
1270
|
+
}
|
|
667
1271
|
}
|
|
1272
|
+
console.log(`[Blueprint] Registered ${components.size} component(s)`);
|
|
668
1273
|
}
|
|
669
|
-
__name(
|
|
670
|
-
function
|
|
671
|
-
const
|
|
672
|
-
|
|
673
|
-
|
|
1274
|
+
__name(registerAllComponentNodes, "registerAllComponentNodes");
|
|
1275
|
+
function registerComponentNodes(componentClass) {
|
|
1276
|
+
const components = getRegisteredBlueprintComponents();
|
|
1277
|
+
const metadata = components.get(componentClass);
|
|
1278
|
+
if (!metadata) {
|
|
1279
|
+
console.warn(`[Blueprint] Component ${componentClass.name} is not marked with @BlueprintExpose`);
|
|
1280
|
+
return;
|
|
674
1281
|
}
|
|
1282
|
+
generateComponentNodes(componentClass, metadata);
|
|
1283
|
+
}
|
|
1284
|
+
__name(registerComponentNodes, "registerComponentNodes");
|
|
1285
|
+
|
|
1286
|
+
// src/runtime/BlueprintSystem.ts
|
|
1287
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
1288
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1289
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1290
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1291
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1292
|
+
}
|
|
1293
|
+
__name(_ts_decorate2, "_ts_decorate");
|
|
1294
|
+
function _ts_metadata(k, v) {
|
|
1295
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
675
1296
|
}
|
|
676
|
-
__name(
|
|
1297
|
+
__name(_ts_metadata, "_ts_metadata");
|
|
1298
|
+
var _BlueprintSystem = class _BlueprintSystem extends EntitySystem {
|
|
1299
|
+
constructor() {
|
|
1300
|
+
super(Matcher.all(BlueprintComponent));
|
|
1301
|
+
__publicField(this, "_componentsRegistered", false);
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* @zh 系统初始化时注册所有组件节点
|
|
1305
|
+
* @en Register all component nodes when system initializes
|
|
1306
|
+
*/
|
|
1307
|
+
onInitialize() {
|
|
1308
|
+
if (!this._componentsRegistered) {
|
|
1309
|
+
registerAllComponentNodes();
|
|
1310
|
+
this._componentsRegistered = true;
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
/**
|
|
1314
|
+
* @zh 处理所有带有蓝图组件的实体
|
|
1315
|
+
* @en Process all entities with blueprint components
|
|
1316
|
+
*/
|
|
1317
|
+
process(entities) {
|
|
1318
|
+
const dt = Time.deltaTime;
|
|
1319
|
+
for (const entity of entities) {
|
|
1320
|
+
const blueprint = entity.getComponent(BlueprintComponent);
|
|
1321
|
+
if (!blueprint?.blueprintAsset) continue;
|
|
1322
|
+
if (!blueprint.vm) {
|
|
1323
|
+
blueprint.initialize(entity, this.scene);
|
|
1324
|
+
}
|
|
1325
|
+
if (blueprint.autoStart && !blueprint.isStarted) {
|
|
1326
|
+
blueprint.start();
|
|
1327
|
+
}
|
|
1328
|
+
blueprint.tick(dt);
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
/**
|
|
1332
|
+
* @zh 实体移除时清理蓝图资源
|
|
1333
|
+
* @en Cleanup blueprint resources when entity is removed
|
|
1334
|
+
*/
|
|
1335
|
+
onRemoved(entity) {
|
|
1336
|
+
const blueprint = entity.getComponent(BlueprintComponent);
|
|
1337
|
+
if (blueprint) {
|
|
1338
|
+
blueprint.cleanup();
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
};
|
|
1342
|
+
__name(_BlueprintSystem, "BlueprintSystem");
|
|
1343
|
+
var BlueprintSystem = _BlueprintSystem;
|
|
1344
|
+
BlueprintSystem = _ts_decorate2([
|
|
1345
|
+
ECSSystem("BlueprintSystem"),
|
|
1346
|
+
_ts_metadata("design:type", Function),
|
|
1347
|
+
_ts_metadata("design:paramtypes", [])
|
|
1348
|
+
], BlueprintSystem);
|
|
677
1349
|
|
|
678
1350
|
// src/triggers/TriggerTypes.ts
|
|
679
1351
|
var TriggerTypes = {
|
|
@@ -2007,13 +2679,13 @@ function createFragmentRegistry() {
|
|
|
2007
2679
|
__name(createFragmentRegistry, "createFragmentRegistry");
|
|
2008
2680
|
|
|
2009
2681
|
// src/nodes/events/EventBeginPlay.ts
|
|
2010
|
-
function
|
|
2682
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
2011
2683
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2012
2684
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2013
2685
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2014
2686
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2015
2687
|
}
|
|
2016
|
-
__name(
|
|
2688
|
+
__name(_ts_decorate3, "_ts_decorate");
|
|
2017
2689
|
var EventBeginPlayTemplate = {
|
|
2018
2690
|
type: "EventBeginPlay",
|
|
2019
2691
|
title: "Event Begin Play",
|
|
@@ -2024,7 +2696,12 @@ var EventBeginPlayTemplate = {
|
|
|
2024
2696
|
"start",
|
|
2025
2697
|
"begin",
|
|
2026
2698
|
"init",
|
|
2027
|
-
"event"
|
|
2699
|
+
"event",
|
|
2700
|
+
"self"
|
|
2701
|
+
],
|
|
2702
|
+
menuPath: [
|
|
2703
|
+
"Events",
|
|
2704
|
+
"Begin Play"
|
|
2028
2705
|
],
|
|
2029
2706
|
inputs: [],
|
|
2030
2707
|
outputs: [
|
|
@@ -2032,30 +2709,38 @@ var EventBeginPlayTemplate = {
|
|
|
2032
2709
|
name: "exec",
|
|
2033
2710
|
type: "exec",
|
|
2034
2711
|
displayName: ""
|
|
2712
|
+
},
|
|
2713
|
+
{
|
|
2714
|
+
name: "self",
|
|
2715
|
+
type: "entity",
|
|
2716
|
+
displayName: "Self"
|
|
2035
2717
|
}
|
|
2036
2718
|
]
|
|
2037
2719
|
};
|
|
2038
2720
|
var _EventBeginPlayExecutor = class _EventBeginPlayExecutor {
|
|
2039
|
-
execute(_node,
|
|
2721
|
+
execute(_node, context) {
|
|
2040
2722
|
return {
|
|
2041
|
-
nextExec: "exec"
|
|
2723
|
+
nextExec: "exec",
|
|
2724
|
+
outputs: {
|
|
2725
|
+
self: context.entity
|
|
2726
|
+
}
|
|
2042
2727
|
};
|
|
2043
2728
|
}
|
|
2044
2729
|
};
|
|
2045
2730
|
__name(_EventBeginPlayExecutor, "EventBeginPlayExecutor");
|
|
2046
2731
|
var EventBeginPlayExecutor = _EventBeginPlayExecutor;
|
|
2047
|
-
EventBeginPlayExecutor =
|
|
2732
|
+
EventBeginPlayExecutor = _ts_decorate3([
|
|
2048
2733
|
RegisterNode(EventBeginPlayTemplate)
|
|
2049
2734
|
], EventBeginPlayExecutor);
|
|
2050
2735
|
|
|
2051
2736
|
// src/nodes/events/EventTick.ts
|
|
2052
|
-
function
|
|
2737
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
2053
2738
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2054
2739
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2055
2740
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2056
2741
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2057
2742
|
}
|
|
2058
|
-
__name(
|
|
2743
|
+
__name(_ts_decorate4, "_ts_decorate");
|
|
2059
2744
|
var EventTickTemplate = {
|
|
2060
2745
|
type: "EventTick",
|
|
2061
2746
|
title: "Event Tick",
|
|
@@ -2066,7 +2751,12 @@ var EventTickTemplate = {
|
|
|
2066
2751
|
"update",
|
|
2067
2752
|
"frame",
|
|
2068
2753
|
"tick",
|
|
2069
|
-
"event"
|
|
2754
|
+
"event",
|
|
2755
|
+
"self"
|
|
2756
|
+
],
|
|
2757
|
+
menuPath: [
|
|
2758
|
+
"Events",
|
|
2759
|
+
"Tick"
|
|
2070
2760
|
],
|
|
2071
2761
|
inputs: [],
|
|
2072
2762
|
outputs: [
|
|
@@ -2075,6 +2765,11 @@ var EventTickTemplate = {
|
|
|
2075
2765
|
type: "exec",
|
|
2076
2766
|
displayName: ""
|
|
2077
2767
|
},
|
|
2768
|
+
{
|
|
2769
|
+
name: "self",
|
|
2770
|
+
type: "entity",
|
|
2771
|
+
displayName: "Self"
|
|
2772
|
+
},
|
|
2078
2773
|
{
|
|
2079
2774
|
name: "deltaTime",
|
|
2080
2775
|
type: "float",
|
|
@@ -2087,6 +2782,7 @@ var _EventTickExecutor = class _EventTickExecutor {
|
|
|
2087
2782
|
return {
|
|
2088
2783
|
nextExec: "exec",
|
|
2089
2784
|
outputs: {
|
|
2785
|
+
self: context.entity,
|
|
2090
2786
|
deltaTime: context.deltaTime
|
|
2091
2787
|
}
|
|
2092
2788
|
};
|
|
@@ -2094,18 +2790,18 @@ var _EventTickExecutor = class _EventTickExecutor {
|
|
|
2094
2790
|
};
|
|
2095
2791
|
__name(_EventTickExecutor, "EventTickExecutor");
|
|
2096
2792
|
var EventTickExecutor = _EventTickExecutor;
|
|
2097
|
-
EventTickExecutor =
|
|
2793
|
+
EventTickExecutor = _ts_decorate4([
|
|
2098
2794
|
RegisterNode(EventTickTemplate)
|
|
2099
2795
|
], EventTickExecutor);
|
|
2100
2796
|
|
|
2101
2797
|
// src/nodes/events/EventEndPlay.ts
|
|
2102
|
-
function
|
|
2798
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
2103
2799
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2104
2800
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2105
2801
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2106
2802
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2107
2803
|
}
|
|
2108
|
-
__name(
|
|
2804
|
+
__name(_ts_decorate5, "_ts_decorate");
|
|
2109
2805
|
var EventEndPlayTemplate = {
|
|
2110
2806
|
type: "EventEndPlay",
|
|
2111
2807
|
title: "Event End Play",
|
|
@@ -2116,7 +2812,12 @@ var EventEndPlayTemplate = {
|
|
|
2116
2812
|
"stop",
|
|
2117
2813
|
"end",
|
|
2118
2814
|
"destroy",
|
|
2119
|
-
"event"
|
|
2815
|
+
"event",
|
|
2816
|
+
"self"
|
|
2817
|
+
],
|
|
2818
|
+
menuPath: [
|
|
2819
|
+
"Events",
|
|
2820
|
+
"End Play"
|
|
2120
2821
|
],
|
|
2121
2822
|
inputs: [],
|
|
2122
2823
|
outputs: [
|
|
@@ -2124,539 +2825,521 @@ var EventEndPlayTemplate = {
|
|
|
2124
2825
|
name: "exec",
|
|
2125
2826
|
type: "exec",
|
|
2126
2827
|
displayName: ""
|
|
2828
|
+
},
|
|
2829
|
+
{
|
|
2830
|
+
name: "self",
|
|
2831
|
+
type: "entity",
|
|
2832
|
+
displayName: "Self"
|
|
2127
2833
|
}
|
|
2128
2834
|
]
|
|
2129
2835
|
};
|
|
2130
2836
|
var _EventEndPlayExecutor = class _EventEndPlayExecutor {
|
|
2131
|
-
execute(_node,
|
|
2837
|
+
execute(_node, context) {
|
|
2132
2838
|
return {
|
|
2133
|
-
nextExec: "exec"
|
|
2839
|
+
nextExec: "exec",
|
|
2840
|
+
outputs: {
|
|
2841
|
+
self: context.entity
|
|
2842
|
+
}
|
|
2134
2843
|
};
|
|
2135
2844
|
}
|
|
2136
2845
|
};
|
|
2137
2846
|
__name(_EventEndPlayExecutor, "EventEndPlayExecutor");
|
|
2138
2847
|
var EventEndPlayExecutor = _EventEndPlayExecutor;
|
|
2139
|
-
EventEndPlayExecutor =
|
|
2848
|
+
EventEndPlayExecutor = _ts_decorate5([
|
|
2140
2849
|
RegisterNode(EventEndPlayTemplate)
|
|
2141
2850
|
], EventEndPlayExecutor);
|
|
2142
2851
|
|
|
2143
|
-
// src/nodes/
|
|
2144
|
-
function
|
|
2852
|
+
// src/nodes/ecs/EntityNodes.ts
|
|
2853
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
2145
2854
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2146
2855
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2147
2856
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2148
2857
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2149
2858
|
}
|
|
2150
|
-
__name(
|
|
2151
|
-
var
|
|
2152
|
-
type: "
|
|
2153
|
-
title: "
|
|
2154
|
-
category: "
|
|
2155
|
-
color: "#
|
|
2156
|
-
|
|
2859
|
+
__name(_ts_decorate6, "_ts_decorate");
|
|
2860
|
+
var GetSelfTemplate = {
|
|
2861
|
+
type: "ECS_GetSelf",
|
|
2862
|
+
title: "Get Self",
|
|
2863
|
+
category: "entity",
|
|
2864
|
+
color: "#1e5a8b",
|
|
2865
|
+
isPure: true,
|
|
2866
|
+
description: "Gets the entity that owns this blueprint (\u83B7\u53D6\u62E5\u6709\u6B64\u84DD\u56FE\u7684\u5B9E\u4F53)",
|
|
2157
2867
|
keywords: [
|
|
2158
|
-
"
|
|
2159
|
-
"
|
|
2160
|
-
"
|
|
2161
|
-
"
|
|
2162
|
-
"
|
|
2868
|
+
"self",
|
|
2869
|
+
"this",
|
|
2870
|
+
"owner",
|
|
2871
|
+
"entity",
|
|
2872
|
+
"me"
|
|
2163
2873
|
],
|
|
2164
2874
|
menuPath: [
|
|
2165
|
-
"
|
|
2166
|
-
"
|
|
2875
|
+
"ECS",
|
|
2876
|
+
"Entity",
|
|
2877
|
+
"Get Self"
|
|
2167
2878
|
],
|
|
2168
|
-
inputs: [
|
|
2879
|
+
inputs: [],
|
|
2880
|
+
outputs: [
|
|
2169
2881
|
{
|
|
2170
|
-
name: "
|
|
2171
|
-
type: "
|
|
2172
|
-
displayName: "
|
|
2173
|
-
defaultValue: ""
|
|
2882
|
+
name: "entity",
|
|
2883
|
+
type: "entity",
|
|
2884
|
+
displayName: "Self"
|
|
2174
2885
|
}
|
|
2886
|
+
]
|
|
2887
|
+
};
|
|
2888
|
+
var _GetSelfExecutor = class _GetSelfExecutor {
|
|
2889
|
+
execute(_node, context) {
|
|
2890
|
+
return {
|
|
2891
|
+
outputs: {
|
|
2892
|
+
entity: context.entity
|
|
2893
|
+
}
|
|
2894
|
+
};
|
|
2895
|
+
}
|
|
2896
|
+
};
|
|
2897
|
+
__name(_GetSelfExecutor, "GetSelfExecutor");
|
|
2898
|
+
var GetSelfExecutor = _GetSelfExecutor;
|
|
2899
|
+
GetSelfExecutor = _ts_decorate6([
|
|
2900
|
+
RegisterNode(GetSelfTemplate)
|
|
2901
|
+
], GetSelfExecutor);
|
|
2902
|
+
var CreateEntityTemplate = {
|
|
2903
|
+
type: "ECS_CreateEntity",
|
|
2904
|
+
title: "Create Entity",
|
|
2905
|
+
category: "entity",
|
|
2906
|
+
color: "#1e5a8b",
|
|
2907
|
+
description: "Creates a new entity in the scene (\u5728\u573A\u666F\u4E2D\u521B\u5EFA\u65B0\u5B9E\u4F53)",
|
|
2908
|
+
keywords: [
|
|
2909
|
+
"entity",
|
|
2910
|
+
"create",
|
|
2911
|
+
"spawn",
|
|
2912
|
+
"new",
|
|
2913
|
+
"instantiate"
|
|
2175
2914
|
],
|
|
2176
|
-
|
|
2915
|
+
menuPath: [
|
|
2916
|
+
"ECS",
|
|
2917
|
+
"Entity",
|
|
2918
|
+
"Create Entity"
|
|
2919
|
+
],
|
|
2920
|
+
inputs: [
|
|
2177
2921
|
{
|
|
2178
2922
|
name: "exec",
|
|
2179
2923
|
type: "exec",
|
|
2180
2924
|
displayName: ""
|
|
2181
2925
|
},
|
|
2182
2926
|
{
|
|
2183
|
-
name: "
|
|
2927
|
+
name: "name",
|
|
2184
2928
|
type: "string",
|
|
2185
|
-
displayName: "
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
displayName: "Value"
|
|
2191
|
-
},
|
|
2929
|
+
displayName: "Name",
|
|
2930
|
+
defaultValue: "NewEntity"
|
|
2931
|
+
}
|
|
2932
|
+
],
|
|
2933
|
+
outputs: [
|
|
2192
2934
|
{
|
|
2193
|
-
name: "
|
|
2194
|
-
type: "
|
|
2195
|
-
displayName: "
|
|
2935
|
+
name: "exec",
|
|
2936
|
+
type: "exec",
|
|
2937
|
+
displayName: ""
|
|
2196
2938
|
},
|
|
2197
2939
|
{
|
|
2198
|
-
name: "
|
|
2199
|
-
type: "
|
|
2200
|
-
displayName: "
|
|
2940
|
+
name: "entity",
|
|
2941
|
+
type: "entity",
|
|
2942
|
+
displayName: "Entity"
|
|
2201
2943
|
}
|
|
2202
2944
|
]
|
|
2203
2945
|
};
|
|
2204
|
-
var
|
|
2205
|
-
execute(node,
|
|
2946
|
+
var _CreateEntityExecutor = class _CreateEntityExecutor {
|
|
2947
|
+
execute(node, context) {
|
|
2948
|
+
const name = context.evaluateInput(node.id, "name", "NewEntity");
|
|
2949
|
+
const entity = context.scene.createEntity(name);
|
|
2206
2950
|
return {
|
|
2207
|
-
nextExec: "exec",
|
|
2208
2951
|
outputs: {
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
released: false
|
|
2213
|
-
}
|
|
2952
|
+
entity
|
|
2953
|
+
},
|
|
2954
|
+
nextExec: "exec"
|
|
2214
2955
|
};
|
|
2215
2956
|
}
|
|
2216
2957
|
};
|
|
2217
|
-
__name(
|
|
2218
|
-
var
|
|
2219
|
-
|
|
2220
|
-
RegisterNode(
|
|
2221
|
-
],
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2229
|
-
}
|
|
2230
|
-
__name(_ts_decorate5, "_ts_decorate");
|
|
2231
|
-
var EventCollisionEnterTemplate = {
|
|
2232
|
-
type: "EventCollisionEnter",
|
|
2233
|
-
title: "Event Collision Enter",
|
|
2234
|
-
category: "event",
|
|
2235
|
-
color: "#CC0000",
|
|
2236
|
-
description: "Triggered when collision starts / \u78B0\u649E\u5F00\u59CB\u65F6\u89E6\u53D1",
|
|
2958
|
+
__name(_CreateEntityExecutor, "CreateEntityExecutor");
|
|
2959
|
+
var CreateEntityExecutor = _CreateEntityExecutor;
|
|
2960
|
+
CreateEntityExecutor = _ts_decorate6([
|
|
2961
|
+
RegisterNode(CreateEntityTemplate)
|
|
2962
|
+
], CreateEntityExecutor);
|
|
2963
|
+
var DestroyEntityTemplate = {
|
|
2964
|
+
type: "ECS_DestroyEntity",
|
|
2965
|
+
title: "Destroy Entity",
|
|
2966
|
+
category: "entity",
|
|
2967
|
+
color: "#8b1e1e",
|
|
2968
|
+
description: "Destroys an entity from the scene (\u4ECE\u573A\u666F\u4E2D\u9500\u6BC1\u5B9E\u4F53)",
|
|
2237
2969
|
keywords: [
|
|
2238
|
-
"
|
|
2239
|
-
"
|
|
2240
|
-
"
|
|
2241
|
-
"
|
|
2242
|
-
"
|
|
2970
|
+
"entity",
|
|
2971
|
+
"destroy",
|
|
2972
|
+
"remove",
|
|
2973
|
+
"delete",
|
|
2974
|
+
"kill"
|
|
2243
2975
|
],
|
|
2244
2976
|
menuPath: [
|
|
2245
|
-
"
|
|
2246
|
-
"
|
|
2247
|
-
"
|
|
2977
|
+
"ECS",
|
|
2978
|
+
"Entity",
|
|
2979
|
+
"Destroy Entity"
|
|
2248
2980
|
],
|
|
2249
|
-
inputs: [
|
|
2250
|
-
outputs: [
|
|
2981
|
+
inputs: [
|
|
2251
2982
|
{
|
|
2252
2983
|
name: "exec",
|
|
2253
2984
|
type: "exec",
|
|
2254
2985
|
displayName: ""
|
|
2255
2986
|
},
|
|
2256
2987
|
{
|
|
2257
|
-
name: "
|
|
2258
|
-
type: "
|
|
2259
|
-
displayName: "
|
|
2260
|
-
}
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
type: "float",
|
|
2264
|
-
displayName: "Point X"
|
|
2265
|
-
},
|
|
2266
|
-
{
|
|
2267
|
-
name: "pointY",
|
|
2268
|
-
type: "float",
|
|
2269
|
-
displayName: "Point Y"
|
|
2270
|
-
},
|
|
2271
|
-
{
|
|
2272
|
-
name: "normalX",
|
|
2273
|
-
type: "float",
|
|
2274
|
-
displayName: "Normal X"
|
|
2275
|
-
},
|
|
2988
|
+
name: "entity",
|
|
2989
|
+
type: "entity",
|
|
2990
|
+
displayName: "Entity"
|
|
2991
|
+
}
|
|
2992
|
+
],
|
|
2993
|
+
outputs: [
|
|
2276
2994
|
{
|
|
2277
|
-
name: "
|
|
2278
|
-
type: "
|
|
2279
|
-
displayName: "
|
|
2995
|
+
name: "exec",
|
|
2996
|
+
type: "exec",
|
|
2997
|
+
displayName: ""
|
|
2280
2998
|
}
|
|
2281
2999
|
]
|
|
2282
3000
|
};
|
|
2283
|
-
var
|
|
2284
|
-
execute(
|
|
3001
|
+
var _DestroyEntityExecutor = class _DestroyEntityExecutor {
|
|
3002
|
+
execute(node, context) {
|
|
3003
|
+
const entity = context.evaluateInput(node.id, "entity", null);
|
|
3004
|
+
if (entity && !entity.isDestroyed) {
|
|
3005
|
+
entity.destroy();
|
|
3006
|
+
}
|
|
2285
3007
|
return {
|
|
2286
|
-
nextExec: "exec"
|
|
2287
|
-
outputs: {
|
|
2288
|
-
otherEntityId: "",
|
|
2289
|
-
pointX: 0,
|
|
2290
|
-
pointY: 0,
|
|
2291
|
-
normalX: 0,
|
|
2292
|
-
normalY: 0
|
|
2293
|
-
}
|
|
3008
|
+
nextExec: "exec"
|
|
2294
3009
|
};
|
|
2295
3010
|
}
|
|
2296
3011
|
};
|
|
2297
|
-
__name(
|
|
2298
|
-
var
|
|
2299
|
-
|
|
2300
|
-
RegisterNode(
|
|
2301
|
-
],
|
|
2302
|
-
var
|
|
2303
|
-
type: "
|
|
2304
|
-
title: "
|
|
2305
|
-
category: "
|
|
2306
|
-
color: "#
|
|
2307
|
-
description: "
|
|
3012
|
+
__name(_DestroyEntityExecutor, "DestroyEntityExecutor");
|
|
3013
|
+
var DestroyEntityExecutor = _DestroyEntityExecutor;
|
|
3014
|
+
DestroyEntityExecutor = _ts_decorate6([
|
|
3015
|
+
RegisterNode(DestroyEntityTemplate)
|
|
3016
|
+
], DestroyEntityExecutor);
|
|
3017
|
+
var DestroySelfTemplate = {
|
|
3018
|
+
type: "ECS_DestroySelf",
|
|
3019
|
+
title: "Destroy Self",
|
|
3020
|
+
category: "entity",
|
|
3021
|
+
color: "#8b1e1e",
|
|
3022
|
+
description: "Destroys the entity that owns this blueprint (\u9500\u6BC1\u62E5\u6709\u6B64\u84DD\u56FE\u7684\u5B9E\u4F53)",
|
|
2308
3023
|
keywords: [
|
|
2309
|
-
"
|
|
2310
|
-
"
|
|
2311
|
-
"
|
|
2312
|
-
"
|
|
2313
|
-
"
|
|
3024
|
+
"self",
|
|
3025
|
+
"destroy",
|
|
3026
|
+
"suicide",
|
|
3027
|
+
"remove",
|
|
3028
|
+
"delete"
|
|
2314
3029
|
],
|
|
2315
3030
|
menuPath: [
|
|
2316
|
-
"
|
|
2317
|
-
"
|
|
2318
|
-
"
|
|
3031
|
+
"ECS",
|
|
3032
|
+
"Entity",
|
|
3033
|
+
"Destroy Self"
|
|
2319
3034
|
],
|
|
2320
|
-
inputs: [
|
|
2321
|
-
outputs: [
|
|
3035
|
+
inputs: [
|
|
2322
3036
|
{
|
|
2323
3037
|
name: "exec",
|
|
2324
3038
|
type: "exec",
|
|
2325
3039
|
displayName: ""
|
|
2326
|
-
},
|
|
2327
|
-
{
|
|
2328
|
-
name: "otherEntityId",
|
|
2329
|
-
type: "string",
|
|
2330
|
-
displayName: "Other Entity"
|
|
2331
3040
|
}
|
|
2332
|
-
]
|
|
3041
|
+
],
|
|
3042
|
+
outputs: []
|
|
2333
3043
|
};
|
|
2334
|
-
var
|
|
2335
|
-
execute(_node) {
|
|
3044
|
+
var _DestroySelfExecutor = class _DestroySelfExecutor {
|
|
3045
|
+
execute(_node, context) {
|
|
3046
|
+
if (!context.entity.isDestroyed) {
|
|
3047
|
+
context.entity.destroy();
|
|
3048
|
+
}
|
|
2336
3049
|
return {
|
|
2337
|
-
nextExec:
|
|
2338
|
-
outputs: {
|
|
2339
|
-
otherEntityId: ""
|
|
2340
|
-
}
|
|
3050
|
+
nextExec: null
|
|
2341
3051
|
};
|
|
2342
3052
|
}
|
|
2343
3053
|
};
|
|
2344
|
-
__name(
|
|
2345
|
-
var
|
|
2346
|
-
|
|
2347
|
-
RegisterNode(
|
|
2348
|
-
],
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
}
|
|
2357
|
-
__name(_ts_decorate6, "_ts_decorate");
|
|
2358
|
-
var EventMessageTemplate = {
|
|
2359
|
-
type: "EventMessage",
|
|
2360
|
-
title: "Event Message",
|
|
2361
|
-
category: "event",
|
|
2362
|
-
color: "#CC0000",
|
|
2363
|
-
description: "Triggered when a message is received / \u63A5\u6536\u5230\u6D88\u606F\u65F6\u89E6\u53D1",
|
|
3054
|
+
__name(_DestroySelfExecutor, "DestroySelfExecutor");
|
|
3055
|
+
var DestroySelfExecutor = _DestroySelfExecutor;
|
|
3056
|
+
DestroySelfExecutor = _ts_decorate6([
|
|
3057
|
+
RegisterNode(DestroySelfTemplate)
|
|
3058
|
+
], DestroySelfExecutor);
|
|
3059
|
+
var IsValidTemplate = {
|
|
3060
|
+
type: "ECS_IsValid",
|
|
3061
|
+
title: "Is Valid",
|
|
3062
|
+
category: "entity",
|
|
3063
|
+
color: "#1e5a8b",
|
|
3064
|
+
isPure: true,
|
|
3065
|
+
description: "Checks if an entity reference is valid and not destroyed (\u68C0\u67E5\u5B9E\u4F53\u5F15\u7528\u662F\u5426\u6709\u6548\u4E14\u672A\u88AB\u9500\u6BC1)",
|
|
2364
3066
|
keywords: [
|
|
2365
|
-
"
|
|
2366
|
-
"
|
|
2367
|
-
"
|
|
2368
|
-
"
|
|
2369
|
-
"
|
|
3067
|
+
"entity",
|
|
3068
|
+
"valid",
|
|
3069
|
+
"null",
|
|
3070
|
+
"check",
|
|
3071
|
+
"exists",
|
|
3072
|
+
"alive"
|
|
2370
3073
|
],
|
|
2371
3074
|
menuPath: [
|
|
2372
|
-
"
|
|
2373
|
-
"
|
|
3075
|
+
"ECS",
|
|
3076
|
+
"Entity",
|
|
3077
|
+
"Is Valid"
|
|
2374
3078
|
],
|
|
2375
3079
|
inputs: [
|
|
2376
3080
|
{
|
|
2377
|
-
name: "
|
|
2378
|
-
type: "
|
|
2379
|
-
displayName: "
|
|
2380
|
-
defaultValue: ""
|
|
3081
|
+
name: "entity",
|
|
3082
|
+
type: "entity",
|
|
3083
|
+
displayName: "Entity"
|
|
2381
3084
|
}
|
|
2382
3085
|
],
|
|
2383
3086
|
outputs: [
|
|
2384
3087
|
{
|
|
2385
|
-
name: "
|
|
2386
|
-
type: "
|
|
2387
|
-
displayName: ""
|
|
2388
|
-
},
|
|
2389
|
-
{
|
|
2390
|
-
name: "messageName",
|
|
2391
|
-
type: "string",
|
|
2392
|
-
displayName: "Message"
|
|
2393
|
-
},
|
|
2394
|
-
{
|
|
2395
|
-
name: "senderId",
|
|
2396
|
-
type: "string",
|
|
2397
|
-
displayName: "Sender ID"
|
|
2398
|
-
},
|
|
2399
|
-
{
|
|
2400
|
-
name: "payload",
|
|
2401
|
-
type: "any",
|
|
2402
|
-
displayName: "Payload"
|
|
3088
|
+
name: "isValid",
|
|
3089
|
+
type: "bool",
|
|
3090
|
+
displayName: "Is Valid"
|
|
2403
3091
|
}
|
|
2404
3092
|
]
|
|
2405
3093
|
};
|
|
2406
|
-
var
|
|
2407
|
-
execute(node) {
|
|
3094
|
+
var _IsValidExecutor = class _IsValidExecutor {
|
|
3095
|
+
execute(node, context) {
|
|
3096
|
+
const entity = context.evaluateInput(node.id, "entity", null);
|
|
3097
|
+
const isValid = entity != null && !entity.isDestroyed;
|
|
2408
3098
|
return {
|
|
2409
|
-
nextExec: "exec",
|
|
2410
3099
|
outputs: {
|
|
2411
|
-
|
|
2412
|
-
senderId: "",
|
|
2413
|
-
payload: null
|
|
3100
|
+
isValid
|
|
2414
3101
|
}
|
|
2415
3102
|
};
|
|
2416
3103
|
}
|
|
2417
3104
|
};
|
|
2418
|
-
__name(
|
|
2419
|
-
var
|
|
2420
|
-
|
|
2421
|
-
RegisterNode(
|
|
2422
|
-
],
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
}
|
|
2431
|
-
__name(_ts_decorate7, "_ts_decorate");
|
|
2432
|
-
var EventTimerTemplate = {
|
|
2433
|
-
type: "EventTimer",
|
|
2434
|
-
title: "Event Timer",
|
|
2435
|
-
category: "event",
|
|
2436
|
-
color: "#CC0000",
|
|
2437
|
-
description: "Triggered when a timer fires / \u5B9A\u65F6\u5668\u89E6\u53D1\u65F6\u6267\u884C",
|
|
3105
|
+
__name(_IsValidExecutor, "IsValidExecutor");
|
|
3106
|
+
var IsValidExecutor = _IsValidExecutor;
|
|
3107
|
+
IsValidExecutor = _ts_decorate6([
|
|
3108
|
+
RegisterNode(IsValidTemplate)
|
|
3109
|
+
], IsValidExecutor);
|
|
3110
|
+
var GetEntityNameTemplate = {
|
|
3111
|
+
type: "ECS_GetEntityName",
|
|
3112
|
+
title: "Get Entity Name",
|
|
3113
|
+
category: "entity",
|
|
3114
|
+
color: "#1e5a8b",
|
|
3115
|
+
isPure: true,
|
|
3116
|
+
description: "Gets the name of an entity (\u83B7\u53D6\u5B9E\u4F53\u7684\u540D\u79F0)",
|
|
2438
3117
|
keywords: [
|
|
2439
|
-
"
|
|
2440
|
-
"
|
|
2441
|
-
"
|
|
2442
|
-
"
|
|
2443
|
-
"interval"
|
|
3118
|
+
"entity",
|
|
3119
|
+
"name",
|
|
3120
|
+
"get",
|
|
3121
|
+
"string"
|
|
2444
3122
|
],
|
|
2445
3123
|
menuPath: [
|
|
2446
|
-
"
|
|
2447
|
-
"
|
|
3124
|
+
"ECS",
|
|
3125
|
+
"Entity",
|
|
3126
|
+
"Get Name"
|
|
2448
3127
|
],
|
|
2449
3128
|
inputs: [
|
|
2450
3129
|
{
|
|
2451
|
-
name: "
|
|
2452
|
-
type: "
|
|
2453
|
-
displayName: "
|
|
2454
|
-
defaultValue: ""
|
|
3130
|
+
name: "entity",
|
|
3131
|
+
type: "entity",
|
|
3132
|
+
displayName: "Entity"
|
|
2455
3133
|
}
|
|
2456
3134
|
],
|
|
2457
3135
|
outputs: [
|
|
2458
3136
|
{
|
|
2459
|
-
name: "
|
|
2460
|
-
type: "exec",
|
|
2461
|
-
displayName: ""
|
|
2462
|
-
},
|
|
2463
|
-
{
|
|
2464
|
-
name: "timerId",
|
|
3137
|
+
name: "name",
|
|
2465
3138
|
type: "string",
|
|
2466
|
-
displayName: "
|
|
2467
|
-
},
|
|
2468
|
-
{
|
|
2469
|
-
name: "isRepeating",
|
|
2470
|
-
type: "bool",
|
|
2471
|
-
displayName: "Is Repeating"
|
|
2472
|
-
},
|
|
2473
|
-
{
|
|
2474
|
-
name: "timesFired",
|
|
2475
|
-
type: "int",
|
|
2476
|
-
displayName: "Times Fired"
|
|
3139
|
+
displayName: "Name"
|
|
2477
3140
|
}
|
|
2478
3141
|
]
|
|
2479
3142
|
};
|
|
2480
|
-
var
|
|
2481
|
-
execute(node) {
|
|
3143
|
+
var _GetEntityNameExecutor = class _GetEntityNameExecutor {
|
|
3144
|
+
execute(node, context) {
|
|
3145
|
+
const entity = context.evaluateInput(node.id, "entity", context.entity);
|
|
2482
3146
|
return {
|
|
2483
|
-
nextExec: "exec",
|
|
2484
3147
|
outputs: {
|
|
2485
|
-
|
|
2486
|
-
isRepeating: false,
|
|
2487
|
-
timesFired: 0
|
|
3148
|
+
name: entity?.name ?? ""
|
|
2488
3149
|
}
|
|
2489
3150
|
};
|
|
2490
3151
|
}
|
|
2491
3152
|
};
|
|
2492
|
-
__name(
|
|
2493
|
-
var
|
|
2494
|
-
|
|
2495
|
-
RegisterNode(
|
|
2496
|
-
],
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2504
|
-
}
|
|
2505
|
-
__name(_ts_decorate8, "_ts_decorate");
|
|
2506
|
-
var EventStateEnterTemplate = {
|
|
2507
|
-
type: "EventStateEnter",
|
|
2508
|
-
title: "Event State Enter",
|
|
2509
|
-
category: "event",
|
|
2510
|
-
color: "#CC0000",
|
|
2511
|
-
description: "Triggered when entering a state / \u8FDB\u5165\u72B6\u6001\u65F6\u89E6\u53D1",
|
|
3153
|
+
__name(_GetEntityNameExecutor, "GetEntityNameExecutor");
|
|
3154
|
+
var GetEntityNameExecutor = _GetEntityNameExecutor;
|
|
3155
|
+
GetEntityNameExecutor = _ts_decorate6([
|
|
3156
|
+
RegisterNode(GetEntityNameTemplate)
|
|
3157
|
+
], GetEntityNameExecutor);
|
|
3158
|
+
var SetEntityNameTemplate = {
|
|
3159
|
+
type: "ECS_SetEntityName",
|
|
3160
|
+
title: "Set Entity Name",
|
|
3161
|
+
category: "entity",
|
|
3162
|
+
color: "#1e5a8b",
|
|
3163
|
+
description: "Sets the name of an entity (\u8BBE\u7F6E\u5B9E\u4F53\u7684\u540D\u79F0)",
|
|
2512
3164
|
keywords: [
|
|
2513
|
-
"
|
|
2514
|
-
"
|
|
2515
|
-
"
|
|
2516
|
-
"
|
|
2517
|
-
"event"
|
|
3165
|
+
"entity",
|
|
3166
|
+
"name",
|
|
3167
|
+
"set",
|
|
3168
|
+
"rename"
|
|
2518
3169
|
],
|
|
2519
3170
|
menuPath: [
|
|
2520
|
-
"
|
|
2521
|
-
"
|
|
2522
|
-
"
|
|
3171
|
+
"ECS",
|
|
3172
|
+
"Entity",
|
|
3173
|
+
"Set Name"
|
|
2523
3174
|
],
|
|
2524
3175
|
inputs: [
|
|
2525
|
-
{
|
|
2526
|
-
name: "stateName",
|
|
2527
|
-
type: "string",
|
|
2528
|
-
displayName: "State Name",
|
|
2529
|
-
defaultValue: ""
|
|
2530
|
-
}
|
|
2531
|
-
],
|
|
2532
|
-
outputs: [
|
|
2533
3176
|
{
|
|
2534
3177
|
name: "exec",
|
|
2535
3178
|
type: "exec",
|
|
2536
3179
|
displayName: ""
|
|
2537
3180
|
},
|
|
2538
3181
|
{
|
|
2539
|
-
name: "
|
|
2540
|
-
type: "
|
|
2541
|
-
displayName: "
|
|
3182
|
+
name: "entity",
|
|
3183
|
+
type: "entity",
|
|
3184
|
+
displayName: "Entity"
|
|
2542
3185
|
},
|
|
2543
3186
|
{
|
|
2544
|
-
name: "
|
|
3187
|
+
name: "name",
|
|
2545
3188
|
type: "string",
|
|
2546
|
-
displayName: "
|
|
2547
|
-
|
|
3189
|
+
displayName: "Name",
|
|
3190
|
+
defaultValue: ""
|
|
3191
|
+
}
|
|
3192
|
+
],
|
|
3193
|
+
outputs: [
|
|
2548
3194
|
{
|
|
2549
|
-
name: "
|
|
2550
|
-
type: "
|
|
2551
|
-
displayName: "
|
|
3195
|
+
name: "exec",
|
|
3196
|
+
type: "exec",
|
|
3197
|
+
displayName: ""
|
|
2552
3198
|
}
|
|
2553
3199
|
]
|
|
2554
3200
|
};
|
|
2555
|
-
var
|
|
2556
|
-
execute(node) {
|
|
3201
|
+
var _SetEntityNameExecutor = class _SetEntityNameExecutor {
|
|
3202
|
+
execute(node, context) {
|
|
3203
|
+
const entity = context.evaluateInput(node.id, "entity", context.entity);
|
|
3204
|
+
const name = context.evaluateInput(node.id, "name", "");
|
|
3205
|
+
if (entity && !entity.isDestroyed) {
|
|
3206
|
+
entity.name = name;
|
|
3207
|
+
}
|
|
2557
3208
|
return {
|
|
2558
|
-
nextExec: "exec"
|
|
2559
|
-
outputs: {
|
|
2560
|
-
stateMachineId: "",
|
|
2561
|
-
currentState: node.data?.stateName ?? "",
|
|
2562
|
-
previousState: ""
|
|
2563
|
-
}
|
|
3209
|
+
nextExec: "exec"
|
|
2564
3210
|
};
|
|
2565
3211
|
}
|
|
2566
3212
|
};
|
|
2567
|
-
__name(
|
|
2568
|
-
var
|
|
2569
|
-
|
|
2570
|
-
RegisterNode(
|
|
2571
|
-
],
|
|
2572
|
-
var
|
|
2573
|
-
type: "
|
|
2574
|
-
title: "
|
|
2575
|
-
category: "
|
|
2576
|
-
color: "#
|
|
2577
|
-
|
|
3213
|
+
__name(_SetEntityNameExecutor, "SetEntityNameExecutor");
|
|
3214
|
+
var SetEntityNameExecutor = _SetEntityNameExecutor;
|
|
3215
|
+
SetEntityNameExecutor = _ts_decorate6([
|
|
3216
|
+
RegisterNode(SetEntityNameTemplate)
|
|
3217
|
+
], SetEntityNameExecutor);
|
|
3218
|
+
var GetEntityTagTemplate = {
|
|
3219
|
+
type: "ECS_GetEntityTag",
|
|
3220
|
+
title: "Get Entity Tag",
|
|
3221
|
+
category: "entity",
|
|
3222
|
+
color: "#1e5a8b",
|
|
3223
|
+
isPure: true,
|
|
3224
|
+
description: "Gets the tag of an entity (\u83B7\u53D6\u5B9E\u4F53\u7684\u6807\u7B7E)",
|
|
2578
3225
|
keywords: [
|
|
2579
|
-
"
|
|
2580
|
-
"
|
|
2581
|
-
"
|
|
2582
|
-
"
|
|
2583
|
-
"machine",
|
|
2584
|
-
"event"
|
|
3226
|
+
"entity",
|
|
3227
|
+
"tag",
|
|
3228
|
+
"get",
|
|
3229
|
+
"category"
|
|
2585
3230
|
],
|
|
2586
3231
|
menuPath: [
|
|
2587
|
-
"
|
|
2588
|
-
"
|
|
2589
|
-
"
|
|
3232
|
+
"ECS",
|
|
3233
|
+
"Entity",
|
|
3234
|
+
"Get Tag"
|
|
2590
3235
|
],
|
|
2591
3236
|
inputs: [
|
|
2592
3237
|
{
|
|
2593
|
-
name: "
|
|
2594
|
-
type: "
|
|
2595
|
-
displayName: "
|
|
2596
|
-
defaultValue: ""
|
|
3238
|
+
name: "entity",
|
|
3239
|
+
type: "entity",
|
|
3240
|
+
displayName: "Entity"
|
|
2597
3241
|
}
|
|
2598
3242
|
],
|
|
2599
3243
|
outputs: [
|
|
3244
|
+
{
|
|
3245
|
+
name: "tag",
|
|
3246
|
+
type: "int",
|
|
3247
|
+
displayName: "Tag"
|
|
3248
|
+
}
|
|
3249
|
+
]
|
|
3250
|
+
};
|
|
3251
|
+
var _GetEntityTagExecutor = class _GetEntityTagExecutor {
|
|
3252
|
+
execute(node, context) {
|
|
3253
|
+
const entity = context.evaluateInput(node.id, "entity", context.entity);
|
|
3254
|
+
return {
|
|
3255
|
+
outputs: {
|
|
3256
|
+
tag: entity?.tag ?? 0
|
|
3257
|
+
}
|
|
3258
|
+
};
|
|
3259
|
+
}
|
|
3260
|
+
};
|
|
3261
|
+
__name(_GetEntityTagExecutor, "GetEntityTagExecutor");
|
|
3262
|
+
var GetEntityTagExecutor = _GetEntityTagExecutor;
|
|
3263
|
+
GetEntityTagExecutor = _ts_decorate6([
|
|
3264
|
+
RegisterNode(GetEntityTagTemplate)
|
|
3265
|
+
], GetEntityTagExecutor);
|
|
3266
|
+
var SetEntityTagTemplate = {
|
|
3267
|
+
type: "ECS_SetEntityTag",
|
|
3268
|
+
title: "Set Entity Tag",
|
|
3269
|
+
category: "entity",
|
|
3270
|
+
color: "#1e5a8b",
|
|
3271
|
+
description: "Sets the tag of an entity (\u8BBE\u7F6E\u5B9E\u4F53\u7684\u6807\u7B7E)",
|
|
3272
|
+
keywords: [
|
|
3273
|
+
"entity",
|
|
3274
|
+
"tag",
|
|
3275
|
+
"set",
|
|
3276
|
+
"category"
|
|
3277
|
+
],
|
|
3278
|
+
menuPath: [
|
|
3279
|
+
"ECS",
|
|
3280
|
+
"Entity",
|
|
3281
|
+
"Set Tag"
|
|
3282
|
+
],
|
|
3283
|
+
inputs: [
|
|
2600
3284
|
{
|
|
2601
3285
|
name: "exec",
|
|
2602
3286
|
type: "exec",
|
|
2603
3287
|
displayName: ""
|
|
2604
3288
|
},
|
|
2605
3289
|
{
|
|
2606
|
-
name: "
|
|
2607
|
-
type: "
|
|
2608
|
-
displayName: "
|
|
3290
|
+
name: "entity",
|
|
3291
|
+
type: "entity",
|
|
3292
|
+
displayName: "Entity"
|
|
2609
3293
|
},
|
|
2610
3294
|
{
|
|
2611
|
-
name: "
|
|
2612
|
-
type: "
|
|
2613
|
-
displayName: "
|
|
2614
|
-
|
|
3295
|
+
name: "tag",
|
|
3296
|
+
type: "int",
|
|
3297
|
+
displayName: "Tag",
|
|
3298
|
+
defaultValue: 0
|
|
3299
|
+
}
|
|
3300
|
+
],
|
|
3301
|
+
outputs: [
|
|
2615
3302
|
{
|
|
2616
|
-
name: "
|
|
2617
|
-
type: "
|
|
2618
|
-
displayName: "
|
|
3303
|
+
name: "exec",
|
|
3304
|
+
type: "exec",
|
|
3305
|
+
displayName: ""
|
|
2619
3306
|
}
|
|
2620
3307
|
]
|
|
2621
3308
|
};
|
|
2622
|
-
var
|
|
2623
|
-
execute(node) {
|
|
3309
|
+
var _SetEntityTagExecutor = class _SetEntityTagExecutor {
|
|
3310
|
+
execute(node, context) {
|
|
3311
|
+
const entity = context.evaluateInput(node.id, "entity", context.entity);
|
|
3312
|
+
const tag = context.evaluateInput(node.id, "tag", 0);
|
|
3313
|
+
if (entity && !entity.isDestroyed) {
|
|
3314
|
+
entity.tag = tag;
|
|
3315
|
+
}
|
|
2624
3316
|
return {
|
|
2625
|
-
nextExec: "exec"
|
|
2626
|
-
outputs: {
|
|
2627
|
-
stateMachineId: "",
|
|
2628
|
-
currentState: "",
|
|
2629
|
-
previousState: node.data?.stateName ?? ""
|
|
2630
|
-
}
|
|
3317
|
+
nextExec: "exec"
|
|
2631
3318
|
};
|
|
2632
3319
|
}
|
|
2633
3320
|
};
|
|
2634
|
-
__name(
|
|
2635
|
-
var
|
|
2636
|
-
|
|
2637
|
-
RegisterNode(
|
|
2638
|
-
],
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2646
|
-
}
|
|
2647
|
-
__name(_ts_decorate9, "_ts_decorate");
|
|
2648
|
-
var PrintTemplate = {
|
|
2649
|
-
type: "Print",
|
|
2650
|
-
title: "Print String",
|
|
2651
|
-
category: "debug",
|
|
2652
|
-
color: "#785EF0",
|
|
2653
|
-
description: "Prints a message to the console for debugging (\u6253\u5370\u6D88\u606F\u5230\u63A7\u5236\u53F0\u7528\u4E8E\u8C03\u8BD5)",
|
|
3321
|
+
__name(_SetEntityTagExecutor, "SetEntityTagExecutor");
|
|
3322
|
+
var SetEntityTagExecutor = _SetEntityTagExecutor;
|
|
3323
|
+
SetEntityTagExecutor = _ts_decorate6([
|
|
3324
|
+
RegisterNode(SetEntityTagTemplate)
|
|
3325
|
+
], SetEntityTagExecutor);
|
|
3326
|
+
var SetEntityActiveTemplate = {
|
|
3327
|
+
type: "ECS_SetEntityActive",
|
|
3328
|
+
title: "Set Active",
|
|
3329
|
+
category: "entity",
|
|
3330
|
+
color: "#1e5a8b",
|
|
3331
|
+
description: "Sets whether an entity is active (\u8BBE\u7F6E\u5B9E\u4F53\u662F\u5426\u6FC0\u6D3B)",
|
|
2654
3332
|
keywords: [
|
|
2655
|
-
"
|
|
2656
|
-
"
|
|
2657
|
-
"
|
|
2658
|
-
"
|
|
2659
|
-
"
|
|
3333
|
+
"entity",
|
|
3334
|
+
"active",
|
|
3335
|
+
"enable",
|
|
3336
|
+
"disable",
|
|
3337
|
+
"visible"
|
|
3338
|
+
],
|
|
3339
|
+
menuPath: [
|
|
3340
|
+
"ECS",
|
|
3341
|
+
"Entity",
|
|
3342
|
+
"Set Active"
|
|
2660
3343
|
],
|
|
2661
3344
|
inputs: [
|
|
2662
3345
|
{
|
|
@@ -2665,22 +3348,15 @@ var PrintTemplate = {
|
|
|
2665
3348
|
displayName: ""
|
|
2666
3349
|
},
|
|
2667
3350
|
{
|
|
2668
|
-
name: "
|
|
2669
|
-
type: "
|
|
2670
|
-
displayName: "
|
|
2671
|
-
defaultValue: "Hello Blueprint!"
|
|
3351
|
+
name: "entity",
|
|
3352
|
+
type: "entity",
|
|
3353
|
+
displayName: "Entity"
|
|
2672
3354
|
},
|
|
2673
3355
|
{
|
|
2674
|
-
name: "
|
|
3356
|
+
name: "active",
|
|
2675
3357
|
type: "bool",
|
|
2676
|
-
displayName: "
|
|
3358
|
+
displayName: "Active",
|
|
2677
3359
|
defaultValue: true
|
|
2678
|
-
},
|
|
2679
|
-
{
|
|
2680
|
-
name: "duration",
|
|
2681
|
-
type: "float",
|
|
2682
|
-
displayName: "Duration",
|
|
2683
|
-
defaultValue: 2
|
|
2684
3360
|
}
|
|
2685
3361
|
],
|
|
2686
3362
|
outputs: [
|
|
@@ -2691,146 +3367,317 @@ var PrintTemplate = {
|
|
|
2691
3367
|
}
|
|
2692
3368
|
]
|
|
2693
3369
|
};
|
|
2694
|
-
var
|
|
3370
|
+
var _SetEntityActiveExecutor = class _SetEntityActiveExecutor {
|
|
2695
3371
|
execute(node, context) {
|
|
2696
|
-
const
|
|
2697
|
-
const
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
if (printToScreen) {
|
|
2701
|
-
const event = new CustomEvent("blueprint:print", {
|
|
2702
|
-
detail: {
|
|
2703
|
-
message: String(message),
|
|
2704
|
-
duration: Number(duration),
|
|
2705
|
-
entityId: context.entity.id,
|
|
2706
|
-
entityName: context.entity.name
|
|
2707
|
-
}
|
|
2708
|
-
});
|
|
2709
|
-
if (typeof window !== "undefined") {
|
|
2710
|
-
window.dispatchEvent(event);
|
|
2711
|
-
}
|
|
3372
|
+
const entity = context.evaluateInput(node.id, "entity", context.entity);
|
|
3373
|
+
const active = context.evaluateInput(node.id, "active", true);
|
|
3374
|
+
if (entity && !entity.isDestroyed) {
|
|
3375
|
+
entity.active = active;
|
|
2712
3376
|
}
|
|
2713
3377
|
return {
|
|
2714
3378
|
nextExec: "exec"
|
|
2715
3379
|
};
|
|
2716
3380
|
}
|
|
2717
3381
|
};
|
|
2718
|
-
__name(
|
|
2719
|
-
var
|
|
2720
|
-
|
|
2721
|
-
RegisterNode(
|
|
2722
|
-
],
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
}
|
|
2731
|
-
__name(_ts_decorate10, "_ts_decorate");
|
|
2732
|
-
var GetDeltaTimeTemplate = {
|
|
2733
|
-
type: "GetDeltaTime",
|
|
2734
|
-
title: "Get Delta Time",
|
|
2735
|
-
category: "time",
|
|
2736
|
-
color: "#4FC3F7",
|
|
2737
|
-
description: "Returns the time elapsed since the last frame in seconds (\u8FD4\u56DE\u4E0A\u4E00\u5E27\u4EE5\u6765\u7ECF\u8FC7\u7684\u65F6\u95F4\uFF0C\u5355\u4F4D\u79D2)",
|
|
3382
|
+
__name(_SetEntityActiveExecutor, "SetEntityActiveExecutor");
|
|
3383
|
+
var SetEntityActiveExecutor = _SetEntityActiveExecutor;
|
|
3384
|
+
SetEntityActiveExecutor = _ts_decorate6([
|
|
3385
|
+
RegisterNode(SetEntityActiveTemplate)
|
|
3386
|
+
], SetEntityActiveExecutor);
|
|
3387
|
+
var IsEntityActiveTemplate = {
|
|
3388
|
+
type: "ECS_IsEntityActive",
|
|
3389
|
+
title: "Is Active",
|
|
3390
|
+
category: "entity",
|
|
3391
|
+
color: "#1e5a8b",
|
|
3392
|
+
isPure: true,
|
|
3393
|
+
description: "Checks if an entity is active (\u68C0\u67E5\u5B9E\u4F53\u662F\u5426\u6FC0\u6D3B)",
|
|
2738
3394
|
keywords: [
|
|
2739
|
-
"
|
|
2740
|
-
"
|
|
2741
|
-
"
|
|
2742
|
-
"
|
|
3395
|
+
"entity",
|
|
3396
|
+
"active",
|
|
3397
|
+
"enabled",
|
|
3398
|
+
"check"
|
|
3399
|
+
],
|
|
3400
|
+
menuPath: [
|
|
3401
|
+
"ECS",
|
|
3402
|
+
"Entity",
|
|
3403
|
+
"Is Active"
|
|
2743
3404
|
],
|
|
3405
|
+
inputs: [
|
|
3406
|
+
{
|
|
3407
|
+
name: "entity",
|
|
3408
|
+
type: "entity",
|
|
3409
|
+
displayName: "Entity"
|
|
3410
|
+
}
|
|
3411
|
+
],
|
|
3412
|
+
outputs: [
|
|
3413
|
+
{
|
|
3414
|
+
name: "isActive",
|
|
3415
|
+
type: "bool",
|
|
3416
|
+
displayName: "Is Active"
|
|
3417
|
+
}
|
|
3418
|
+
]
|
|
3419
|
+
};
|
|
3420
|
+
var _IsEntityActiveExecutor = class _IsEntityActiveExecutor {
|
|
3421
|
+
execute(node, context) {
|
|
3422
|
+
const entity = context.evaluateInput(node.id, "entity", context.entity);
|
|
3423
|
+
return {
|
|
3424
|
+
outputs: {
|
|
3425
|
+
isActive: entity?.active ?? false
|
|
3426
|
+
}
|
|
3427
|
+
};
|
|
3428
|
+
}
|
|
3429
|
+
};
|
|
3430
|
+
__name(_IsEntityActiveExecutor, "IsEntityActiveExecutor");
|
|
3431
|
+
var IsEntityActiveExecutor = _IsEntityActiveExecutor;
|
|
3432
|
+
IsEntityActiveExecutor = _ts_decorate6([
|
|
3433
|
+
RegisterNode(IsEntityActiveTemplate)
|
|
3434
|
+
], IsEntityActiveExecutor);
|
|
3435
|
+
var FindEntityByNameTemplate = {
|
|
3436
|
+
type: "ECS_FindEntityByName",
|
|
3437
|
+
title: "Find Entity By Name",
|
|
3438
|
+
category: "entity",
|
|
3439
|
+
color: "#1e5a8b",
|
|
2744
3440
|
isPure: true,
|
|
2745
|
-
|
|
3441
|
+
description: "Finds an entity by name in the scene (\u5728\u573A\u666F\u4E2D\u6309\u540D\u79F0\u67E5\u627E\u5B9E\u4F53)",
|
|
3442
|
+
keywords: [
|
|
3443
|
+
"entity",
|
|
3444
|
+
"find",
|
|
3445
|
+
"name",
|
|
3446
|
+
"search",
|
|
3447
|
+
"get",
|
|
3448
|
+
"lookup"
|
|
3449
|
+
],
|
|
3450
|
+
menuPath: [
|
|
3451
|
+
"ECS",
|
|
3452
|
+
"Entity",
|
|
3453
|
+
"Find By Name"
|
|
3454
|
+
],
|
|
3455
|
+
inputs: [
|
|
3456
|
+
{
|
|
3457
|
+
name: "name",
|
|
3458
|
+
type: "string",
|
|
3459
|
+
displayName: "Name",
|
|
3460
|
+
defaultValue: ""
|
|
3461
|
+
}
|
|
3462
|
+
],
|
|
2746
3463
|
outputs: [
|
|
2747
3464
|
{
|
|
2748
|
-
name: "
|
|
2749
|
-
type: "
|
|
2750
|
-
displayName: "
|
|
3465
|
+
name: "entity",
|
|
3466
|
+
type: "entity",
|
|
3467
|
+
displayName: "Entity"
|
|
3468
|
+
},
|
|
3469
|
+
{
|
|
3470
|
+
name: "found",
|
|
3471
|
+
type: "bool",
|
|
3472
|
+
displayName: "Found"
|
|
2751
3473
|
}
|
|
2752
3474
|
]
|
|
2753
3475
|
};
|
|
2754
|
-
var
|
|
2755
|
-
execute(
|
|
3476
|
+
var _FindEntityByNameExecutor = class _FindEntityByNameExecutor {
|
|
3477
|
+
execute(node, context) {
|
|
3478
|
+
const name = context.evaluateInput(node.id, "name", "");
|
|
3479
|
+
const entity = context.scene.findEntity(name);
|
|
2756
3480
|
return {
|
|
2757
3481
|
outputs: {
|
|
2758
|
-
|
|
3482
|
+
entity: entity ?? null,
|
|
3483
|
+
found: entity != null
|
|
2759
3484
|
}
|
|
2760
3485
|
};
|
|
2761
3486
|
}
|
|
2762
3487
|
};
|
|
2763
|
-
__name(
|
|
2764
|
-
var
|
|
2765
|
-
|
|
2766
|
-
RegisterNode(
|
|
2767
|
-
],
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
}
|
|
2776
|
-
__name(_ts_decorate11, "_ts_decorate");
|
|
2777
|
-
var GetTimeTemplate = {
|
|
2778
|
-
type: "GetTime",
|
|
2779
|
-
title: "Get Game Time",
|
|
2780
|
-
category: "time",
|
|
2781
|
-
color: "#4FC3F7",
|
|
2782
|
-
description: "Returns the total time since the blueprint started in seconds (\u8FD4\u56DE\u84DD\u56FE\u542F\u52A8\u4EE5\u6765\u7684\u603B\u65F6\u95F4\uFF0C\u5355\u4F4D\u79D2)",
|
|
3488
|
+
__name(_FindEntityByNameExecutor, "FindEntityByNameExecutor");
|
|
3489
|
+
var FindEntityByNameExecutor = _FindEntityByNameExecutor;
|
|
3490
|
+
FindEntityByNameExecutor = _ts_decorate6([
|
|
3491
|
+
RegisterNode(FindEntityByNameTemplate)
|
|
3492
|
+
], FindEntityByNameExecutor);
|
|
3493
|
+
var FindEntitiesByTagTemplate = {
|
|
3494
|
+
type: "ECS_FindEntitiesByTag",
|
|
3495
|
+
title: "Find Entities By Tag",
|
|
3496
|
+
category: "entity",
|
|
3497
|
+
color: "#1e5a8b",
|
|
3498
|
+
isPure: true,
|
|
3499
|
+
description: "Finds all entities with a specific tag (\u67E5\u627E\u6240\u6709\u5177\u6709\u7279\u5B9A\u6807\u7B7E\u7684\u5B9E\u4F53)",
|
|
2783
3500
|
keywords: [
|
|
2784
|
-
"
|
|
2785
|
-
"
|
|
2786
|
-
"
|
|
2787
|
-
"
|
|
3501
|
+
"entity",
|
|
3502
|
+
"find",
|
|
3503
|
+
"tag",
|
|
3504
|
+
"search",
|
|
3505
|
+
"get",
|
|
3506
|
+
"all"
|
|
3507
|
+
],
|
|
3508
|
+
menuPath: [
|
|
3509
|
+
"ECS",
|
|
3510
|
+
"Entity",
|
|
3511
|
+
"Find By Tag"
|
|
3512
|
+
],
|
|
3513
|
+
inputs: [
|
|
3514
|
+
{
|
|
3515
|
+
name: "tag",
|
|
3516
|
+
type: "int",
|
|
3517
|
+
displayName: "Tag",
|
|
3518
|
+
defaultValue: 0
|
|
3519
|
+
}
|
|
2788
3520
|
],
|
|
3521
|
+
outputs: [
|
|
3522
|
+
{
|
|
3523
|
+
name: "entities",
|
|
3524
|
+
type: "array",
|
|
3525
|
+
displayName: "Entities",
|
|
3526
|
+
arrayType: "entity"
|
|
3527
|
+
},
|
|
3528
|
+
{
|
|
3529
|
+
name: "count",
|
|
3530
|
+
type: "int",
|
|
3531
|
+
displayName: "Count"
|
|
3532
|
+
}
|
|
3533
|
+
]
|
|
3534
|
+
};
|
|
3535
|
+
var _FindEntitiesByTagExecutor = class _FindEntitiesByTagExecutor {
|
|
3536
|
+
execute(node, context) {
|
|
3537
|
+
const tag = context.evaluateInput(node.id, "tag", 0);
|
|
3538
|
+
const entities = context.scene.findEntitiesByTag(tag);
|
|
3539
|
+
return {
|
|
3540
|
+
outputs: {
|
|
3541
|
+
entities,
|
|
3542
|
+
count: entities.length
|
|
3543
|
+
}
|
|
3544
|
+
};
|
|
3545
|
+
}
|
|
3546
|
+
};
|
|
3547
|
+
__name(_FindEntitiesByTagExecutor, "FindEntitiesByTagExecutor");
|
|
3548
|
+
var FindEntitiesByTagExecutor = _FindEntitiesByTagExecutor;
|
|
3549
|
+
FindEntitiesByTagExecutor = _ts_decorate6([
|
|
3550
|
+
RegisterNode(FindEntitiesByTagTemplate)
|
|
3551
|
+
], FindEntitiesByTagExecutor);
|
|
3552
|
+
var GetEntityIdTemplate = {
|
|
3553
|
+
type: "ECS_GetEntityId",
|
|
3554
|
+
title: "Get Entity ID",
|
|
3555
|
+
category: "entity",
|
|
3556
|
+
color: "#1e5a8b",
|
|
2789
3557
|
isPure: true,
|
|
2790
|
-
|
|
3558
|
+
description: "Gets the unique ID of an entity (\u83B7\u53D6\u5B9E\u4F53\u7684\u552F\u4E00ID)",
|
|
3559
|
+
keywords: [
|
|
3560
|
+
"entity",
|
|
3561
|
+
"id",
|
|
3562
|
+
"identifier",
|
|
3563
|
+
"unique"
|
|
3564
|
+
],
|
|
3565
|
+
menuPath: [
|
|
3566
|
+
"ECS",
|
|
3567
|
+
"Entity",
|
|
3568
|
+
"Get ID"
|
|
3569
|
+
],
|
|
3570
|
+
inputs: [
|
|
3571
|
+
{
|
|
3572
|
+
name: "entity",
|
|
3573
|
+
type: "entity",
|
|
3574
|
+
displayName: "Entity"
|
|
3575
|
+
}
|
|
3576
|
+
],
|
|
2791
3577
|
outputs: [
|
|
2792
3578
|
{
|
|
2793
|
-
name: "
|
|
2794
|
-
type: "
|
|
2795
|
-
displayName: "
|
|
3579
|
+
name: "id",
|
|
3580
|
+
type: "int",
|
|
3581
|
+
displayName: "ID"
|
|
2796
3582
|
}
|
|
2797
3583
|
]
|
|
2798
3584
|
};
|
|
2799
|
-
var
|
|
2800
|
-
execute(
|
|
3585
|
+
var _GetEntityIdExecutor = class _GetEntityIdExecutor {
|
|
3586
|
+
execute(node, context) {
|
|
3587
|
+
const entity = context.evaluateInput(node.id, "entity", context.entity);
|
|
2801
3588
|
return {
|
|
2802
3589
|
outputs: {
|
|
2803
|
-
|
|
3590
|
+
id: entity?.id ?? -1
|
|
2804
3591
|
}
|
|
2805
3592
|
};
|
|
2806
3593
|
}
|
|
2807
3594
|
};
|
|
2808
|
-
__name(
|
|
2809
|
-
var
|
|
2810
|
-
|
|
2811
|
-
RegisterNode(
|
|
2812
|
-
],
|
|
3595
|
+
__name(_GetEntityIdExecutor, "GetEntityIdExecutor");
|
|
3596
|
+
var GetEntityIdExecutor = _GetEntityIdExecutor;
|
|
3597
|
+
GetEntityIdExecutor = _ts_decorate6([
|
|
3598
|
+
RegisterNode(GetEntityIdTemplate)
|
|
3599
|
+
], GetEntityIdExecutor);
|
|
3600
|
+
var FindEntityByIdTemplate = {
|
|
3601
|
+
type: "ECS_FindEntityById",
|
|
3602
|
+
title: "Find Entity By ID",
|
|
3603
|
+
category: "entity",
|
|
3604
|
+
color: "#1e5a8b",
|
|
3605
|
+
isPure: true,
|
|
3606
|
+
description: "Finds an entity by its unique ID (\u901A\u8FC7\u552F\u4E00ID\u67E5\u627E\u5B9E\u4F53)",
|
|
3607
|
+
keywords: [
|
|
3608
|
+
"entity",
|
|
3609
|
+
"find",
|
|
3610
|
+
"id",
|
|
3611
|
+
"identifier"
|
|
3612
|
+
],
|
|
3613
|
+
menuPath: [
|
|
3614
|
+
"ECS",
|
|
3615
|
+
"Entity",
|
|
3616
|
+
"Find By ID"
|
|
3617
|
+
],
|
|
3618
|
+
inputs: [
|
|
3619
|
+
{
|
|
3620
|
+
name: "id",
|
|
3621
|
+
type: "int",
|
|
3622
|
+
displayName: "ID",
|
|
3623
|
+
defaultValue: 0
|
|
3624
|
+
}
|
|
3625
|
+
],
|
|
3626
|
+
outputs: [
|
|
3627
|
+
{
|
|
3628
|
+
name: "entity",
|
|
3629
|
+
type: "entity",
|
|
3630
|
+
displayName: "Entity"
|
|
3631
|
+
},
|
|
3632
|
+
{
|
|
3633
|
+
name: "found",
|
|
3634
|
+
type: "bool",
|
|
3635
|
+
displayName: "Found"
|
|
3636
|
+
}
|
|
3637
|
+
]
|
|
3638
|
+
};
|
|
3639
|
+
var _FindEntityByIdExecutor = class _FindEntityByIdExecutor {
|
|
3640
|
+
execute(node, context) {
|
|
3641
|
+
const id = context.evaluateInput(node.id, "id", 0);
|
|
3642
|
+
const entity = context.scene.findEntityById(id);
|
|
3643
|
+
return {
|
|
3644
|
+
outputs: {
|
|
3645
|
+
entity: entity ?? null,
|
|
3646
|
+
found: entity != null
|
|
3647
|
+
}
|
|
3648
|
+
};
|
|
3649
|
+
}
|
|
3650
|
+
};
|
|
3651
|
+
__name(_FindEntityByIdExecutor, "FindEntityByIdExecutor");
|
|
3652
|
+
var FindEntityByIdExecutor = _FindEntityByIdExecutor;
|
|
3653
|
+
FindEntityByIdExecutor = _ts_decorate6([
|
|
3654
|
+
RegisterNode(FindEntityByIdTemplate)
|
|
3655
|
+
], FindEntityByIdExecutor);
|
|
2813
3656
|
|
|
2814
|
-
// src/nodes/
|
|
2815
|
-
function
|
|
3657
|
+
// src/nodes/ecs/ComponentNodes.ts
|
|
3658
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
2816
3659
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2817
3660
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2818
3661
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2819
3662
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2820
3663
|
}
|
|
2821
|
-
__name(
|
|
2822
|
-
var
|
|
2823
|
-
type: "
|
|
2824
|
-
title: "
|
|
2825
|
-
category: "
|
|
2826
|
-
color: "#
|
|
2827
|
-
description: "
|
|
3664
|
+
__name(_ts_decorate7, "_ts_decorate");
|
|
3665
|
+
var AddComponentTemplate = {
|
|
3666
|
+
type: "ECS_AddComponent",
|
|
3667
|
+
title: "Add Component",
|
|
3668
|
+
category: "component",
|
|
3669
|
+
color: "#1e8b8b",
|
|
3670
|
+
description: "Adds a component to an entity by type name (\u6309\u7C7B\u578B\u540D\u79F0\u4E3A\u5B9E\u4F53\u6DFB\u52A0\u7EC4\u4EF6)",
|
|
2828
3671
|
keywords: [
|
|
2829
|
-
"
|
|
2830
|
-
"
|
|
2831
|
-
"
|
|
2832
|
-
"
|
|
2833
|
-
|
|
3672
|
+
"component",
|
|
3673
|
+
"add",
|
|
3674
|
+
"create",
|
|
3675
|
+
"attach"
|
|
3676
|
+
],
|
|
3677
|
+
menuPath: [
|
|
3678
|
+
"ECS",
|
|
3679
|
+
"Component",
|
|
3680
|
+
"Add Component"
|
|
2834
3681
|
],
|
|
2835
3682
|
inputs: [
|
|
2836
3683
|
{
|
|
@@ -2839,43 +3686,1180 @@ var DelayTemplate = {
|
|
|
2839
3686
|
displayName: ""
|
|
2840
3687
|
},
|
|
2841
3688
|
{
|
|
2842
|
-
name: "
|
|
2843
|
-
type: "
|
|
2844
|
-
displayName: "
|
|
2845
|
-
|
|
3689
|
+
name: "entity",
|
|
3690
|
+
type: "entity",
|
|
3691
|
+
displayName: "Entity"
|
|
3692
|
+
},
|
|
3693
|
+
{
|
|
3694
|
+
name: "componentType",
|
|
3695
|
+
type: "string",
|
|
3696
|
+
displayName: "Component Type",
|
|
3697
|
+
defaultValue: ""
|
|
3698
|
+
}
|
|
3699
|
+
],
|
|
3700
|
+
outputs: [
|
|
3701
|
+
{
|
|
3702
|
+
name: "exec",
|
|
3703
|
+
type: "exec",
|
|
3704
|
+
displayName: ""
|
|
3705
|
+
},
|
|
3706
|
+
{
|
|
3707
|
+
name: "component",
|
|
3708
|
+
type: "component",
|
|
3709
|
+
displayName: "Component"
|
|
3710
|
+
},
|
|
3711
|
+
{
|
|
3712
|
+
name: "success",
|
|
3713
|
+
type: "bool",
|
|
3714
|
+
displayName: "Success"
|
|
3715
|
+
}
|
|
3716
|
+
]
|
|
3717
|
+
};
|
|
3718
|
+
var _AddComponentExecutor = class _AddComponentExecutor {
|
|
3719
|
+
execute(node, context) {
|
|
3720
|
+
const entity = context.evaluateInput(node.id, "entity", context.entity);
|
|
3721
|
+
const componentType = context.evaluateInput(node.id, "componentType", "");
|
|
3722
|
+
if (!entity || entity.isDestroyed || !componentType) {
|
|
3723
|
+
return {
|
|
3724
|
+
outputs: {
|
|
3725
|
+
component: null,
|
|
3726
|
+
success: false
|
|
3727
|
+
},
|
|
3728
|
+
nextExec: "exec"
|
|
3729
|
+
};
|
|
3730
|
+
}
|
|
3731
|
+
const existing = entity.components.find((c) => c.constructor.name === componentType || c.constructor.__componentName__ === componentType);
|
|
3732
|
+
if (existing) {
|
|
3733
|
+
return {
|
|
3734
|
+
outputs: {
|
|
3735
|
+
component: existing,
|
|
3736
|
+
success: false
|
|
3737
|
+
},
|
|
3738
|
+
nextExec: "exec"
|
|
3739
|
+
};
|
|
3740
|
+
}
|
|
3741
|
+
const ComponentClass = context.getComponentClass?.(componentType);
|
|
3742
|
+
if (!ComponentClass) {
|
|
3743
|
+
console.warn(`[Blueprint] Component type not found: ${componentType}`);
|
|
3744
|
+
return {
|
|
3745
|
+
outputs: {
|
|
3746
|
+
component: null,
|
|
3747
|
+
success: false
|
|
3748
|
+
},
|
|
3749
|
+
nextExec: "exec"
|
|
3750
|
+
};
|
|
3751
|
+
}
|
|
3752
|
+
try {
|
|
3753
|
+
const component = new ComponentClass();
|
|
3754
|
+
entity.addComponent(component);
|
|
3755
|
+
return {
|
|
3756
|
+
outputs: {
|
|
3757
|
+
component,
|
|
3758
|
+
success: true
|
|
3759
|
+
},
|
|
3760
|
+
nextExec: "exec"
|
|
3761
|
+
};
|
|
3762
|
+
} catch (error) {
|
|
3763
|
+
console.error(`[Blueprint] Failed to add component ${componentType}:`, error);
|
|
3764
|
+
return {
|
|
3765
|
+
outputs: {
|
|
3766
|
+
component: null,
|
|
3767
|
+
success: false
|
|
3768
|
+
},
|
|
3769
|
+
nextExec: "exec"
|
|
3770
|
+
};
|
|
3771
|
+
}
|
|
3772
|
+
}
|
|
3773
|
+
};
|
|
3774
|
+
__name(_AddComponentExecutor, "AddComponentExecutor");
|
|
3775
|
+
var AddComponentExecutor = _AddComponentExecutor;
|
|
3776
|
+
AddComponentExecutor = _ts_decorate7([
|
|
3777
|
+
RegisterNode(AddComponentTemplate)
|
|
3778
|
+
], AddComponentExecutor);
|
|
3779
|
+
var HasComponentTemplate = {
|
|
3780
|
+
type: "ECS_HasComponent",
|
|
3781
|
+
title: "Has Component",
|
|
3782
|
+
category: "component",
|
|
3783
|
+
color: "#1e8b8b",
|
|
3784
|
+
isPure: true,
|
|
3785
|
+
description: "Checks if an entity has a component of the specified type (\u68C0\u67E5\u5B9E\u4F53\u662F\u5426\u62E5\u6709\u6307\u5B9A\u7C7B\u578B\u7684\u7EC4\u4EF6)",
|
|
3786
|
+
keywords: [
|
|
3787
|
+
"component",
|
|
3788
|
+
"has",
|
|
3789
|
+
"check",
|
|
3790
|
+
"exists",
|
|
3791
|
+
"contains"
|
|
3792
|
+
],
|
|
3793
|
+
menuPath: [
|
|
3794
|
+
"ECS",
|
|
3795
|
+
"Component",
|
|
3796
|
+
"Has Component"
|
|
3797
|
+
],
|
|
3798
|
+
inputs: [
|
|
3799
|
+
{
|
|
3800
|
+
name: "entity",
|
|
3801
|
+
type: "entity",
|
|
3802
|
+
displayName: "Entity"
|
|
3803
|
+
},
|
|
3804
|
+
{
|
|
3805
|
+
name: "componentType",
|
|
3806
|
+
type: "string",
|
|
3807
|
+
displayName: "Component Type",
|
|
3808
|
+
defaultValue: ""
|
|
3809
|
+
}
|
|
3810
|
+
],
|
|
3811
|
+
outputs: [
|
|
3812
|
+
{
|
|
3813
|
+
name: "hasComponent",
|
|
3814
|
+
type: "bool",
|
|
3815
|
+
displayName: "Has Component"
|
|
3816
|
+
}
|
|
3817
|
+
]
|
|
3818
|
+
};
|
|
3819
|
+
var _HasComponentExecutor = class _HasComponentExecutor {
|
|
3820
|
+
execute(node, context) {
|
|
3821
|
+
const entity = context.evaluateInput(node.id, "entity", context.entity);
|
|
3822
|
+
const componentType = context.evaluateInput(node.id, "componentType", "");
|
|
3823
|
+
if (!entity || entity.isDestroyed || !componentType) {
|
|
3824
|
+
return {
|
|
3825
|
+
outputs: {
|
|
3826
|
+
hasComponent: false
|
|
3827
|
+
}
|
|
3828
|
+
};
|
|
3829
|
+
}
|
|
3830
|
+
const hasIt = entity.components.some((c) => c.constructor.name === componentType || c.constructor.__componentName__ === componentType);
|
|
3831
|
+
return {
|
|
3832
|
+
outputs: {
|
|
3833
|
+
hasComponent: hasIt
|
|
3834
|
+
}
|
|
3835
|
+
};
|
|
3836
|
+
}
|
|
3837
|
+
};
|
|
3838
|
+
__name(_HasComponentExecutor, "HasComponentExecutor");
|
|
3839
|
+
var HasComponentExecutor = _HasComponentExecutor;
|
|
3840
|
+
HasComponentExecutor = _ts_decorate7([
|
|
3841
|
+
RegisterNode(HasComponentTemplate)
|
|
3842
|
+
], HasComponentExecutor);
|
|
3843
|
+
var GetComponentTemplate = {
|
|
3844
|
+
type: "ECS_GetComponent",
|
|
3845
|
+
title: "Get Component",
|
|
3846
|
+
category: "component",
|
|
3847
|
+
color: "#1e8b8b",
|
|
3848
|
+
isPure: true,
|
|
3849
|
+
description: "Gets a component from an entity by type name (\u6309\u7C7B\u578B\u540D\u79F0\u4ECE\u5B9E\u4F53\u83B7\u53D6\u7EC4\u4EF6)",
|
|
3850
|
+
keywords: [
|
|
3851
|
+
"component",
|
|
3852
|
+
"get",
|
|
3853
|
+
"find",
|
|
3854
|
+
"access"
|
|
3855
|
+
],
|
|
3856
|
+
menuPath: [
|
|
3857
|
+
"ECS",
|
|
3858
|
+
"Component",
|
|
3859
|
+
"Get Component"
|
|
3860
|
+
],
|
|
3861
|
+
inputs: [
|
|
3862
|
+
{
|
|
3863
|
+
name: "entity",
|
|
3864
|
+
type: "entity",
|
|
3865
|
+
displayName: "Entity"
|
|
3866
|
+
},
|
|
3867
|
+
{
|
|
3868
|
+
name: "componentType",
|
|
3869
|
+
type: "string",
|
|
3870
|
+
displayName: "Component Type",
|
|
3871
|
+
defaultValue: ""
|
|
3872
|
+
}
|
|
3873
|
+
],
|
|
3874
|
+
outputs: [
|
|
3875
|
+
{
|
|
3876
|
+
name: "component",
|
|
3877
|
+
type: "component",
|
|
3878
|
+
displayName: "Component"
|
|
3879
|
+
},
|
|
3880
|
+
{
|
|
3881
|
+
name: "found",
|
|
3882
|
+
type: "bool",
|
|
3883
|
+
displayName: "Found"
|
|
3884
|
+
}
|
|
3885
|
+
]
|
|
3886
|
+
};
|
|
3887
|
+
var _GetComponentExecutor = class _GetComponentExecutor {
|
|
3888
|
+
execute(node, context) {
|
|
3889
|
+
const entity = context.evaluateInput(node.id, "entity", context.entity);
|
|
3890
|
+
const componentType = context.evaluateInput(node.id, "componentType", "");
|
|
3891
|
+
if (!entity || entity.isDestroyed || !componentType) {
|
|
3892
|
+
return {
|
|
3893
|
+
outputs: {
|
|
3894
|
+
component: null,
|
|
3895
|
+
found: false
|
|
3896
|
+
}
|
|
3897
|
+
};
|
|
3898
|
+
}
|
|
3899
|
+
const component = entity.components.find((c) => c.constructor.name === componentType || c.constructor.__componentName__ === componentType);
|
|
3900
|
+
return {
|
|
3901
|
+
outputs: {
|
|
3902
|
+
component: component ?? null,
|
|
3903
|
+
found: component != null
|
|
3904
|
+
}
|
|
3905
|
+
};
|
|
3906
|
+
}
|
|
3907
|
+
};
|
|
3908
|
+
__name(_GetComponentExecutor, "GetComponentExecutor");
|
|
3909
|
+
var GetComponentExecutor = _GetComponentExecutor;
|
|
3910
|
+
GetComponentExecutor = _ts_decorate7([
|
|
3911
|
+
RegisterNode(GetComponentTemplate)
|
|
3912
|
+
], GetComponentExecutor);
|
|
3913
|
+
var GetAllComponentsTemplate = {
|
|
3914
|
+
type: "ECS_GetAllComponents",
|
|
3915
|
+
title: "Get All Components",
|
|
3916
|
+
category: "component",
|
|
3917
|
+
color: "#1e8b8b",
|
|
3918
|
+
isPure: true,
|
|
3919
|
+
description: "Gets all components from an entity (\u83B7\u53D6\u5B9E\u4F53\u7684\u6240\u6709\u7EC4\u4EF6)",
|
|
3920
|
+
keywords: [
|
|
3921
|
+
"component",
|
|
3922
|
+
"get",
|
|
3923
|
+
"all",
|
|
3924
|
+
"list"
|
|
3925
|
+
],
|
|
3926
|
+
menuPath: [
|
|
3927
|
+
"ECS",
|
|
3928
|
+
"Component",
|
|
3929
|
+
"Get All Components"
|
|
3930
|
+
],
|
|
3931
|
+
inputs: [
|
|
3932
|
+
{
|
|
3933
|
+
name: "entity",
|
|
3934
|
+
type: "entity",
|
|
3935
|
+
displayName: "Entity"
|
|
3936
|
+
}
|
|
3937
|
+
],
|
|
3938
|
+
outputs: [
|
|
3939
|
+
{
|
|
3940
|
+
name: "components",
|
|
3941
|
+
type: "array",
|
|
3942
|
+
displayName: "Components",
|
|
3943
|
+
arrayType: "component"
|
|
3944
|
+
},
|
|
3945
|
+
{
|
|
3946
|
+
name: "count",
|
|
3947
|
+
type: "int",
|
|
3948
|
+
displayName: "Count"
|
|
3949
|
+
}
|
|
3950
|
+
]
|
|
3951
|
+
};
|
|
3952
|
+
var _GetAllComponentsExecutor = class _GetAllComponentsExecutor {
|
|
3953
|
+
execute(node, context) {
|
|
3954
|
+
const entity = context.evaluateInput(node.id, "entity", context.entity);
|
|
3955
|
+
if (!entity || entity.isDestroyed) {
|
|
3956
|
+
return {
|
|
3957
|
+
outputs: {
|
|
3958
|
+
components: [],
|
|
3959
|
+
count: 0
|
|
3960
|
+
}
|
|
3961
|
+
};
|
|
3962
|
+
}
|
|
3963
|
+
const components = [
|
|
3964
|
+
...entity.components
|
|
3965
|
+
];
|
|
3966
|
+
return {
|
|
3967
|
+
outputs: {
|
|
3968
|
+
components,
|
|
3969
|
+
count: components.length
|
|
3970
|
+
}
|
|
3971
|
+
};
|
|
3972
|
+
}
|
|
3973
|
+
};
|
|
3974
|
+
__name(_GetAllComponentsExecutor, "GetAllComponentsExecutor");
|
|
3975
|
+
var GetAllComponentsExecutor = _GetAllComponentsExecutor;
|
|
3976
|
+
GetAllComponentsExecutor = _ts_decorate7([
|
|
3977
|
+
RegisterNode(GetAllComponentsTemplate)
|
|
3978
|
+
], GetAllComponentsExecutor);
|
|
3979
|
+
var RemoveComponentTemplate = {
|
|
3980
|
+
type: "ECS_RemoveComponent",
|
|
3981
|
+
title: "Remove Component",
|
|
3982
|
+
category: "component",
|
|
3983
|
+
color: "#8b1e1e",
|
|
3984
|
+
description: "Removes a component from an entity (\u4ECE\u5B9E\u4F53\u79FB\u9664\u7EC4\u4EF6)",
|
|
3985
|
+
keywords: [
|
|
3986
|
+
"component",
|
|
3987
|
+
"remove",
|
|
3988
|
+
"delete",
|
|
3989
|
+
"destroy"
|
|
3990
|
+
],
|
|
3991
|
+
menuPath: [
|
|
3992
|
+
"ECS",
|
|
3993
|
+
"Component",
|
|
3994
|
+
"Remove Component"
|
|
3995
|
+
],
|
|
3996
|
+
inputs: [
|
|
3997
|
+
{
|
|
3998
|
+
name: "exec",
|
|
3999
|
+
type: "exec",
|
|
4000
|
+
displayName: ""
|
|
4001
|
+
},
|
|
4002
|
+
{
|
|
4003
|
+
name: "entity",
|
|
4004
|
+
type: "entity",
|
|
4005
|
+
displayName: "Entity"
|
|
4006
|
+
},
|
|
4007
|
+
{
|
|
4008
|
+
name: "componentType",
|
|
4009
|
+
type: "string",
|
|
4010
|
+
displayName: "Component Type",
|
|
4011
|
+
defaultValue: ""
|
|
4012
|
+
}
|
|
4013
|
+
],
|
|
4014
|
+
outputs: [
|
|
4015
|
+
{
|
|
4016
|
+
name: "exec",
|
|
4017
|
+
type: "exec",
|
|
4018
|
+
displayName: ""
|
|
4019
|
+
},
|
|
4020
|
+
{
|
|
4021
|
+
name: "removed",
|
|
4022
|
+
type: "bool",
|
|
4023
|
+
displayName: "Removed"
|
|
4024
|
+
}
|
|
4025
|
+
]
|
|
4026
|
+
};
|
|
4027
|
+
var _RemoveComponentExecutor = class _RemoveComponentExecutor {
|
|
4028
|
+
execute(node, context) {
|
|
4029
|
+
const entity = context.evaluateInput(node.id, "entity", context.entity);
|
|
4030
|
+
const componentType = context.evaluateInput(node.id, "componentType", "");
|
|
4031
|
+
if (!entity || entity.isDestroyed || !componentType) {
|
|
4032
|
+
return {
|
|
4033
|
+
outputs: {
|
|
4034
|
+
removed: false
|
|
4035
|
+
},
|
|
4036
|
+
nextExec: "exec"
|
|
4037
|
+
};
|
|
4038
|
+
}
|
|
4039
|
+
const component = entity.components.find((c) => c.constructor.name === componentType || c.constructor.__componentName__ === componentType);
|
|
4040
|
+
if (component) {
|
|
4041
|
+
entity.removeComponent(component);
|
|
4042
|
+
return {
|
|
4043
|
+
outputs: {
|
|
4044
|
+
removed: true
|
|
4045
|
+
},
|
|
4046
|
+
nextExec: "exec"
|
|
4047
|
+
};
|
|
4048
|
+
}
|
|
4049
|
+
return {
|
|
4050
|
+
outputs: {
|
|
4051
|
+
removed: false
|
|
4052
|
+
},
|
|
4053
|
+
nextExec: "exec"
|
|
4054
|
+
};
|
|
4055
|
+
}
|
|
4056
|
+
};
|
|
4057
|
+
__name(_RemoveComponentExecutor, "RemoveComponentExecutor");
|
|
4058
|
+
var RemoveComponentExecutor = _RemoveComponentExecutor;
|
|
4059
|
+
RemoveComponentExecutor = _ts_decorate7([
|
|
4060
|
+
RegisterNode(RemoveComponentTemplate)
|
|
4061
|
+
], RemoveComponentExecutor);
|
|
4062
|
+
var GetComponentPropertyTemplate = {
|
|
4063
|
+
type: "ECS_GetComponentProperty",
|
|
4064
|
+
title: "Get Component Property",
|
|
4065
|
+
category: "component",
|
|
4066
|
+
color: "#1e8b8b",
|
|
4067
|
+
isPure: true,
|
|
4068
|
+
description: "Gets a property value from a component (\u4ECE\u7EC4\u4EF6\u83B7\u53D6\u5C5E\u6027\u503C)",
|
|
4069
|
+
keywords: [
|
|
4070
|
+
"component",
|
|
4071
|
+
"property",
|
|
4072
|
+
"get",
|
|
4073
|
+
"value",
|
|
4074
|
+
"field"
|
|
4075
|
+
],
|
|
4076
|
+
menuPath: [
|
|
4077
|
+
"ECS",
|
|
4078
|
+
"Component",
|
|
4079
|
+
"Get Property"
|
|
4080
|
+
],
|
|
4081
|
+
inputs: [
|
|
4082
|
+
{
|
|
4083
|
+
name: "component",
|
|
4084
|
+
type: "component",
|
|
4085
|
+
displayName: "Component"
|
|
4086
|
+
},
|
|
4087
|
+
{
|
|
4088
|
+
name: "propertyName",
|
|
4089
|
+
type: "string",
|
|
4090
|
+
displayName: "Property Name",
|
|
4091
|
+
defaultValue: ""
|
|
4092
|
+
}
|
|
4093
|
+
],
|
|
4094
|
+
outputs: [
|
|
4095
|
+
{
|
|
4096
|
+
name: "value",
|
|
4097
|
+
type: "any",
|
|
4098
|
+
displayName: "Value"
|
|
4099
|
+
},
|
|
4100
|
+
{
|
|
4101
|
+
name: "found",
|
|
4102
|
+
type: "bool",
|
|
4103
|
+
displayName: "Found"
|
|
4104
|
+
}
|
|
4105
|
+
]
|
|
4106
|
+
};
|
|
4107
|
+
var _GetComponentPropertyExecutor = class _GetComponentPropertyExecutor {
|
|
4108
|
+
execute(node, context) {
|
|
4109
|
+
const component = context.evaluateInput(node.id, "component", null);
|
|
4110
|
+
const propertyName = context.evaluateInput(node.id, "propertyName", "");
|
|
4111
|
+
if (!component || !propertyName) {
|
|
4112
|
+
return {
|
|
4113
|
+
outputs: {
|
|
4114
|
+
value: null,
|
|
4115
|
+
found: false
|
|
4116
|
+
}
|
|
4117
|
+
};
|
|
4118
|
+
}
|
|
4119
|
+
if (propertyName in component) {
|
|
4120
|
+
return {
|
|
4121
|
+
outputs: {
|
|
4122
|
+
value: component[propertyName],
|
|
4123
|
+
found: true
|
|
4124
|
+
}
|
|
4125
|
+
};
|
|
4126
|
+
}
|
|
4127
|
+
return {
|
|
4128
|
+
outputs: {
|
|
4129
|
+
value: null,
|
|
4130
|
+
found: false
|
|
4131
|
+
}
|
|
4132
|
+
};
|
|
4133
|
+
}
|
|
4134
|
+
};
|
|
4135
|
+
__name(_GetComponentPropertyExecutor, "GetComponentPropertyExecutor");
|
|
4136
|
+
var GetComponentPropertyExecutor = _GetComponentPropertyExecutor;
|
|
4137
|
+
GetComponentPropertyExecutor = _ts_decorate7([
|
|
4138
|
+
RegisterNode(GetComponentPropertyTemplate)
|
|
4139
|
+
], GetComponentPropertyExecutor);
|
|
4140
|
+
var SetComponentPropertyTemplate = {
|
|
4141
|
+
type: "ECS_SetComponentProperty",
|
|
4142
|
+
title: "Set Component Property",
|
|
4143
|
+
category: "component",
|
|
4144
|
+
color: "#1e8b8b",
|
|
4145
|
+
description: "Sets a property value on a component (\u8BBE\u7F6E\u7EC4\u4EF6\u7684\u5C5E\u6027\u503C)",
|
|
4146
|
+
keywords: [
|
|
4147
|
+
"component",
|
|
4148
|
+
"property",
|
|
4149
|
+
"set",
|
|
4150
|
+
"value",
|
|
4151
|
+
"field",
|
|
4152
|
+
"modify"
|
|
4153
|
+
],
|
|
4154
|
+
menuPath: [
|
|
4155
|
+
"ECS",
|
|
4156
|
+
"Component",
|
|
4157
|
+
"Set Property"
|
|
4158
|
+
],
|
|
4159
|
+
inputs: [
|
|
4160
|
+
{
|
|
4161
|
+
name: "exec",
|
|
4162
|
+
type: "exec",
|
|
4163
|
+
displayName: ""
|
|
4164
|
+
},
|
|
4165
|
+
{
|
|
4166
|
+
name: "component",
|
|
4167
|
+
type: "component",
|
|
4168
|
+
displayName: "Component"
|
|
4169
|
+
},
|
|
4170
|
+
{
|
|
4171
|
+
name: "propertyName",
|
|
4172
|
+
type: "string",
|
|
4173
|
+
displayName: "Property Name",
|
|
4174
|
+
defaultValue: ""
|
|
4175
|
+
},
|
|
4176
|
+
{
|
|
4177
|
+
name: "value",
|
|
4178
|
+
type: "any",
|
|
4179
|
+
displayName: "Value"
|
|
4180
|
+
}
|
|
4181
|
+
],
|
|
4182
|
+
outputs: [
|
|
4183
|
+
{
|
|
4184
|
+
name: "exec",
|
|
4185
|
+
type: "exec",
|
|
4186
|
+
displayName: ""
|
|
4187
|
+
},
|
|
4188
|
+
{
|
|
4189
|
+
name: "success",
|
|
4190
|
+
type: "bool",
|
|
4191
|
+
displayName: "Success"
|
|
4192
|
+
}
|
|
4193
|
+
]
|
|
4194
|
+
};
|
|
4195
|
+
var _SetComponentPropertyExecutor = class _SetComponentPropertyExecutor {
|
|
4196
|
+
execute(node, context) {
|
|
4197
|
+
const component = context.evaluateInput(node.id, "component", null);
|
|
4198
|
+
const propertyName = context.evaluateInput(node.id, "propertyName", "");
|
|
4199
|
+
const value = context.evaluateInput(node.id, "value", null);
|
|
4200
|
+
if (!component || !propertyName) {
|
|
4201
|
+
return {
|
|
4202
|
+
outputs: {
|
|
4203
|
+
success: false
|
|
4204
|
+
},
|
|
4205
|
+
nextExec: "exec"
|
|
4206
|
+
};
|
|
4207
|
+
}
|
|
4208
|
+
if (propertyName in component) {
|
|
4209
|
+
component[propertyName] = value;
|
|
4210
|
+
return {
|
|
4211
|
+
outputs: {
|
|
4212
|
+
success: true
|
|
4213
|
+
},
|
|
4214
|
+
nextExec: "exec"
|
|
4215
|
+
};
|
|
4216
|
+
}
|
|
4217
|
+
return {
|
|
4218
|
+
outputs: {
|
|
4219
|
+
success: false
|
|
4220
|
+
},
|
|
4221
|
+
nextExec: "exec"
|
|
4222
|
+
};
|
|
4223
|
+
}
|
|
4224
|
+
};
|
|
4225
|
+
__name(_SetComponentPropertyExecutor, "SetComponentPropertyExecutor");
|
|
4226
|
+
var SetComponentPropertyExecutor = _SetComponentPropertyExecutor;
|
|
4227
|
+
SetComponentPropertyExecutor = _ts_decorate7([
|
|
4228
|
+
RegisterNode(SetComponentPropertyTemplate)
|
|
4229
|
+
], SetComponentPropertyExecutor);
|
|
4230
|
+
var GetComponentTypeNameTemplate = {
|
|
4231
|
+
type: "ECS_GetComponentTypeName",
|
|
4232
|
+
title: "Get Component Type",
|
|
4233
|
+
category: "component",
|
|
4234
|
+
color: "#1e8b8b",
|
|
4235
|
+
isPure: true,
|
|
4236
|
+
description: "Gets the type name of a component (\u83B7\u53D6\u7EC4\u4EF6\u7684\u7C7B\u578B\u540D\u79F0)",
|
|
4237
|
+
keywords: [
|
|
4238
|
+
"component",
|
|
4239
|
+
"type",
|
|
4240
|
+
"name",
|
|
4241
|
+
"class"
|
|
4242
|
+
],
|
|
4243
|
+
menuPath: [
|
|
4244
|
+
"ECS",
|
|
4245
|
+
"Component",
|
|
4246
|
+
"Get Type Name"
|
|
4247
|
+
],
|
|
4248
|
+
inputs: [
|
|
4249
|
+
{
|
|
4250
|
+
name: "component",
|
|
4251
|
+
type: "component",
|
|
4252
|
+
displayName: "Component"
|
|
4253
|
+
}
|
|
4254
|
+
],
|
|
4255
|
+
outputs: [
|
|
4256
|
+
{
|
|
4257
|
+
name: "typeName",
|
|
4258
|
+
type: "string",
|
|
4259
|
+
displayName: "Type Name"
|
|
4260
|
+
}
|
|
4261
|
+
]
|
|
4262
|
+
};
|
|
4263
|
+
var _GetComponentTypeNameExecutor = class _GetComponentTypeNameExecutor {
|
|
4264
|
+
execute(node, context) {
|
|
4265
|
+
const component = context.evaluateInput(node.id, "component", null);
|
|
4266
|
+
if (!component) {
|
|
4267
|
+
return {
|
|
4268
|
+
outputs: {
|
|
4269
|
+
typeName: ""
|
|
4270
|
+
}
|
|
4271
|
+
};
|
|
4272
|
+
}
|
|
4273
|
+
const typeName = component.constructor.__componentName__ ?? component.constructor.name;
|
|
4274
|
+
return {
|
|
4275
|
+
outputs: {
|
|
4276
|
+
typeName
|
|
4277
|
+
}
|
|
4278
|
+
};
|
|
4279
|
+
}
|
|
4280
|
+
};
|
|
4281
|
+
__name(_GetComponentTypeNameExecutor, "GetComponentTypeNameExecutor");
|
|
4282
|
+
var GetComponentTypeNameExecutor = _GetComponentTypeNameExecutor;
|
|
4283
|
+
GetComponentTypeNameExecutor = _ts_decorate7([
|
|
4284
|
+
RegisterNode(GetComponentTypeNameTemplate)
|
|
4285
|
+
], GetComponentTypeNameExecutor);
|
|
4286
|
+
var GetEntityFromComponentTemplate = {
|
|
4287
|
+
type: "ECS_GetEntityFromComponent",
|
|
4288
|
+
title: "Get Owner Entity",
|
|
4289
|
+
category: "component",
|
|
4290
|
+
color: "#1e8b8b",
|
|
4291
|
+
isPure: true,
|
|
4292
|
+
description: "Gets the entity that owns a component (\u83B7\u53D6\u62E5\u6709\u7EC4\u4EF6\u7684\u5B9E\u4F53)",
|
|
4293
|
+
keywords: [
|
|
4294
|
+
"component",
|
|
4295
|
+
"entity",
|
|
4296
|
+
"owner",
|
|
4297
|
+
"parent"
|
|
4298
|
+
],
|
|
4299
|
+
menuPath: [
|
|
4300
|
+
"ECS",
|
|
4301
|
+
"Component",
|
|
4302
|
+
"Get Owner Entity"
|
|
4303
|
+
],
|
|
4304
|
+
inputs: [
|
|
4305
|
+
{
|
|
4306
|
+
name: "component",
|
|
4307
|
+
type: "component",
|
|
4308
|
+
displayName: "Component"
|
|
4309
|
+
}
|
|
4310
|
+
],
|
|
4311
|
+
outputs: [
|
|
4312
|
+
{
|
|
4313
|
+
name: "entity",
|
|
4314
|
+
type: "entity",
|
|
4315
|
+
displayName: "Entity"
|
|
4316
|
+
},
|
|
4317
|
+
{
|
|
4318
|
+
name: "found",
|
|
4319
|
+
type: "bool",
|
|
4320
|
+
displayName: "Found"
|
|
4321
|
+
}
|
|
4322
|
+
]
|
|
4323
|
+
};
|
|
4324
|
+
var _GetEntityFromComponentExecutor = class _GetEntityFromComponentExecutor {
|
|
4325
|
+
execute(node, context) {
|
|
4326
|
+
const component = context.evaluateInput(node.id, "component", null);
|
|
4327
|
+
if (!component || component.entityId == null) {
|
|
4328
|
+
return {
|
|
4329
|
+
outputs: {
|
|
4330
|
+
entity: null,
|
|
4331
|
+
found: false
|
|
4332
|
+
}
|
|
4333
|
+
};
|
|
4334
|
+
}
|
|
4335
|
+
const entity = context.scene.findEntityById(component.entityId);
|
|
4336
|
+
return {
|
|
4337
|
+
outputs: {
|
|
4338
|
+
entity: entity ?? null,
|
|
4339
|
+
found: entity != null
|
|
4340
|
+
}
|
|
4341
|
+
};
|
|
4342
|
+
}
|
|
4343
|
+
};
|
|
4344
|
+
__name(_GetEntityFromComponentExecutor, "GetEntityFromComponentExecutor");
|
|
4345
|
+
var GetEntityFromComponentExecutor = _GetEntityFromComponentExecutor;
|
|
4346
|
+
GetEntityFromComponentExecutor = _ts_decorate7([
|
|
4347
|
+
RegisterNode(GetEntityFromComponentTemplate)
|
|
4348
|
+
], GetEntityFromComponentExecutor);
|
|
4349
|
+
|
|
4350
|
+
// src/nodes/ecs/FlowNodes.ts
|
|
4351
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
4352
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4353
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4354
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4355
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4356
|
+
}
|
|
4357
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
4358
|
+
var BranchTemplate = {
|
|
4359
|
+
type: "Flow_Branch",
|
|
4360
|
+
title: "Branch",
|
|
4361
|
+
category: "flow",
|
|
4362
|
+
color: "#4a4a4a",
|
|
4363
|
+
description: "Executes one of two paths based on a condition (\u6839\u636E\u6761\u4EF6\u6267\u884C\u4E24\u6761\u8DEF\u5F84\u4E4B\u4E00)",
|
|
4364
|
+
keywords: [
|
|
4365
|
+
"if",
|
|
4366
|
+
"branch",
|
|
4367
|
+
"condition",
|
|
4368
|
+
"switch",
|
|
4369
|
+
"else"
|
|
4370
|
+
],
|
|
4371
|
+
menuPath: [
|
|
4372
|
+
"Flow",
|
|
4373
|
+
"Branch"
|
|
4374
|
+
],
|
|
4375
|
+
inputs: [
|
|
4376
|
+
{
|
|
4377
|
+
name: "exec",
|
|
4378
|
+
type: "exec",
|
|
4379
|
+
displayName: ""
|
|
4380
|
+
},
|
|
4381
|
+
{
|
|
4382
|
+
name: "condition",
|
|
4383
|
+
type: "bool",
|
|
4384
|
+
displayName: "Condition",
|
|
4385
|
+
defaultValue: false
|
|
4386
|
+
}
|
|
4387
|
+
],
|
|
4388
|
+
outputs: [
|
|
4389
|
+
{
|
|
4390
|
+
name: "true",
|
|
4391
|
+
type: "exec",
|
|
4392
|
+
displayName: "True"
|
|
4393
|
+
},
|
|
4394
|
+
{
|
|
4395
|
+
name: "false",
|
|
4396
|
+
type: "exec",
|
|
4397
|
+
displayName: "False"
|
|
4398
|
+
}
|
|
4399
|
+
]
|
|
4400
|
+
};
|
|
4401
|
+
var _BranchExecutor = class _BranchExecutor {
|
|
4402
|
+
execute(node, context) {
|
|
4403
|
+
const condition2 = context.evaluateInput(node.id, "condition", false);
|
|
4404
|
+
return {
|
|
4405
|
+
nextExec: condition2 ? "true" : "false"
|
|
4406
|
+
};
|
|
4407
|
+
}
|
|
4408
|
+
};
|
|
4409
|
+
__name(_BranchExecutor, "BranchExecutor");
|
|
4410
|
+
var BranchExecutor = _BranchExecutor;
|
|
4411
|
+
BranchExecutor = _ts_decorate8([
|
|
4412
|
+
RegisterNode(BranchTemplate)
|
|
4413
|
+
], BranchExecutor);
|
|
4414
|
+
var SequenceTemplate = {
|
|
4415
|
+
type: "Flow_Sequence",
|
|
4416
|
+
title: "Sequence",
|
|
4417
|
+
category: "flow",
|
|
4418
|
+
color: "#4a4a4a",
|
|
4419
|
+
description: "Executes multiple outputs in order (\u6309\u987A\u5E8F\u6267\u884C\u591A\u4E2A\u8F93\u51FA)",
|
|
4420
|
+
keywords: [
|
|
4421
|
+
"sequence",
|
|
4422
|
+
"order",
|
|
4423
|
+
"serial",
|
|
4424
|
+
"chain"
|
|
4425
|
+
],
|
|
4426
|
+
menuPath: [
|
|
4427
|
+
"Flow",
|
|
4428
|
+
"Sequence"
|
|
4429
|
+
],
|
|
4430
|
+
inputs: [
|
|
4431
|
+
{
|
|
4432
|
+
name: "exec",
|
|
4433
|
+
type: "exec",
|
|
4434
|
+
displayName: ""
|
|
4435
|
+
}
|
|
4436
|
+
],
|
|
4437
|
+
outputs: [
|
|
4438
|
+
{
|
|
4439
|
+
name: "then0",
|
|
4440
|
+
type: "exec",
|
|
4441
|
+
displayName: "Then 0"
|
|
4442
|
+
},
|
|
4443
|
+
{
|
|
4444
|
+
name: "then1",
|
|
4445
|
+
type: "exec",
|
|
4446
|
+
displayName: "Then 1"
|
|
4447
|
+
},
|
|
4448
|
+
{
|
|
4449
|
+
name: "then2",
|
|
4450
|
+
type: "exec",
|
|
4451
|
+
displayName: "Then 2"
|
|
4452
|
+
},
|
|
4453
|
+
{
|
|
4454
|
+
name: "then3",
|
|
4455
|
+
type: "exec",
|
|
4456
|
+
displayName: "Then 3"
|
|
4457
|
+
}
|
|
4458
|
+
]
|
|
4459
|
+
};
|
|
4460
|
+
var _SequenceExecutor = class _SequenceExecutor {
|
|
4461
|
+
constructor() {
|
|
4462
|
+
__publicField(this, "currentIndex", 0);
|
|
4463
|
+
}
|
|
4464
|
+
execute(_node, _context) {
|
|
4465
|
+
const outputs = [
|
|
4466
|
+
"then0",
|
|
4467
|
+
"then1",
|
|
4468
|
+
"then2",
|
|
4469
|
+
"then3"
|
|
4470
|
+
];
|
|
4471
|
+
const nextPin = outputs[this.currentIndex];
|
|
4472
|
+
this.currentIndex = (this.currentIndex + 1) % outputs.length;
|
|
4473
|
+
if (this.currentIndex === 0) {
|
|
4474
|
+
return {
|
|
4475
|
+
nextExec: null
|
|
4476
|
+
};
|
|
4477
|
+
}
|
|
4478
|
+
return {
|
|
4479
|
+
nextExec: nextPin
|
|
4480
|
+
};
|
|
4481
|
+
}
|
|
4482
|
+
};
|
|
4483
|
+
__name(_SequenceExecutor, "SequenceExecutor");
|
|
4484
|
+
var SequenceExecutor = _SequenceExecutor;
|
|
4485
|
+
SequenceExecutor = _ts_decorate8([
|
|
4486
|
+
RegisterNode(SequenceTemplate)
|
|
4487
|
+
], SequenceExecutor);
|
|
4488
|
+
var DoOnceTemplate = {
|
|
4489
|
+
type: "Flow_DoOnce",
|
|
4490
|
+
title: "Do Once",
|
|
4491
|
+
category: "flow",
|
|
4492
|
+
color: "#4a4a4a",
|
|
4493
|
+
description: "Executes the output only once, subsequent calls are ignored (\u53EA\u6267\u884C\u4E00\u6B21\uFF0C\u540E\u7EED\u8C03\u7528\u88AB\u5FFD\u7565)",
|
|
4494
|
+
keywords: [
|
|
4495
|
+
"once",
|
|
4496
|
+
"single",
|
|
4497
|
+
"first",
|
|
4498
|
+
"one"
|
|
4499
|
+
],
|
|
4500
|
+
menuPath: [
|
|
4501
|
+
"Flow",
|
|
4502
|
+
"Do Once"
|
|
4503
|
+
],
|
|
4504
|
+
inputs: [
|
|
4505
|
+
{
|
|
4506
|
+
name: "exec",
|
|
4507
|
+
type: "exec",
|
|
4508
|
+
displayName: ""
|
|
4509
|
+
},
|
|
4510
|
+
{
|
|
4511
|
+
name: "reset",
|
|
4512
|
+
type: "exec",
|
|
4513
|
+
displayName: "Reset"
|
|
4514
|
+
}
|
|
4515
|
+
],
|
|
4516
|
+
outputs: [
|
|
4517
|
+
{
|
|
4518
|
+
name: "exec",
|
|
4519
|
+
type: "exec",
|
|
4520
|
+
displayName: ""
|
|
4521
|
+
}
|
|
4522
|
+
]
|
|
4523
|
+
};
|
|
4524
|
+
var _DoOnceExecutor = class _DoOnceExecutor {
|
|
4525
|
+
constructor() {
|
|
4526
|
+
__publicField(this, "executed", false);
|
|
4527
|
+
}
|
|
4528
|
+
execute(node, _context) {
|
|
4529
|
+
const inputPin = node.data._lastInputPin;
|
|
4530
|
+
if (inputPin === "reset") {
|
|
4531
|
+
this.executed = false;
|
|
4532
|
+
return {
|
|
4533
|
+
nextExec: null
|
|
4534
|
+
};
|
|
4535
|
+
}
|
|
4536
|
+
if (this.executed) {
|
|
4537
|
+
return {
|
|
4538
|
+
nextExec: null
|
|
4539
|
+
};
|
|
4540
|
+
}
|
|
4541
|
+
this.executed = true;
|
|
4542
|
+
return {
|
|
4543
|
+
nextExec: "exec"
|
|
4544
|
+
};
|
|
4545
|
+
}
|
|
4546
|
+
};
|
|
4547
|
+
__name(_DoOnceExecutor, "DoOnceExecutor");
|
|
4548
|
+
var DoOnceExecutor = _DoOnceExecutor;
|
|
4549
|
+
DoOnceExecutor = _ts_decorate8([
|
|
4550
|
+
RegisterNode(DoOnceTemplate)
|
|
4551
|
+
], DoOnceExecutor);
|
|
4552
|
+
var FlipFlopTemplate = {
|
|
4553
|
+
type: "Flow_FlipFlop",
|
|
4554
|
+
title: "Flip Flop",
|
|
4555
|
+
category: "flow",
|
|
4556
|
+
color: "#4a4a4a",
|
|
4557
|
+
description: "Alternates between two outputs on each execution (\u6BCF\u6B21\u6267\u884C\u65F6\u5728\u4E24\u4E2A\u8F93\u51FA\u4E4B\u95F4\u4EA4\u66FF)",
|
|
4558
|
+
keywords: [
|
|
4559
|
+
"flip",
|
|
4560
|
+
"flop",
|
|
4561
|
+
"toggle",
|
|
4562
|
+
"alternate",
|
|
4563
|
+
"switch"
|
|
4564
|
+
],
|
|
4565
|
+
menuPath: [
|
|
4566
|
+
"Flow",
|
|
4567
|
+
"Flip Flop"
|
|
4568
|
+
],
|
|
4569
|
+
inputs: [
|
|
4570
|
+
{
|
|
4571
|
+
name: "exec",
|
|
4572
|
+
type: "exec",
|
|
4573
|
+
displayName: ""
|
|
4574
|
+
}
|
|
4575
|
+
],
|
|
4576
|
+
outputs: [
|
|
4577
|
+
{
|
|
4578
|
+
name: "a",
|
|
4579
|
+
type: "exec",
|
|
4580
|
+
displayName: "A"
|
|
4581
|
+
},
|
|
4582
|
+
{
|
|
4583
|
+
name: "b",
|
|
4584
|
+
type: "exec",
|
|
4585
|
+
displayName: "B"
|
|
4586
|
+
},
|
|
4587
|
+
{
|
|
4588
|
+
name: "isA",
|
|
4589
|
+
type: "bool",
|
|
4590
|
+
displayName: "Is A"
|
|
4591
|
+
}
|
|
4592
|
+
]
|
|
4593
|
+
};
|
|
4594
|
+
var _FlipFlopExecutor = class _FlipFlopExecutor {
|
|
4595
|
+
constructor() {
|
|
4596
|
+
__publicField(this, "isA", true);
|
|
4597
|
+
}
|
|
4598
|
+
execute(_node, _context) {
|
|
4599
|
+
const currentIsA = this.isA;
|
|
4600
|
+
this.isA = !this.isA;
|
|
4601
|
+
return {
|
|
4602
|
+
outputs: {
|
|
4603
|
+
isA: currentIsA
|
|
4604
|
+
},
|
|
4605
|
+
nextExec: currentIsA ? "a" : "b"
|
|
4606
|
+
};
|
|
4607
|
+
}
|
|
4608
|
+
};
|
|
4609
|
+
__name(_FlipFlopExecutor, "FlipFlopExecutor");
|
|
4610
|
+
var FlipFlopExecutor = _FlipFlopExecutor;
|
|
4611
|
+
FlipFlopExecutor = _ts_decorate8([
|
|
4612
|
+
RegisterNode(FlipFlopTemplate)
|
|
4613
|
+
], FlipFlopExecutor);
|
|
4614
|
+
var GateTemplate = {
|
|
4615
|
+
type: "Flow_Gate",
|
|
4616
|
+
title: "Gate",
|
|
4617
|
+
category: "flow",
|
|
4618
|
+
color: "#4a4a4a",
|
|
4619
|
+
description: "Controls execution flow with open/close state (\u901A\u8FC7\u5F00/\u5173\u72B6\u6001\u63A7\u5236\u6267\u884C\u6D41)",
|
|
4620
|
+
keywords: [
|
|
4621
|
+
"gate",
|
|
4622
|
+
"open",
|
|
4623
|
+
"close",
|
|
4624
|
+
"block",
|
|
4625
|
+
"allow"
|
|
4626
|
+
],
|
|
4627
|
+
menuPath: [
|
|
4628
|
+
"Flow",
|
|
4629
|
+
"Gate"
|
|
4630
|
+
],
|
|
4631
|
+
inputs: [
|
|
4632
|
+
{
|
|
4633
|
+
name: "exec",
|
|
4634
|
+
type: "exec",
|
|
4635
|
+
displayName: "Enter"
|
|
4636
|
+
},
|
|
4637
|
+
{
|
|
4638
|
+
name: "open",
|
|
4639
|
+
type: "exec",
|
|
4640
|
+
displayName: "Open"
|
|
4641
|
+
},
|
|
4642
|
+
{
|
|
4643
|
+
name: "close",
|
|
4644
|
+
type: "exec",
|
|
4645
|
+
displayName: "Close"
|
|
4646
|
+
},
|
|
4647
|
+
{
|
|
4648
|
+
name: "toggle",
|
|
4649
|
+
type: "exec",
|
|
4650
|
+
displayName: "Toggle"
|
|
4651
|
+
},
|
|
4652
|
+
{
|
|
4653
|
+
name: "startOpen",
|
|
4654
|
+
type: "bool",
|
|
4655
|
+
displayName: "Start Open",
|
|
4656
|
+
defaultValue: true
|
|
4657
|
+
}
|
|
4658
|
+
],
|
|
4659
|
+
outputs: [
|
|
4660
|
+
{
|
|
4661
|
+
name: "exec",
|
|
4662
|
+
type: "exec",
|
|
4663
|
+
displayName: "Exit"
|
|
4664
|
+
}
|
|
4665
|
+
]
|
|
4666
|
+
};
|
|
4667
|
+
var _GateExecutor = class _GateExecutor {
|
|
4668
|
+
constructor() {
|
|
4669
|
+
__publicField(this, "isOpen", null);
|
|
4670
|
+
}
|
|
4671
|
+
execute(node, context) {
|
|
4672
|
+
if (this.isOpen === null) {
|
|
4673
|
+
this.isOpen = context.evaluateInput(node.id, "startOpen", true);
|
|
4674
|
+
}
|
|
4675
|
+
const inputPin = node.data._lastInputPin;
|
|
4676
|
+
switch (inputPin) {
|
|
4677
|
+
case "open":
|
|
4678
|
+
this.isOpen = true;
|
|
4679
|
+
return {
|
|
4680
|
+
nextExec: null
|
|
4681
|
+
};
|
|
4682
|
+
case "close":
|
|
4683
|
+
this.isOpen = false;
|
|
4684
|
+
return {
|
|
4685
|
+
nextExec: null
|
|
4686
|
+
};
|
|
4687
|
+
case "toggle":
|
|
4688
|
+
this.isOpen = !this.isOpen;
|
|
4689
|
+
return {
|
|
4690
|
+
nextExec: null
|
|
4691
|
+
};
|
|
4692
|
+
default:
|
|
4693
|
+
return {
|
|
4694
|
+
nextExec: this.isOpen ? "exec" : null
|
|
4695
|
+
};
|
|
4696
|
+
}
|
|
4697
|
+
}
|
|
4698
|
+
};
|
|
4699
|
+
__name(_GateExecutor, "GateExecutor");
|
|
4700
|
+
var GateExecutor = _GateExecutor;
|
|
4701
|
+
GateExecutor = _ts_decorate8([
|
|
4702
|
+
RegisterNode(GateTemplate)
|
|
4703
|
+
], GateExecutor);
|
|
4704
|
+
var ForLoopTemplate = {
|
|
4705
|
+
type: "Flow_ForLoop",
|
|
4706
|
+
title: "For Loop",
|
|
4707
|
+
category: "flow",
|
|
4708
|
+
color: "#4a4a4a",
|
|
4709
|
+
description: "Executes the loop body for each index in range (\u5BF9\u8303\u56F4\u5185\u7684\u6BCF\u4E2A\u7D22\u5F15\u6267\u884C\u5FAA\u73AF\u4F53)",
|
|
4710
|
+
keywords: [
|
|
4711
|
+
"for",
|
|
4712
|
+
"loop",
|
|
4713
|
+
"iterate",
|
|
4714
|
+
"repeat",
|
|
4715
|
+
"count"
|
|
4716
|
+
],
|
|
4717
|
+
menuPath: [
|
|
4718
|
+
"Flow",
|
|
4719
|
+
"For Loop"
|
|
4720
|
+
],
|
|
4721
|
+
inputs: [
|
|
4722
|
+
{
|
|
4723
|
+
name: "exec",
|
|
4724
|
+
type: "exec",
|
|
4725
|
+
displayName: ""
|
|
4726
|
+
},
|
|
4727
|
+
{
|
|
4728
|
+
name: "start",
|
|
4729
|
+
type: "int",
|
|
4730
|
+
displayName: "Start",
|
|
4731
|
+
defaultValue: 0
|
|
4732
|
+
},
|
|
4733
|
+
{
|
|
4734
|
+
name: "end",
|
|
4735
|
+
type: "int",
|
|
4736
|
+
displayName: "End",
|
|
4737
|
+
defaultValue: 10
|
|
4738
|
+
}
|
|
4739
|
+
],
|
|
4740
|
+
outputs: [
|
|
4741
|
+
{
|
|
4742
|
+
name: "loopBody",
|
|
4743
|
+
type: "exec",
|
|
4744
|
+
displayName: "Loop Body"
|
|
4745
|
+
},
|
|
4746
|
+
{
|
|
4747
|
+
name: "completed",
|
|
4748
|
+
type: "exec",
|
|
4749
|
+
displayName: "Completed"
|
|
4750
|
+
},
|
|
4751
|
+
{
|
|
4752
|
+
name: "index",
|
|
4753
|
+
type: "int",
|
|
4754
|
+
displayName: "Index"
|
|
4755
|
+
}
|
|
4756
|
+
]
|
|
4757
|
+
};
|
|
4758
|
+
var _ForLoopExecutor = class _ForLoopExecutor {
|
|
4759
|
+
constructor() {
|
|
4760
|
+
__publicField(this, "currentIndex", 0);
|
|
4761
|
+
__publicField(this, "endIndex", 0);
|
|
4762
|
+
__publicField(this, "isRunning", false);
|
|
4763
|
+
}
|
|
4764
|
+
execute(node, context) {
|
|
4765
|
+
if (!this.isRunning) {
|
|
4766
|
+
this.currentIndex = context.evaluateInput(node.id, "start", 0);
|
|
4767
|
+
this.endIndex = context.evaluateInput(node.id, "end", 10);
|
|
4768
|
+
this.isRunning = true;
|
|
4769
|
+
}
|
|
4770
|
+
if (this.currentIndex < this.endIndex) {
|
|
4771
|
+
const index = this.currentIndex;
|
|
4772
|
+
this.currentIndex++;
|
|
4773
|
+
return {
|
|
4774
|
+
outputs: {
|
|
4775
|
+
index
|
|
4776
|
+
},
|
|
4777
|
+
nextExec: "loopBody"
|
|
4778
|
+
};
|
|
4779
|
+
}
|
|
4780
|
+
this.isRunning = false;
|
|
4781
|
+
return {
|
|
4782
|
+
outputs: {
|
|
4783
|
+
index: this.endIndex
|
|
4784
|
+
},
|
|
4785
|
+
nextExec: "completed"
|
|
4786
|
+
};
|
|
4787
|
+
}
|
|
4788
|
+
};
|
|
4789
|
+
__name(_ForLoopExecutor, "ForLoopExecutor");
|
|
4790
|
+
var ForLoopExecutor = _ForLoopExecutor;
|
|
4791
|
+
ForLoopExecutor = _ts_decorate8([
|
|
4792
|
+
RegisterNode(ForLoopTemplate)
|
|
4793
|
+
], ForLoopExecutor);
|
|
4794
|
+
var WhileLoopTemplate = {
|
|
4795
|
+
type: "Flow_WhileLoop",
|
|
4796
|
+
title: "While Loop",
|
|
4797
|
+
category: "flow",
|
|
4798
|
+
color: "#4a4a4a",
|
|
4799
|
+
description: "Executes the loop body while condition is true (\u5F53\u6761\u4EF6\u4E3A\u771F\u65F6\u6267\u884C\u5FAA\u73AF\u4F53)",
|
|
4800
|
+
keywords: [
|
|
4801
|
+
"while",
|
|
4802
|
+
"loop",
|
|
4803
|
+
"repeat",
|
|
4804
|
+
"condition"
|
|
4805
|
+
],
|
|
4806
|
+
menuPath: [
|
|
4807
|
+
"Flow",
|
|
4808
|
+
"While Loop"
|
|
4809
|
+
],
|
|
4810
|
+
inputs: [
|
|
4811
|
+
{
|
|
4812
|
+
name: "exec",
|
|
4813
|
+
type: "exec",
|
|
4814
|
+
displayName: ""
|
|
4815
|
+
},
|
|
4816
|
+
{
|
|
4817
|
+
name: "condition",
|
|
4818
|
+
type: "bool",
|
|
4819
|
+
displayName: "Condition",
|
|
4820
|
+
defaultValue: true
|
|
2846
4821
|
}
|
|
2847
4822
|
],
|
|
2848
4823
|
outputs: [
|
|
2849
4824
|
{
|
|
2850
|
-
name: "
|
|
4825
|
+
name: "loopBody",
|
|
4826
|
+
type: "exec",
|
|
4827
|
+
displayName: "Loop Body"
|
|
4828
|
+
},
|
|
4829
|
+
{
|
|
4830
|
+
name: "completed",
|
|
2851
4831
|
type: "exec",
|
|
2852
4832
|
displayName: "Completed"
|
|
2853
4833
|
}
|
|
2854
4834
|
]
|
|
2855
4835
|
};
|
|
2856
|
-
var
|
|
4836
|
+
var _WhileLoopExecutor = class _WhileLoopExecutor {
|
|
2857
4837
|
execute(node, context) {
|
|
2858
|
-
const
|
|
4838
|
+
const condition2 = context.evaluateInput(node.id, "condition", true);
|
|
4839
|
+
if (condition2) {
|
|
4840
|
+
return {
|
|
4841
|
+
nextExec: "loopBody"
|
|
4842
|
+
};
|
|
4843
|
+
}
|
|
2859
4844
|
return {
|
|
2860
|
-
nextExec: "
|
|
2861
|
-
delay: duration
|
|
4845
|
+
nextExec: "completed"
|
|
2862
4846
|
};
|
|
2863
4847
|
}
|
|
2864
4848
|
};
|
|
2865
|
-
__name(
|
|
2866
|
-
var
|
|
2867
|
-
|
|
2868
|
-
RegisterNode(
|
|
2869
|
-
],
|
|
4849
|
+
__name(_WhileLoopExecutor, "WhileLoopExecutor");
|
|
4850
|
+
var WhileLoopExecutor = _WhileLoopExecutor;
|
|
4851
|
+
WhileLoopExecutor = _ts_decorate8([
|
|
4852
|
+
RegisterNode(WhileLoopTemplate)
|
|
4853
|
+
], WhileLoopExecutor);
|
|
2870
4854
|
|
|
2871
4855
|
// src/nodes/math/MathOperations.ts
|
|
2872
|
-
function
|
|
4856
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
2873
4857
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2874
4858
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2875
4859
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2876
4860
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2877
4861
|
}
|
|
2878
|
-
__name(
|
|
4862
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
2879
4863
|
var AddTemplate = {
|
|
2880
4864
|
type: "Add",
|
|
2881
4865
|
title: "Add",
|
|
@@ -2925,7 +4909,7 @@ var _AddExecutor = class _AddExecutor {
|
|
|
2925
4909
|
};
|
|
2926
4910
|
__name(_AddExecutor, "AddExecutor");
|
|
2927
4911
|
var AddExecutor = _AddExecutor;
|
|
2928
|
-
AddExecutor =
|
|
4912
|
+
AddExecutor = _ts_decorate9([
|
|
2929
4913
|
RegisterNode(AddTemplate)
|
|
2930
4914
|
], AddExecutor);
|
|
2931
4915
|
var SubtractTemplate = {
|
|
@@ -2976,7 +4960,7 @@ var _SubtractExecutor = class _SubtractExecutor {
|
|
|
2976
4960
|
};
|
|
2977
4961
|
__name(_SubtractExecutor, "SubtractExecutor");
|
|
2978
4962
|
var SubtractExecutor = _SubtractExecutor;
|
|
2979
|
-
SubtractExecutor =
|
|
4963
|
+
SubtractExecutor = _ts_decorate9([
|
|
2980
4964
|
RegisterNode(SubtractTemplate)
|
|
2981
4965
|
], SubtractExecutor);
|
|
2982
4966
|
var MultiplyTemplate = {
|
|
@@ -3027,7 +5011,7 @@ var _MultiplyExecutor = class _MultiplyExecutor {
|
|
|
3027
5011
|
};
|
|
3028
5012
|
__name(_MultiplyExecutor, "MultiplyExecutor");
|
|
3029
5013
|
var MultiplyExecutor = _MultiplyExecutor;
|
|
3030
|
-
MultiplyExecutor =
|
|
5014
|
+
MultiplyExecutor = _ts_decorate9([
|
|
3031
5015
|
RegisterNode(MultiplyTemplate)
|
|
3032
5016
|
], MultiplyExecutor);
|
|
3033
5017
|
var DivideTemplate = {
|
|
@@ -3084,14 +5068,256 @@ var _DivideExecutor = class _DivideExecutor {
|
|
|
3084
5068
|
};
|
|
3085
5069
|
__name(_DivideExecutor, "DivideExecutor");
|
|
3086
5070
|
var DivideExecutor = _DivideExecutor;
|
|
3087
|
-
DivideExecutor =
|
|
5071
|
+
DivideExecutor = _ts_decorate9([
|
|
3088
5072
|
RegisterNode(DivideTemplate)
|
|
3089
5073
|
], DivideExecutor);
|
|
5074
|
+
|
|
5075
|
+
// src/nodes/time/GetDeltaTime.ts
|
|
5076
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
5077
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5078
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5079
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5080
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5081
|
+
}
|
|
5082
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
5083
|
+
var GetDeltaTimeTemplate = {
|
|
5084
|
+
type: "GetDeltaTime",
|
|
5085
|
+
title: "Get Delta Time",
|
|
5086
|
+
category: "time",
|
|
5087
|
+
color: "#4FC3F7",
|
|
5088
|
+
description: "Returns the time elapsed since the last frame in seconds (\u8FD4\u56DE\u4E0A\u4E00\u5E27\u4EE5\u6765\u7ECF\u8FC7\u7684\u65F6\u95F4\uFF0C\u5355\u4F4D\u79D2)",
|
|
5089
|
+
keywords: [
|
|
5090
|
+
"delta",
|
|
5091
|
+
"time",
|
|
5092
|
+
"frame",
|
|
5093
|
+
"dt"
|
|
5094
|
+
],
|
|
5095
|
+
isPure: true,
|
|
5096
|
+
inputs: [],
|
|
5097
|
+
outputs: [
|
|
5098
|
+
{
|
|
5099
|
+
name: "deltaTime",
|
|
5100
|
+
type: "float",
|
|
5101
|
+
displayName: "Delta Seconds"
|
|
5102
|
+
}
|
|
5103
|
+
]
|
|
5104
|
+
};
|
|
5105
|
+
var _GetDeltaTimeExecutor = class _GetDeltaTimeExecutor {
|
|
5106
|
+
execute(_node, context) {
|
|
5107
|
+
return {
|
|
5108
|
+
outputs: {
|
|
5109
|
+
deltaTime: context.deltaTime
|
|
5110
|
+
}
|
|
5111
|
+
};
|
|
5112
|
+
}
|
|
5113
|
+
};
|
|
5114
|
+
__name(_GetDeltaTimeExecutor, "GetDeltaTimeExecutor");
|
|
5115
|
+
var GetDeltaTimeExecutor = _GetDeltaTimeExecutor;
|
|
5116
|
+
GetDeltaTimeExecutor = _ts_decorate10([
|
|
5117
|
+
RegisterNode(GetDeltaTimeTemplate)
|
|
5118
|
+
], GetDeltaTimeExecutor);
|
|
5119
|
+
|
|
5120
|
+
// src/nodes/time/GetTime.ts
|
|
5121
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
5122
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5123
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5124
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5125
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5126
|
+
}
|
|
5127
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
5128
|
+
var GetTimeTemplate = {
|
|
5129
|
+
type: "GetTime",
|
|
5130
|
+
title: "Get Game Time",
|
|
5131
|
+
category: "time",
|
|
5132
|
+
color: "#4FC3F7",
|
|
5133
|
+
description: "Returns the total time since the blueprint started in seconds (\u8FD4\u56DE\u84DD\u56FE\u542F\u52A8\u4EE5\u6765\u7684\u603B\u65F6\u95F4\uFF0C\u5355\u4F4D\u79D2)",
|
|
5134
|
+
keywords: [
|
|
5135
|
+
"time",
|
|
5136
|
+
"total",
|
|
5137
|
+
"elapsed",
|
|
5138
|
+
"game"
|
|
5139
|
+
],
|
|
5140
|
+
isPure: true,
|
|
5141
|
+
inputs: [],
|
|
5142
|
+
outputs: [
|
|
5143
|
+
{
|
|
5144
|
+
name: "time",
|
|
5145
|
+
type: "float",
|
|
5146
|
+
displayName: "Seconds"
|
|
5147
|
+
}
|
|
5148
|
+
]
|
|
5149
|
+
};
|
|
5150
|
+
var _GetTimeExecutor = class _GetTimeExecutor {
|
|
5151
|
+
execute(_node, context) {
|
|
5152
|
+
return {
|
|
5153
|
+
outputs: {
|
|
5154
|
+
time: context.time
|
|
5155
|
+
}
|
|
5156
|
+
};
|
|
5157
|
+
}
|
|
5158
|
+
};
|
|
5159
|
+
__name(_GetTimeExecutor, "GetTimeExecutor");
|
|
5160
|
+
var GetTimeExecutor = _GetTimeExecutor;
|
|
5161
|
+
GetTimeExecutor = _ts_decorate11([
|
|
5162
|
+
RegisterNode(GetTimeTemplate)
|
|
5163
|
+
], GetTimeExecutor);
|
|
5164
|
+
|
|
5165
|
+
// src/nodes/time/Delay.ts
|
|
5166
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
5167
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5168
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5169
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5170
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5171
|
+
}
|
|
5172
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
5173
|
+
var DelayTemplate = {
|
|
5174
|
+
type: "Delay",
|
|
5175
|
+
title: "Delay",
|
|
5176
|
+
category: "flow",
|
|
5177
|
+
color: "#FFFFFF",
|
|
5178
|
+
description: "Pauses execution for a specified number of seconds (\u6682\u505C\u6267\u884C\u6307\u5B9A\u7684\u79D2\u6570)",
|
|
5179
|
+
keywords: [
|
|
5180
|
+
"wait",
|
|
5181
|
+
"delay",
|
|
5182
|
+
"pause",
|
|
5183
|
+
"sleep",
|
|
5184
|
+
"timer"
|
|
5185
|
+
],
|
|
5186
|
+
inputs: [
|
|
5187
|
+
{
|
|
5188
|
+
name: "exec",
|
|
5189
|
+
type: "exec",
|
|
5190
|
+
displayName: ""
|
|
5191
|
+
},
|
|
5192
|
+
{
|
|
5193
|
+
name: "duration",
|
|
5194
|
+
type: "float",
|
|
5195
|
+
displayName: "Duration",
|
|
5196
|
+
defaultValue: 1
|
|
5197
|
+
}
|
|
5198
|
+
],
|
|
5199
|
+
outputs: [
|
|
5200
|
+
{
|
|
5201
|
+
name: "exec",
|
|
5202
|
+
type: "exec",
|
|
5203
|
+
displayName: "Completed"
|
|
5204
|
+
}
|
|
5205
|
+
]
|
|
5206
|
+
};
|
|
5207
|
+
var _DelayExecutor = class _DelayExecutor {
|
|
5208
|
+
execute(node, context) {
|
|
5209
|
+
const duration = context.evaluateInput(node.id, "duration", 1);
|
|
5210
|
+
return {
|
|
5211
|
+
nextExec: "exec",
|
|
5212
|
+
delay: duration
|
|
5213
|
+
};
|
|
5214
|
+
}
|
|
5215
|
+
};
|
|
5216
|
+
__name(_DelayExecutor, "DelayExecutor");
|
|
5217
|
+
var DelayExecutor = _DelayExecutor;
|
|
5218
|
+
DelayExecutor = _ts_decorate12([
|
|
5219
|
+
RegisterNode(DelayTemplate)
|
|
5220
|
+
], DelayExecutor);
|
|
5221
|
+
|
|
5222
|
+
// src/nodes/debug/Print.ts
|
|
5223
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
5224
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5225
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5226
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5227
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5228
|
+
}
|
|
5229
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
5230
|
+
var PrintTemplate = {
|
|
5231
|
+
type: "Print",
|
|
5232
|
+
title: "Print String",
|
|
5233
|
+
category: "debug",
|
|
5234
|
+
color: "#785EF0",
|
|
5235
|
+
description: "Prints a message to the console for debugging (\u6253\u5370\u6D88\u606F\u5230\u63A7\u5236\u53F0\u7528\u4E8E\u8C03\u8BD5)",
|
|
5236
|
+
keywords: [
|
|
5237
|
+
"log",
|
|
5238
|
+
"debug",
|
|
5239
|
+
"console",
|
|
5240
|
+
"output",
|
|
5241
|
+
"print"
|
|
5242
|
+
],
|
|
5243
|
+
inputs: [
|
|
5244
|
+
{
|
|
5245
|
+
name: "exec",
|
|
5246
|
+
type: "exec",
|
|
5247
|
+
displayName: ""
|
|
5248
|
+
},
|
|
5249
|
+
{
|
|
5250
|
+
name: "message",
|
|
5251
|
+
type: "string",
|
|
5252
|
+
displayName: "Message",
|
|
5253
|
+
defaultValue: "Hello Blueprint!"
|
|
5254
|
+
},
|
|
5255
|
+
{
|
|
5256
|
+
name: "printToScreen",
|
|
5257
|
+
type: "bool",
|
|
5258
|
+
displayName: "Print to Screen",
|
|
5259
|
+
defaultValue: true
|
|
5260
|
+
},
|
|
5261
|
+
{
|
|
5262
|
+
name: "duration",
|
|
5263
|
+
type: "float",
|
|
5264
|
+
displayName: "Duration",
|
|
5265
|
+
defaultValue: 2
|
|
5266
|
+
}
|
|
5267
|
+
],
|
|
5268
|
+
outputs: [
|
|
5269
|
+
{
|
|
5270
|
+
name: "exec",
|
|
5271
|
+
type: "exec",
|
|
5272
|
+
displayName: ""
|
|
5273
|
+
}
|
|
5274
|
+
]
|
|
5275
|
+
};
|
|
5276
|
+
var _PrintExecutor = class _PrintExecutor {
|
|
5277
|
+
execute(node, context) {
|
|
5278
|
+
const message = context.evaluateInput(node.id, "message", "Hello Blueprint!");
|
|
5279
|
+
const printToScreen = context.evaluateInput(node.id, "printToScreen", true);
|
|
5280
|
+
const duration = context.evaluateInput(node.id, "duration", 2);
|
|
5281
|
+
console.log(`[Blueprint] ${message}`);
|
|
5282
|
+
if (printToScreen) {
|
|
5283
|
+
const event = new CustomEvent("blueprint:print", {
|
|
5284
|
+
detail: {
|
|
5285
|
+
message: String(message),
|
|
5286
|
+
duration: Number(duration),
|
|
5287
|
+
entityId: context.entity.id,
|
|
5288
|
+
entityName: context.entity.name
|
|
5289
|
+
}
|
|
5290
|
+
});
|
|
5291
|
+
if (typeof window !== "undefined") {
|
|
5292
|
+
window.dispatchEvent(event);
|
|
5293
|
+
}
|
|
5294
|
+
}
|
|
5295
|
+
return {
|
|
5296
|
+
nextExec: "exec"
|
|
5297
|
+
};
|
|
5298
|
+
}
|
|
5299
|
+
};
|
|
5300
|
+
__name(_PrintExecutor, "PrintExecutor");
|
|
5301
|
+
var PrintExecutor = _PrintExecutor;
|
|
5302
|
+
PrintExecutor = _ts_decorate13([
|
|
5303
|
+
RegisterNode(PrintTemplate)
|
|
5304
|
+
], PrintExecutor);
|
|
5305
|
+
|
|
5306
|
+
// src/index.ts
|
|
5307
|
+
function registerComponentClass(typeName, componentClass) {
|
|
5308
|
+
ExecutionContext.registerComponentClass(typeName, componentClass);
|
|
5309
|
+
}
|
|
5310
|
+
__name(registerComponentClass, "registerComponentClass");
|
|
3090
5311
|
export {
|
|
3091
5312
|
AlwaysFalseCondition,
|
|
3092
5313
|
AlwaysTrueCondition,
|
|
5314
|
+
BlueprintComponent,
|
|
3093
5315
|
BlueprintComposer,
|
|
5316
|
+
BlueprintExpose,
|
|
3094
5317
|
BlueprintFragment,
|
|
5318
|
+
BlueprintMethod,
|
|
5319
|
+
BlueprintProperty,
|
|
5320
|
+
BlueprintSystem,
|
|
3095
5321
|
BlueprintTrigger,
|
|
3096
5322
|
BlueprintVM,
|
|
3097
5323
|
CollisionEntityCondition,
|
|
@@ -3115,10 +5341,8 @@ export {
|
|
|
3115
5341
|
TriggerTypeCondition,
|
|
3116
5342
|
TriggerTypes,
|
|
3117
5343
|
arePinTypesCompatible,
|
|
3118
|
-
|
|
5344
|
+
clearRegisteredComponents,
|
|
3119
5345
|
condition,
|
|
3120
|
-
createBlueprintComponentData,
|
|
3121
|
-
createBlueprintSystem,
|
|
3122
5346
|
createCollisionContext,
|
|
3123
5347
|
createCollisionTrigger,
|
|
3124
5348
|
createComposer,
|
|
@@ -3145,14 +5369,15 @@ export {
|
|
|
3145
5369
|
defaultFragmentRegistry,
|
|
3146
5370
|
fragmentFromAsset,
|
|
3147
5371
|
fragmentToAsset,
|
|
5372
|
+
generateComponentNodes,
|
|
5373
|
+
getBlueprintMetadata,
|
|
3148
5374
|
getNodeCategoryColor,
|
|
3149
5375
|
getPinTypeColor,
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
triggerCustomBlueprintEvent,
|
|
5376
|
+
getRegisteredBlueprintComponents,
|
|
5377
|
+
inferPinType,
|
|
5378
|
+
registerAllComponentNodes,
|
|
5379
|
+
registerComponentClass,
|
|
5380
|
+
registerComponentNodes,
|
|
3156
5381
|
validateBlueprintAsset
|
|
3157
5382
|
};
|
|
3158
5383
|
//# sourceMappingURL=index.js.map
|