Skip to content

Commit 678a3ec

Browse files
committed
✨ 增加逻辑节点:#GET_LOCATION_BY_UUID#,根据UUID获得节点位置
1 parent ffbb043 commit 678a3ec

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

app/src/core/service/dataGenerateService/autoComputeEngine/functions/nodeLogic.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,24 @@ export namespace NodeLogic {
142142
return [];
143143
}
144144

145+
export function getLocationByUUID(
146+
fatherNodes: ConnectableEntity[],
147+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
148+
_childNodes: ConnectableEntity[],
149+
): string[] {
150+
const fatherNode1 = fatherNodes[0];
151+
if (fatherNode1 instanceof TextNode) {
152+
const findEntity = StageManager.getEntitiesByUUIDs([fatherNode1.text])[0];
153+
if (!findEntity) {
154+
return ["Error: cannot find entity by uuid"];
155+
}
156+
// 找到了实体
157+
const leftTop = findEntity.collisionBox.getRectangle().location;
158+
return [leftTop.x.toString(), leftTop.y.toString()];
159+
}
160+
return ["输入不是TextNode节点"];
161+
}
162+
145163
export function getSize(
146164
fatherNodes: ConnectableEntity[],
147165
// eslint-disable-next-line @typescript-eslint/no-unused-vars

app/src/core/service/dataGenerateService/autoComputeEngine/logicNodeNameEnum.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export enum LogicNodeNameEnum {
7575
GET_LOCATION = "#GET_LOCATION#",
7676
SET_LOCATION = "#SET_LOCATION#",
7777
SET_LOCATION_BY_UUID = "#SET_LOCATION_BY_UUID#",
78+
GET_LOCATION_BY_UUID = "#GET_LOCATION_BY_UUID#",
7879
GET_SIZE = "#GET_SIZE#",
7980
GET_MOUSE_LOCATION = "#GET_MOUSE_LOCATION#",
8081
GET_MOUSE_WORLD_LOCATION = "#GET_MOUSE_WORLD_LOCATION#",
@@ -160,6 +161,7 @@ export const LogicNodeNameToRenderNameMap: {
160161
[LogicNodeNameEnum.GET_LOCATION]: "获取节点位置",
161162
[LogicNodeNameEnum.SET_LOCATION]: "设置节点位置",
162163
[LogicNodeNameEnum.SET_LOCATION_BY_UUID]: "根据UUID设置节点位置",
164+
[LogicNodeNameEnum.GET_LOCATION_BY_UUID]: "根据UUID获得节点位置",
163165
[LogicNodeNameEnum.GET_SIZE]: "获取节点大小",
164166
[LogicNodeNameEnum.GET_MOUSE_LOCATION]: "获取鼠标窗口位置",
165167
[LogicNodeNameEnum.GET_MOUSE_WORLD_LOCATION]: "获取鼠标世界位置",
@@ -251,6 +253,7 @@ export const LogicNodeNameToArgsTipsMap: {
251253
[LogicNodeNameEnum.GET_LOCATION]: "a0: node",
252254
[LogicNodeNameEnum.SET_LOCATION]: "a0: x, a1: y",
253255
[LogicNodeNameEnum.SET_LOCATION_BY_UUID]: "a0: uuid, a1: x, a2: y",
256+
[LogicNodeNameEnum.GET_LOCATION_BY_UUID]: "a0: uuid",
254257
[LogicNodeNameEnum.GET_SIZE]: "a0: node",
255258
[LogicNodeNameEnum.GET_MOUSE_LOCATION]: "无输入",
256259
[LogicNodeNameEnum.GET_MOUSE_WORLD_LOCATION]: "无输入",

app/src/core/service/dataGenerateService/autoComputeEngine/mainTick.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ const MapOtherFunction: OtherFunctionMap = {
133133
[LogicNodeNameEnum.GET_LOCATION]: NodeLogic.getLocation,
134134
[LogicNodeNameEnum.SET_LOCATION]: NodeLogic.setLocation,
135135
[LogicNodeNameEnum.SET_LOCATION_BY_UUID]: NodeLogic.setLocationByUUID,
136+
[LogicNodeNameEnum.GET_LOCATION_BY_UUID]: NodeLogic.getLocationByUUID,
136137
[LogicNodeNameEnum.GET_SIZE]: NodeLogic.getSize,
137138
[LogicNodeNameEnum.GET_MOUSE_LOCATION]: NodeLogic.getMouseLocation,
138139
[LogicNodeNameEnum.GET_MOUSE_WORLD_LOCATION]: NodeLogic.getMouseWorldLocation,

0 commit comments

Comments
 (0)