Commit 9c2e8a8c authored by rockyl's avatar rockyl

内联过程实现

parent 636a22bd
......@@ -4,18 +4,18 @@
"props": {
"left": {
"alias": "左值",
"type": "any",
"type": "data",
"default": ""
},
"right": {
"alias": "右值",
"type": "any",
"type": "data",
"default": ""
},
"strict": {
"alias": "严格模式",
"type": "any",
"default": ""
"type": "boolean",
"default": false
},
"operator": {
"alias": "操作符",
......@@ -36,7 +36,7 @@
"unequal"
],
"id": "compare",
"script": "setTimeout(function () {\n next('complete');\n}, args ? args.duration : (props.duration || 0));\n",
"script": "var leftValue = typeof props.left === 'object' ? args[props.left.path] : props.left;\nvar rightValue = typeof props.right === 'object' ? args[props.right.path] : props.right;\nvar operator = args ? args.operator : props.operator;\nif (operator.length === 2 && operator[operator.length - 1] === '=') {\n operator += '=';\n}\nvar func = new Function('return ' + leftValue + operator + rightValue);\nvar result = func();\nnext(result ? 'equal' : 'unequal');\n",
"group": "base",
"type": "builtin"
}
{
"name": "获取数据",
"desc": "从数据中心获取数据,优先判断名称",
"props": {
"name": {
"type": "string",
"alias": "名称"
},
"path": {
"type": "string",
"alias": "路径"
}
},
"output": [
"success"
],
"id": "get-data",
"script": "var data;\nif (props.path) {\n data = engine.gameStage.dataCenter.getDataByPath(props.path);\n}\nelse {\n data = engine.gameStage.dataCenter.getGroup(props.name);\n}\nnext('success', data);\n",
"group": "base",
"type": "builtin"
}
......@@ -17,7 +17,7 @@
"success"
],
"id": "log",
"script": "var leftValue = typeof props.left === 'object' ? args[props.left.path] : props.left;\nvar rightValue = typeof props.right === 'object' ? args[props.right.path] : props.right;\nvar func = new Function('return ' + leftValue + args.operator + rightValue);\nvar result = func();\nnext(result ? 'equal' : 'unequal');\n",
"script": "console.log(props ? props.content : (args ? args.content : ''));\nnext('success');\n",
"group": "base",
"type": "builtin"
}
{
"name": "兑吧接口转换",
"desc": "将http请求返回成兑吧接口的解析",
"props": {},
"output": [
"success",
"failed"
],
"id": "duiba-api-transform",
"script": "if (args.success) {\n next('success', args.data);\n}\nelse {\n next('failed');\n}\n",
"group": "duiba",
"type": "builtin"
}
......@@ -4,7 +4,6 @@
"props": {
"url": {
"type": "string",
"enum": [],
"alias": "链接"
},
"method": {
......@@ -18,7 +17,6 @@
},
"name": {
"type": "string",
"enum": [],
"alias": "数据名"
}
},
......@@ -27,8 +25,8 @@
"failed"
],
"sub": {
"8fe4ca2c-8cf1-4f9a-b302-82c830d15647": {
"uuid": "8fe4ca2c-8cf1-4f9a-b302-82c830d15647",
"5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56": {
"uuid": "5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56",
"meta": "entry",
"design": {
"x": 10,
......@@ -38,7 +36,7 @@
"success": [
{
"x": 124.5,
"y": 11
"y": 31
}
]
}
......@@ -46,21 +44,21 @@
"props": {},
"output": {
"success": [
"5f66a293-aa9f-4bb1-bfa8-d9286548df6f"
"69e28053-dfb3-459e-a9e5-4964c6e35193"
]
}
},
"5f66a293-aa9f-4bb1-bfa8-d9286548df6f": {
"uuid": "5f66a293-aa9f-4bb1-bfa8-d9286548df6f",
"69e28053-dfb3-459e-a9e5-4964c6e35193": {
"uuid": "69e28053-dfb3-459e-a9e5-4964c6e35193",
"meta": "http-request",
"design": {
"x": 98,
"y": 103,
"x": 67,
"y": 139,
"input": {
"default": [
{
"x": 5.5,
"y": 28
"y": 47.5
}
]
},
......@@ -68,44 +66,48 @@
"success": [
{
"x": 124.5,
"y": 14
"y": 33.5
}
],
"failed": [
{
"x": 124.5,
"y": 28
"y": 47.5
}
],
"exception": [
{
"x": 124.5,
"y": 42
"y": 61.5
}
]
}
},
"props": {
"url": {},
"method": {}
"url": {
"type": "link"
},
"method": {
"type": "link"
}
},
"output": {
"success": [
"fbaae92e-d20c-4dc2-8801-37cb224f358b"
"39dce565-539b-44b6-901c-0344467795a8"
]
}
},
"fbaae92e-d20c-4dc2-8801-37cb224f358b": {
"uuid": "fbaae92e-d20c-4dc2-8801-37cb224f358b",
"39dce565-539b-44b6-901c-0344467795a8": {
"uuid": "39dce565-539b-44b6-901c-0344467795a8",
"meta": "duiba-api-transform",
"design": {
"x": 148,
"y": 269,
"x": 184,
"y": 275,
"input": {
"default": [
{
"x": 5.5,
"y": 11
"y": 30.5
}
]
},
......@@ -113,13 +115,13 @@
"success": [
{
"x": 124.5,
"y": 4
"y": 23.5
}
],
"failed": [
{
"x": 124.5,
"y": 18
"y": 37.5
}
]
}
......@@ -127,21 +129,21 @@
"props": {},
"output": {
"success": [
"91fd3e42-4922-4fc2-ac0e-bc8f8875349c"
"e95e7bbc-b592-4f87-b433-77fd03a9ef51"
]
}
},
"91fd3e42-4922-4fc2-ac0e-bc8f8875349c": {
"uuid": "91fd3e42-4922-4fc2-ac0e-bc8f8875349c",
"e95e7bbc-b592-4f87-b433-77fd03a9ef51": {
"uuid": "e95e7bbc-b592-4f87-b433-77fd03a9ef51",
"meta": "put-data",
"design": {
"x": 213,
"y": 372,
"x": 280,
"y": 367,
"input": {
"default": [
{
"x": 5.5,
"y": 28
"y": 47.5
}
]
},
......@@ -149,18 +151,34 @@
"success": [
{
"x": 124.5,
"y": 28
"y": 47.5
}
]
}
},
"props": {
"name": {}
"name": {
"type": "link"
}
},
"output": {}
}
},
"subEntry": "8fe4ca2c-8cf1-4f9a-b302-82c830d15647",
"subEntry": "5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56",
"metas": [
{
"id": "duiba-api-transform",
"script": "if (args.success) {\n next('success', args.data);\n}\nelse {\n next('failed');\n}\n",
"props": {},
"isInline": true,
"name": "兑吧接口转换",
"output": [
"success",
"failed"
],
"desc": "将http请求返回成兑吧接口的解析"
}
],
"id": "duiba-api",
"script": "next('success');\n",
"group": "duiba",
......
......@@ -2,6 +2,12 @@
* Created by rockyl on 2019-11-16.
*/
setTimeout(function(){
next('complete')
}, args ? args.duration : (props.duration || 0));
let leftValue = typeof props.left === 'object' ? args[props.left.path] : props.left;
let rightValue = typeof props.right === 'object' ? args[props.right.path] : props.right;
let operator = args ? args.operator : props.operator;
if(operator.length === 2 && operator[operator.length -1] === '='){
operator += '=';
}
let func = new Function('return ' + leftValue + operator + rightValue);
let result = func();
next(result ? 'equal' : 'unequal');
......@@ -2,9 +2,9 @@
"name": "比较",
"desc": "比较两个值",
"props": {
"left": {"alias": "左值","type": "any", "default": ""},
"right": {"alias": "右值","type": "any", "default": ""},
"strict": {"alias": "严格模式","type": "any", "default": ""},
"left": {"alias": "左值","type": "data", "default": ""},
"right": {"alias": "右值","type": "data", "default": ""},
"strict": {"alias": "严格模式","type": "boolean", "default": false},
"operator": {"alias": "操作符","type": "enum",
"enum": ["==",">",">=","<","<=","!="],
"default": "=="}
......
/**
* Created by rockyl on 2019-11-16.
*/
let data;
if(props.path){
data = engine.gameStage.dataCenter.getDataByPath(props.path);
}else{
data = engine.gameStage.dataCenter.getGroup(props.name);
}
next('success', data);
{
"name": "获取数据",
"desc": "从数据中心获取数据,优先判断名称",
"props": {
"name": {
"type": "string",
"alias": "名称"
},
"path": {
"type": "string",
"alias": "路径"
}
},
"output": [
"success"
]
}
......@@ -2,8 +2,5 @@
* Created by rockyl on 2019-11-16.
*/
let leftValue = typeof props.left === 'object' ? args[props.left.path] : props.left;
let rightValue = typeof props.right === 'object' ? args[props.right.path] : props.right;
let func = new Function('return ' + leftValue + args.operator + rightValue);
let result = func();
next(result ? 'equal' : 'unequal');
console.log(props ? props.content : (args ? args.content : ''));
next('success');
\ No newline at end of file
/**
* Created by rockyl on 2019-11-16.
*/
if(args.success){
next('success', args.data);
}else{
next('failed')
}
\ No newline at end of file
{
"name": "兑吧接口转换",
"desc": "将http请求返回成兑吧接口的解析",
"props": {},
"output": [
"success",
"failed"
]
}
\ No newline at end of file
......@@ -4,7 +4,6 @@
"props": {
"url": {
"type": "string",
"enum": [],
"alias": "链接"
},
"method": {
......@@ -18,7 +17,6 @@
},
"name": {
"type": "string",
"enum": [],
"alias": "数据名"
}
},
......@@ -27,8 +25,8 @@
"failed"
],
"sub": {
"8fe4ca2c-8cf1-4f9a-b302-82c830d15647": {
"uuid": "8fe4ca2c-8cf1-4f9a-b302-82c830d15647",
"5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56": {
"uuid": "5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56",
"meta": "entry",
"design": {
"x": 10,
......@@ -38,7 +36,7 @@
"success": [
{
"x": 124.5,
"y": 11
"y": 31
}
]
}
......@@ -46,21 +44,21 @@
"props": {},
"output": {
"success": [
"5f66a293-aa9f-4bb1-bfa8-d9286548df6f"
"69e28053-dfb3-459e-a9e5-4964c6e35193"
]
}
},
"5f66a293-aa9f-4bb1-bfa8-d9286548df6f": {
"uuid": "5f66a293-aa9f-4bb1-bfa8-d9286548df6f",
"69e28053-dfb3-459e-a9e5-4964c6e35193": {
"uuid": "69e28053-dfb3-459e-a9e5-4964c6e35193",
"meta": "http-request",
"design": {
"x": 98,
"y": 103,
"x": 67,
"y": 139,
"input": {
"default": [
{
"x": 5.5,
"y": 28
"y": 47.5
}
]
},
......@@ -68,44 +66,48 @@
"success": [
{
"x": 124.5,
"y": 14
"y": 33.5
}
],
"failed": [
{
"x": 124.5,
"y": 28
"y": 47.5
}
],
"exception": [
{
"x": 124.5,
"y": 42
"y": 61.5
}
]
}
},
"props": {
"url": {},
"method": {}
"url": {
"type": "link"
},
"method": {
"type": "link"
}
},
"output": {
"success": [
"fbaae92e-d20c-4dc2-8801-37cb224f358b"
"39dce565-539b-44b6-901c-0344467795a8"
]
}
},
"fbaae92e-d20c-4dc2-8801-37cb224f358b": {
"uuid": "fbaae92e-d20c-4dc2-8801-37cb224f358b",
"39dce565-539b-44b6-901c-0344467795a8": {
"uuid": "39dce565-539b-44b6-901c-0344467795a8",
"meta": "duiba-api-transform",
"design": {
"x": 148,
"y": 269,
"x": 184,
"y": 275,
"input": {
"default": [
{
"x": 5.5,
"y": 11
"y": 30.5
}
]
},
......@@ -113,13 +115,13 @@
"success": [
{
"x": 124.5,
"y": 4
"y": 23.5
}
],
"failed": [
{
"x": 124.5,
"y": 18
"y": 37.5
}
]
}
......@@ -127,21 +129,21 @@
"props": {},
"output": {
"success": [
"91fd3e42-4922-4fc2-ac0e-bc8f8875349c"
"e95e7bbc-b592-4f87-b433-77fd03a9ef51"
]
}
},
"91fd3e42-4922-4fc2-ac0e-bc8f8875349c": {
"uuid": "91fd3e42-4922-4fc2-ac0e-bc8f8875349c",
"e95e7bbc-b592-4f87-b433-77fd03a9ef51": {
"uuid": "e95e7bbc-b592-4f87-b433-77fd03a9ef51",
"meta": "put-data",
"design": {
"x": 213,
"y": 372,
"x": 280,
"y": 367,
"input": {
"default": [
{
"x": 5.5,
"y": 28
"y": 47.5
}
]
},
......@@ -149,16 +151,32 @@
"success": [
{
"x": 124.5,
"y": 28
"y": 47.5
}
]
}
},
"props": {
"name": {}
"name": {
"type": "link"
}
},
"output": {}
}
},
"subEntry": "8fe4ca2c-8cf1-4f9a-b302-82c830d15647"
"subEntry": "5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56",
"metas": [
{
"id": "duiba-api-transform",
"script": "if (args.success) {\n next('success', args.data);\n}\nelse {\n next('failed');\n}\n",
"props": {},
"isInline": true,
"name": "兑吧接口转换",
"output": [
"success",
"failed"
],
"desc": "将http请求返回成兑吧接口的解析"
}
]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment