Commit 9c2e8a8c authored by rockyl's avatar rockyl

内联过程实现

parent 636a22bd
...@@ -4,18 +4,18 @@ ...@@ -4,18 +4,18 @@
"props": { "props": {
"left": { "left": {
"alias": "左值", "alias": "左值",
"type": "any", "type": "data",
"default": "" "default": ""
}, },
"right": { "right": {
"alias": "右值", "alias": "右值",
"type": "any", "type": "data",
"default": "" "default": ""
}, },
"strict": { "strict": {
"alias": "严格模式", "alias": "严格模式",
"type": "any", "type": "boolean",
"default": "" "default": false
}, },
"operator": { "operator": {
"alias": "操作符", "alias": "操作符",
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
"unequal" "unequal"
], ],
"id": "compare", "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", "group": "base",
"type": "builtin" "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 @@ ...@@ -17,7 +17,7 @@
"success" "success"
], ],
"id": "log", "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", "group": "base",
"type": "builtin" "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 @@ ...@@ -4,7 +4,6 @@
"props": { "props": {
"url": { "url": {
"type": "string", "type": "string",
"enum": [],
"alias": "链接" "alias": "链接"
}, },
"method": { "method": {
...@@ -18,7 +17,6 @@ ...@@ -18,7 +17,6 @@
}, },
"name": { "name": {
"type": "string", "type": "string",
"enum": [],
"alias": "数据名" "alias": "数据名"
} }
}, },
...@@ -27,8 +25,8 @@ ...@@ -27,8 +25,8 @@
"failed" "failed"
], ],
"sub": { "sub": {
"8fe4ca2c-8cf1-4f9a-b302-82c830d15647": { "5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56": {
"uuid": "8fe4ca2c-8cf1-4f9a-b302-82c830d15647", "uuid": "5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56",
"meta": "entry", "meta": "entry",
"design": { "design": {
"x": 10, "x": 10,
...@@ -38,7 +36,7 @@ ...@@ -38,7 +36,7 @@
"success": [ "success": [
{ {
"x": 124.5, "x": 124.5,
"y": 11 "y": 31
} }
] ]
} }
...@@ -46,21 +44,21 @@ ...@@ -46,21 +44,21 @@
"props": {}, "props": {},
"output": { "output": {
"success": [ "success": [
"5f66a293-aa9f-4bb1-bfa8-d9286548df6f" "69e28053-dfb3-459e-a9e5-4964c6e35193"
] ]
} }
}, },
"5f66a293-aa9f-4bb1-bfa8-d9286548df6f": { "69e28053-dfb3-459e-a9e5-4964c6e35193": {
"uuid": "5f66a293-aa9f-4bb1-bfa8-d9286548df6f", "uuid": "69e28053-dfb3-459e-a9e5-4964c6e35193",
"meta": "http-request", "meta": "http-request",
"design": { "design": {
"x": 98, "x": 67,
"y": 103, "y": 139,
"input": { "input": {
"default": [ "default": [
{ {
"x": 5.5, "x": 5.5,
"y": 28 "y": 47.5
} }
] ]
}, },
...@@ -68,44 +66,48 @@ ...@@ -68,44 +66,48 @@
"success": [ "success": [
{ {
"x": 124.5, "x": 124.5,
"y": 14 "y": 33.5
} }
], ],
"failed": [ "failed": [
{ {
"x": 124.5, "x": 124.5,
"y": 28 "y": 47.5
} }
], ],
"exception": [ "exception": [
{ {
"x": 124.5, "x": 124.5,
"y": 42 "y": 61.5
} }
] ]
} }
}, },
"props": { "props": {
"url": {}, "url": {
"method": {} "type": "link"
},
"method": {
"type": "link"
}
}, },
"output": { "output": {
"success": [ "success": [
"fbaae92e-d20c-4dc2-8801-37cb224f358b" "39dce565-539b-44b6-901c-0344467795a8"
] ]
} }
}, },
"fbaae92e-d20c-4dc2-8801-37cb224f358b": { "39dce565-539b-44b6-901c-0344467795a8": {
"uuid": "fbaae92e-d20c-4dc2-8801-37cb224f358b", "uuid": "39dce565-539b-44b6-901c-0344467795a8",
"meta": "duiba-api-transform", "meta": "duiba-api-transform",
"design": { "design": {
"x": 148, "x": 184,
"y": 269, "y": 275,
"input": { "input": {
"default": [ "default": [
{ {
"x": 5.5, "x": 5.5,
"y": 11 "y": 30.5
} }
] ]
}, },
...@@ -113,13 +115,13 @@ ...@@ -113,13 +115,13 @@
"success": [ "success": [
{ {
"x": 124.5, "x": 124.5,
"y": 4 "y": 23.5
} }
], ],
"failed": [ "failed": [
{ {
"x": 124.5, "x": 124.5,
"y": 18 "y": 37.5
} }
] ]
} }
...@@ -127,21 +129,21 @@ ...@@ -127,21 +129,21 @@
"props": {}, "props": {},
"output": { "output": {
"success": [ "success": [
"91fd3e42-4922-4fc2-ac0e-bc8f8875349c" "e95e7bbc-b592-4f87-b433-77fd03a9ef51"
] ]
} }
}, },
"91fd3e42-4922-4fc2-ac0e-bc8f8875349c": { "e95e7bbc-b592-4f87-b433-77fd03a9ef51": {
"uuid": "91fd3e42-4922-4fc2-ac0e-bc8f8875349c", "uuid": "e95e7bbc-b592-4f87-b433-77fd03a9ef51",
"meta": "put-data", "meta": "put-data",
"design": { "design": {
"x": 213, "x": 280,
"y": 372, "y": 367,
"input": { "input": {
"default": [ "default": [
{ {
"x": 5.5, "x": 5.5,
"y": 28 "y": 47.5
} }
] ]
}, },
...@@ -149,18 +151,34 @@ ...@@ -149,18 +151,34 @@
"success": [ "success": [
{ {
"x": 124.5, "x": 124.5,
"y": 28 "y": 47.5
} }
] ]
} }
}, },
"props": { "props": {
"name": {} "name": {
"type": "link"
}
}, },
"output": {} "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", "id": "duiba-api",
"script": "next('success');\n", "script": "next('success');\n",
"group": "duiba", "group": "duiba",
......
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
* Created by rockyl on 2019-11-16. * Created by rockyl on 2019-11-16.
*/ */
setTimeout(function(){ let leftValue = typeof props.left === 'object' ? args[props.left.path] : props.left;
next('complete') let rightValue = typeof props.right === 'object' ? args[props.right.path] : props.right;
}, args ? args.duration : (props.duration || 0)); 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 @@ ...@@ -2,9 +2,9 @@
"name": "比较", "name": "比较",
"desc": "比较两个值", "desc": "比较两个值",
"props": { "props": {
"left": {"alias": "左值","type": "any", "default": ""}, "left": {"alias": "左值","type": "data", "default": ""},
"right": {"alias": "右值","type": "any", "default": ""}, "right": {"alias": "右值","type": "data", "default": ""},
"strict": {"alias": "严格模式","type": "any", "default": ""}, "strict": {"alias": "严格模式","type": "boolean", "default": false},
"operator": {"alias": "操作符","type": "enum", "operator": {"alias": "操作符","type": "enum",
"enum": ["==",">",">=","<","<=","!="], "enum": ["==",">",">=","<","<=","!="],
"default": "=="} "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 @@ ...@@ -2,8 +2,5 @@
* Created by rockyl on 2019-11-16. * Created by rockyl on 2019-11-16.
*/ */
let leftValue = typeof props.left === 'object' ? args[props.left.path] : props.left; console.log(props ? props.content : (args ? args.content : ''));
let rightValue = typeof props.right === 'object' ? args[props.right.path] : props.right; next('success');
let func = new Function('return ' + leftValue + args.operator + rightValue); \ No newline at end of file
let result = func();
next(result ? 'equal' : 'unequal');
/**
* 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 @@ ...@@ -4,7 +4,6 @@
"props": { "props": {
"url": { "url": {
"type": "string", "type": "string",
"enum": [],
"alias": "链接" "alias": "链接"
}, },
"method": { "method": {
...@@ -18,7 +17,6 @@ ...@@ -18,7 +17,6 @@
}, },
"name": { "name": {
"type": "string", "type": "string",
"enum": [],
"alias": "数据名" "alias": "数据名"
} }
}, },
...@@ -27,8 +25,8 @@ ...@@ -27,8 +25,8 @@
"failed" "failed"
], ],
"sub": { "sub": {
"8fe4ca2c-8cf1-4f9a-b302-82c830d15647": { "5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56": {
"uuid": "8fe4ca2c-8cf1-4f9a-b302-82c830d15647", "uuid": "5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56",
"meta": "entry", "meta": "entry",
"design": { "design": {
"x": 10, "x": 10,
...@@ -38,7 +36,7 @@ ...@@ -38,7 +36,7 @@
"success": [ "success": [
{ {
"x": 124.5, "x": 124.5,
"y": 11 "y": 31
} }
] ]
} }
...@@ -46,21 +44,21 @@ ...@@ -46,21 +44,21 @@
"props": {}, "props": {},
"output": { "output": {
"success": [ "success": [
"5f66a293-aa9f-4bb1-bfa8-d9286548df6f" "69e28053-dfb3-459e-a9e5-4964c6e35193"
] ]
} }
}, },
"5f66a293-aa9f-4bb1-bfa8-d9286548df6f": { "69e28053-dfb3-459e-a9e5-4964c6e35193": {
"uuid": "5f66a293-aa9f-4bb1-bfa8-d9286548df6f", "uuid": "69e28053-dfb3-459e-a9e5-4964c6e35193",
"meta": "http-request", "meta": "http-request",
"design": { "design": {
"x": 98, "x": 67,
"y": 103, "y": 139,
"input": { "input": {
"default": [ "default": [
{ {
"x": 5.5, "x": 5.5,
"y": 28 "y": 47.5
} }
] ]
}, },
...@@ -68,44 +66,48 @@ ...@@ -68,44 +66,48 @@
"success": [ "success": [
{ {
"x": 124.5, "x": 124.5,
"y": 14 "y": 33.5
} }
], ],
"failed": [ "failed": [
{ {
"x": 124.5, "x": 124.5,
"y": 28 "y": 47.5
} }
], ],
"exception": [ "exception": [
{ {
"x": 124.5, "x": 124.5,
"y": 42 "y": 61.5
} }
] ]
} }
}, },
"props": { "props": {
"url": {}, "url": {
"method": {} "type": "link"
},
"method": {
"type": "link"
}
}, },
"output": { "output": {
"success": [ "success": [
"fbaae92e-d20c-4dc2-8801-37cb224f358b" "39dce565-539b-44b6-901c-0344467795a8"
] ]
} }
}, },
"fbaae92e-d20c-4dc2-8801-37cb224f358b": { "39dce565-539b-44b6-901c-0344467795a8": {
"uuid": "fbaae92e-d20c-4dc2-8801-37cb224f358b", "uuid": "39dce565-539b-44b6-901c-0344467795a8",
"meta": "duiba-api-transform", "meta": "duiba-api-transform",
"design": { "design": {
"x": 148, "x": 184,
"y": 269, "y": 275,
"input": { "input": {
"default": [ "default": [
{ {
"x": 5.5, "x": 5.5,
"y": 11 "y": 30.5
} }
] ]
}, },
...@@ -113,13 +115,13 @@ ...@@ -113,13 +115,13 @@
"success": [ "success": [
{ {
"x": 124.5, "x": 124.5,
"y": 4 "y": 23.5
} }
], ],
"failed": [ "failed": [
{ {
"x": 124.5, "x": 124.5,
"y": 18 "y": 37.5
} }
] ]
} }
...@@ -127,21 +129,21 @@ ...@@ -127,21 +129,21 @@
"props": {}, "props": {},
"output": { "output": {
"success": [ "success": [
"91fd3e42-4922-4fc2-ac0e-bc8f8875349c" "e95e7bbc-b592-4f87-b433-77fd03a9ef51"
] ]
} }
}, },
"91fd3e42-4922-4fc2-ac0e-bc8f8875349c": { "e95e7bbc-b592-4f87-b433-77fd03a9ef51": {
"uuid": "91fd3e42-4922-4fc2-ac0e-bc8f8875349c", "uuid": "e95e7bbc-b592-4f87-b433-77fd03a9ef51",
"meta": "put-data", "meta": "put-data",
"design": { "design": {
"x": 213, "x": 280,
"y": 372, "y": 367,
"input": { "input": {
"default": [ "default": [
{ {
"x": 5.5, "x": 5.5,
"y": 28 "y": 47.5
} }
] ]
}, },
...@@ -149,16 +151,32 @@ ...@@ -149,16 +151,32 @@
"success": [ "success": [
{ {
"x": 124.5, "x": 124.5,
"y": 28 "y": 47.5
} }
] ]
} }
}, },
"props": { "props": {
"name": {} "name": {
"type": "link"
}
}, },
"output": {} "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