Commit 3d4630ab authored by rockyl's avatar rockyl

目录调整,修复一些bug

parent 092956b1
Pipeline #177390 failed with stages
in 0 seconds
var leftValue = typeof props.left === 'string' ? '"' + props.left + '"' : props.left;
var rightValue = typeof props.right === 'string' ? '"' + props.right + '"' : props.right;
var operator = (args ? args.operator : props.operator) || '==';
if (operator === '==' || operator === '!=') {
operator += '=';
}
var func = new Function('return ' + leftValue + operator + rightValue);
var result = func();
next(result ? 'true' : 'false');
...@@ -12,21 +12,18 @@ ...@@ -12,21 +12,18 @@
"type": "data", "type": "data",
"default": "" "default": ""
}, },
"strict": {
"alias": "严格模式",
"type": "boolean",
"default": false
},
"operator": { "operator": {
"alias": "操作符", "alias": "操作符",
"type": "enum", "type": "enum",
"enum": [ "enum": [
"==", "==",
"!=",
"===",
"!==",
">", ">",
">=", ">=",
"<", "<",
"<=", "<="
"!="
], ],
"default": "==" "default": "=="
} }
...@@ -36,7 +33,7 @@ ...@@ -36,7 +33,7 @@
"false" "false"
], ],
"id": "compare", "id": "compare",
"script": "var operator = (args ? args.operator : props.operator) || '==';\nif (operator === '==' || operator === '!=') {\n operator += '=';\n}\nvar func = new Function('return ' + props.left + operator + props.right);\nvar result = func();\nnext(result ? 'true' : 'false');\n", "script": "var leftValue = typeof props.left === 'string' ? '\"' + props.left + '\"' : props.left;\nvar rightValue = typeof props.right === 'string' ? '\"' + props.right + '\"' : props.right;\nvar operator = (args ? args.operator : props.operator) || '==';\nif (operator === '==' || operator === '!=') {\n operator += '=';\n}\nvar func = new Function('return ' + leftValue + operator + rightValue);\nvar result = func();\nnext(result ? 'true' : 'false');\n",
"group": "base", "group": "base",
"type": "builtin" "type": "builtin"
} }
var data;
if (props.path) {
data = engine.gameStage.dataCenter.getDataByPath(props.path);
}
else {
data = engine.gameStage.dataCenter.getGroup(props.name);
}
next('success', data);
if (args && args.url) {
location.href = args.url;
}
else if (props.url) {
location.href = props.url;
}
next('complete');
{
"name": "跳转页面",
"desc": "跳转页面",
"props": {
"url": {
"alias": "地址",
"type": "data"
}
},
"output": [
"complete"
],
"id": "jump",
"script": "if (args && args.url) {\n location.href = args.url;\n}\nelse if (props.url) {\n location.href = props.url;\n}\nnext('complete');\n",
"group": "base",
"type": "builtin"
}
console.log(props ? props.content : (args ? args.content : ''));
next('success');
engine.gameStage.dataCenter.mutate(props.name, args, props.path);
next('success', args);
setTimeout(function () {
next('complete');
}, args ? args.duration : props.duration);
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
"complete" "complete"
], ],
"id": "wait", "id": "wait",
"script": "setTimeout(function () {\n next('complete');\n}, args ? args.duration : (props.duration || 0));\n", "script": "setTimeout(function () {\n next('complete');\n}, args ? args.duration : props.duration);\n",
"group": "base", "group": "base",
"type": "builtin" "type": "builtin"
} }
var key = 'state-' + vm.id;
global[key] = true;
engine.Tween.get(props.target)
.set({ rotation: 0 })
.to({ rotation: 360 }, props.duration, engine.Ease.quintIn)
.call(function () {
next('success');
playLoop();
});
function playLoop() {
var goon = global[key];
if (goon) {
engine.Tween.get(props.target)
.set({ rotation: 0 })
.to({ rotation: 360 }, props.duration / 4)
.call(function () {
engine.globalEvent.dispatchEvent('loop-end');
playLoop();
});
}
}
{
"name": "入口",
"desc": "入口节点,每个行为的入口",
"props": {},
"output": [
"success"
],
"id": "turntable-start",
"script": "var key = 'state-' + vm.id;\nglobal[key] = true;\nengine.Tween.get(props.target)\n .set({ rotation: 0 })\n .to({ rotation: 360 }, props.duration, engine.Ease.quintIn)\n .call(function () {\n next('success');\n playLoop();\n});\nfunction playLoop() {\n var goon = global[key];\n if (goon) {\n engine.Tween.get(props.target)\n .set({ rotation: 0 })\n .to({ rotation: 360 }, props.duration / 4)\n .call(function () {\n engine.globalEvent.dispatchEvent('loop-end');\n playLoop();\n });\n }\n}\n",
"group": "custom",
"type": "builtin"
}
if (args && args.hasOwnProperty('index')) {
var key = 'state-' + vm.id;
var index = args.index;
var per = 360 / props.divid;
var ratio = per * props.ratio;
var rotation_1 = 360 * 3 - index * per + Math.random() * ratio + (per - ratio) / 2;
delete global[key];
engine.globalEvent.once('loop-end', function () {
engine.Tween.get(props.target || target)
.to({ rotation: rotation_1 }, props.duration, engine.Ease.quintOut)
.call(function () {
next('success');
});
});
}
else {
engine.Tween.removeTweens(props.target || target);
next('success');
}
{
"name": "入口",
"desc": "入口节点,每个行为的入口",
"props": {
"target": {
"type": "node",
"alias": "目标节点"
},
"divide": {
"type": "number",
"default": 6,
"alias": "转盘格数"
},
"duration": {
"type": "number",
"default": 1000,
"alias": "时间"
},
"ratio": {
"alias": "占比",
"type": "number",
"default": "0.9"
}
},
"output": [
"success"
],
"id": "turntable-stop",
"script": "if (args && args.hasOwnProperty('index')) {\n var key = 'state-' + vm.id;\n var index = args.index;\n var per = 360 / props.divid;\n var ratio = per * props.ratio;\n var rotation_1 = 360 * 3 - index * per + Math.random() * ratio + (per - ratio) / 2;\n delete global[key];\n engine.globalEvent.once('loop-end', function () {\n engine.Tween.get(props.target || target)\n .to({ rotation: rotation_1 }, props.duration, engine.Ease.quintOut)\n .call(function () {\n next('success');\n });\n });\n}\nelse {\n engine.Tween.removeTweens(props.target || target);\n next('success');\n}\n",
"group": "custom",
"type": "builtin"
}
location.href = '/record';
next('success');
var count = props.count, field = props.field, successValues = props.successValues;
var key = 'counting-' + vm.id;
var counting = global[key] || 0;
counting++;
var successArr = successValues.split(',');
if (successArr.indexOf(args[field] + '') >= 0) {
delete global[key];
next('success', args);
}
else if (counting < count) {
global[key] = counting;
next('continue');
}
else {
delete global[key];
next('timeout');
}
{ {
"script": "var count = props.count, field = props.field, successValues = props.successValues;\nvar key = 'counting-' + vm.id;\nvar counting = global[key] || 0;\ncounting++;\nvar successArr = successValues.split(',');\nif (successArr.indexOf(args[field]) >= 0) {\n delete global[key];\n next('success');\n}\nelse if (counting < count) {\n global[key] = counting;\n next('continue');\n}\nelse {\n delete global[key];\n next('timeout');\n}\n", "script": "var count = props.count, field = props.field, successValues = props.successValues;\nvar key = 'counting-' + vm.id;\nvar counting = global[key] || 0;\ncounting++;\nvar successArr = successValues.split(',');\nif (successArr.indexOf(args[field] + '') >= 0) {\n delete global[key];\n next('success', args);\n}\nelse if (counting < count) {\n global[key] = counting;\n next('continue');\n}\nelse {\n delete global[key];\n next('timeout');\n}\n",
"props": { "props": {
"count": { "count": {
"type": "number", "type": "number",
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"alias": "字段名", "alias": "字段名",
"default": "status" "default": "status"
}, },
"successArr": { "successValues": {
"type": "string", "type": "string",
"alias": "成功值" "alias": "成功值"
} }
......
{
"name": "Http轮询",
"props": {
"url": {
"type": "string",
"enum": [],
"alias": "链接"
},
"method": {
"type": "enum",
"enum": [
"get",
"post"
],
"alias": "方法",
"default": "get"
},
"count": {
"type": "number",
"enum": [],
"alias": "次数",
"default": 10
},
"delay": {
"type": "number",
"enum": [],
"default": 500,
"alias": "单次延时"
},
"name": {
"type": "string",
"enum": [],
"alias": "数据名"
},
"field": {
"type": "string",
"enum": [],
"alias": "字段名"
},
"successValues": {
"type": "string",
"enum": [],
"alias": "成功值"
}
},
"output": [
"success",
"failed",
"timeout"
],
"sub": {
"442452af-e4d2-47be-b931-86fef866056f": {
"uuid": "442452af-e4d2-47be-b931-86fef866056f",
"meta": "entry",
"design": {
"x": 26,
"y": 15,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 31
}
]
}
},
"props": {},
"output": {
"success": [
"2b895831-d362-491a-a57b-cd6e2d7223a8"
]
}
},
"9def8371-1326-4daa-8220-78cf888297e3": {
"uuid": "9def8371-1326-4daa-8220-78cf888297e3",
"meta": "wait",
"design": {
"x": 343,
"y": 277,
"input": {
"default": [
{
"x": 5.5,
"y": 39
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 39
}
]
}
},
"props": {
"duration": {
"type": "link",
"alias": "delay"
}
},
"output": {
"complete": [
"2b895831-d362-491a-a57b-cd6e2d7223a8"
]
}
},
"b88c8995-28eb-470f-a8a2-7484c9f98e05": {
"uuid": "b88c8995-28eb-470f-a8a2-7484c9f98e05",
"meta": "http-polling-judge",
"design": {
"x": 441,
"y": 57,
"input": {
"default": [
{
"x": 5.5,
"y": 56
}
]
},
"output": {
"continue": [
{
"x": 124.5,
"y": 42
}
],
"timeout": [
{
"x": 124.5,
"y": 56
}
],
"success": [
{
"x": 124.5,
"y": 70
}
]
}
},
"props": {
"count": {
"type": "link"
},
"field": {
"type": "link"
},
"successValues": {
"type": "link"
}
},
"output": {
"continue": [
"9def8371-1326-4daa-8220-78cf888297e3"
]
}
},
"2b895831-d362-491a-a57b-cd6e2d7223a8": {
"uuid": "2b895831-d362-491a-a57b-cd6e2d7223a8",
"meta": "duiba-api",
"design": {
"x": 238,
"y": 10,
"input": {
"default": [
{
"x": 5.5,
"y": 56
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 49
}
],
"failed": [
{
"x": 124.5,
"y": 63
}
]
}
},
"props": {
"url": {
"type": "link"
},
"method": {
"type": "link"
},
"name": {
"type": "link"
}
},
"output": {
"success": [
"b88c8995-28eb-470f-a8a2-7484c9f98e05"
]
}
}
},
"subEntry": "442452af-e4d2-47be-b931-86fef866056f",
"metas": [
{
"script": "var count = props.count, field = props.field, successValues = props.successValues;\nvar key = 'counting-' + vm.id;\nvar counting = global[key] || 0;\ncounting++;\nvar successArr = successValues.split(',');\nif (successArr.indexOf(args[field] + '') >= 0) {\n delete global[key];\n next('success', args);\n}\nelse if (counting < count) {\n global[key] = counting;\n next('continue');\n}\nelse {\n delete global[key];\n next('timeout');\n}\n",
"props": {
"count": {
"type": "number",
"default": 5,
"alias": "次数"
},
"field": {
"type": "string",
"alias": "字段名",
"default": "status"
},
"successValues": {
"type": "string",
"alias": "成功值"
}
},
"name": "轮询判断",
"output": [
"success",
"continue",
"timeout"
],
"id": "http-polling-judge",
"group": "net",
"type": "builtin"
}
],
"id": "http-polling",
"script": "",
"group": "net",
"type": "builtin"
}
if (!props.url) {
console.log('url is empty');
next('exception', '\'url is empty\'');
}
else {
engine.globalLoader.httpRequest(function (s, payload) {
if (s) {
next('success', payload);
}
else {
next('failed', payload);
}
}, props.url, props.method, 'json');
}
{ {
"name": "HttpRequest", "name": "Http请求",
"desc": "http请求", "desc": "Http请求",
"props": { "props": {
"url": { "url": {
"type": "string", "type": "string",
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"exception" "exception"
], ],
"id": "http-request", "id": "http-request",
"script": "if (!props.url) {\n console.log('url is empty');\n next('exception', '\\'url is empty\\'');\n}\nelse {\n engine.globalLoader.httpRequest(function (s, payload) {\n if (s) {\n next('success', payload);\n }\n else {\n next('failed', payload);\n }\n }, props.url, props.method || 'get', 'json');\n}\n", "script": "if (!props.url) {\n console.log('url is empty');\n next('exception', '\\'url is empty\\'');\n}\nelse {\n engine.globalLoader.httpRequest(function (s, payload) {\n if (s) {\n next('success', payload);\n }\n else {\n next('failed', payload);\n }\n }, props.url, props.method, 'json');\n}\n",
"group": "net", "group": "net",
"type": "builtin" "type": "builtin"
} }
{
"id": "turntable",
"name": "转盘抽奖",
"props": {
"errorView": {
"type": "string",
"enum": [],
"alias": "错误弹窗视图"
},
"creditsView": {
"type": "string",
"enum": [],
"alias": "积分不足弹窗视图"
},
"pityView": {
"type": "string",
"enum": [],
"alias": "未中奖弹窗视图"
},
"prizeView": {
"type": "string",
"enum": [],
"alias": "中奖弹窗视图"
},
"target": {
"type": "node",
"enum": [],
"alias": "转盘节点"
},
"divide": {
"type": "number",
"enum": [],
"default": 6,
"alias": "转盘格数"
}
},
"subEntry": "11f3efcc-c2f2-4b2d-be68-61ee4ceb0d7a",
"sub": {
"11f3efcc-c2f2-4b2d-be68-61ee4ceb0d7a": {
"uuid": "11f3efcc-c2f2-4b2d-be68-61ee4ceb0d7a",
"alias": "Entry",
"meta": "entry",
"design": {
"x": 15,
"y": 2,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 31
}
]
}
},
"props": {},
"output": {
"success": [
"ae449fab-5a4a-48e2-a72d-6b745586d20d"
]
}
},
"1dc4c11e-27a2-4b66-a230-dee1f47dcb9d": {
"uuid": "1dc4c11e-27a2-4b66-a230-dee1f47dcb9d",
"meta": "set-mouse-enabled",
"design": {
"x": 345.8888888888889,
"y": 75,
"input": {
"default": [
{
"x": 5.611111111111086,
"y": 47.5
}
]
},
"output": {
"success": [
{
"x": 124.61111111111109,
"y": 47.5
}
]
}
},
"props": {
"target": "node://f27706e9-d66b-4440-a3bc-2b0614cb35da"
},
"output": {
"success": [
"b96a3296-766a-4add-a9e2-5439779421f5"
]
}
},
"ae449fab-5a4a-48e2-a72d-6b745586d20d": {
"uuid": "ae449fab-5a4a-48e2-a72d-6b745586d20d",
"meta": "log",
"design": {
"x": 190,
"y": 11,
"input": {
"default": [
{
"x": 5.5,
"y": 47.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 47.5
}
]
}
},
"props": {
"content": "开始抽奖"
},
"output": {
"success": [
"d56e2901-749e-43ee-93fc-bb480f234294"
]
}
},
"fc341306-d60e-4e88-99e8-84888ac2e841": {
"uuid": "fc341306-d60e-4e88-99e8-84888ac2e841",
"meta": "set-mouse-enabled",
"design": {
"x": 1005.6666666666667,
"y": 355.1111111111111,
"input": {
"default": [
{
"x": 5.8333333333332575,
"y": 47.388888888888914
}
]
},
"output": {
"success": [
{
"x": 124.83333333333326,
"y": 47.388888888888914
}
]
}
},
"props": {
"enabled": true,
"target": "node://f27706e9-d66b-4440-a3bc-2b0614cb35da"
},
"output": {}
},
"1a6d2146-d4fa-4901-b227-858e9fb05497": {
"uuid": "1a6d2146-d4fa-4901-b227-858e9fb05497",
"meta": "duiba-api",
"design": {
"x": 337,
"y": 366,
"input": {
"default": [
{
"x": 5.5,
"y": 56
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 49
}
],
"failed": [
{
"x": 124.5,
"y": 63
}
]
}
},
"props": {
"url": "http://10.10.94.134:3003/hdtool/recon/doJoin",
"name": "doJoin"
},
"output": {
"success": [
"f1dae956-de13-403e-864c-0d3855e57017"
],
"failed": [
"bb4ce362-0389-4c2b-bb78-288a6a839c05"
]
},
"alias": "参与请求"
},
"f1dae956-de13-403e-864c-0d3855e57017": {
"uuid": "f1dae956-de13-403e-864c-0d3855e57017",
"meta": "http-polling",
"design": {
"x": 499.33333333333326,
"y": 255.66666666666669,
"input": {
"default": [
{
"x": 5.1666666666667425,
"y": 90.33333333333331
}
]
},
"output": {
"success": [
{
"x": 124.16666666666674,
"y": 76.33333333333331
}
],
"failed": [
{
"x": 124.16666666666674,
"y": 90.33333333333331
}
],
"timeout": [
{
"x": 124.16666666666674,
"y": 104.33333333333331
}
]
}
},
"props": {
"delay": 500,
"url": "http://10.10.94.134:3003/hdtool/recon/getOrderStatus",
"name": "orderStatus",
"field": "status",
"successValues": "2",
"count": 10
},
"output": {
"success": [
"6ced550f-e3eb-4010-8205-65aaa68e4905"
],
"failed": [
"bb4ce362-0389-4c2b-bb78-288a6a839c05"
],
"timeout": [
"bb4ce362-0389-4c2b-bb78-288a6a839c05"
]
},
"alias": "获取订单状态"
},
"b96a3296-766a-4add-a9e2-5439779421f5": {
"uuid": "b96a3296-766a-4add-a9e2-5439779421f5",
"meta": "d2c886c5-b29a-488a-8928-5e5ffe476696",
"design": {
"x": 270.6666666666667,
"y": 223,
"input": {
"default": [
{
"x": 5.833333333333314,
"y": 47.5
}
]
},
"output": {
"success": [
{
"x": 124.83333333333331,
"y": 47.5
}
]
}
},
"props": {
"duration": 2000,
"target": "node://e748ccc3-0281-4559-a907-2ea0f05459d8"
},
"output": {
"success": [
"1a6d2146-d4fa-4901-b227-858e9fb05497"
]
}
},
"416be49e-f2e0-4fc0-bf28-879a6fd29015": {
"uuid": "416be49e-f2e0-4fc0-bf28-879a6fd29015",
"meta": "push-dialog",
"design": {
"x": 139.55555555555554,
"y": 305.44444444444446,
"input": {
"default": [
{
"x": 5.944444444444457,
"y": 47.05555555555554
}
]
},
"output": {
"complete": [
{
"x": 124.94444444444446,
"y": 47.05555555555554
}
]
}
},
"props": {
"viewName": {
"type": "link",
"alias": "creditsView"
}
},
"output": {
"complete": []
}
},
"d56e2901-749e-43ee-93fc-bb480f234294": {
"uuid": "d56e2901-749e-43ee-93fc-bb480f234294",
"meta": "compare",
"design": {
"x": 87.22222222222223,
"y": 119,
"input": {
"default": [
{
"x": 5.2777777777777715,
"y": 56
}
]
},
"output": {
"true": [
{
"x": 124.27777777777777,
"y": 49
}
],
"false": [
{
"x": 124.27777777777777,
"y": 63
}
]
}
},
"props": {
"left": {
"type": "data-center",
"value": "我的积分"
},
"right": {
"type": "static",
"value": "1"
},
"operator": ">="
},
"output": {
"false": [
"416be49e-f2e0-4fc0-bf28-879a6fd29015"
],
"true": [
"1dc4c11e-27a2-4b66-a230-dee1f47dcb9d"
]
}
},
"63fa6201-3acd-41fe-80a1-d0a502b971f8": {
"uuid": "63fa6201-3acd-41fe-80a1-d0a502b971f8",
"meta": "push-dialog",
"design": {
"x": 1183,
"y": 148,
"input": {
"default": [
{
"x": 5.5,
"y": 47.5
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 47.5
}
]
}
},
"props": {
"viewName": {
"type": "link",
"alias": "pityView"
}
},
"output": {}
},
"82216b90-f6c2-4060-9fb1-4e335f946a73": {
"uuid": "82216b90-f6c2-4060-9fb1-4e335f946a73",
"meta": "31df5957-3f8f-44d8-9e6b-325b04b2c0cf",
"design": {
"x": 800,
"y": 310,
"input": {
"default": [
{
"x": 5.5,
"y": 44.5
}
]
},
"output": {
"p0": [
{
"x": 124.5,
"y": 37.5
}
],
"p1": [
{
"x": 124.5,
"y": 51.5
}
]
}
},
"props": {},
"output": {
"p0": [
"e3fb3404-2e41-4384-9d3c-a51a391ad509"
],
"p1": [
"fc341306-d60e-4e88-99e8-84888ac2e841"
]
},
"alias": "成功分流"
},
"8e00dea7-19d0-40f6-abf4-bb8351f96a2c": {
"uuid": "8e00dea7-19d0-40f6-abf4-bb8351f96a2c",
"meta": "push-dialog",
"design": {
"x": 878,
"y": 451,
"input": {
"default": [
{
"x": 5.5,
"y": 47.5
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 47.5
}
]
}
},
"props": {
"viewName": {
"type": "link",
"alias": "errorView"
}
},
"output": {}
},
"bb4ce362-0389-4c2b-bb78-288a6a839c05": {
"uuid": "bb4ce362-0389-4c2b-bb78-288a6a839c05",
"meta": "14d59115-f556-400e-913b-9e8d3d7235c3",
"design": {
"x": 664,
"y": 434,
"input": {
"default": [
{
"x": 5.5,
"y": 44.5
}
]
},
"output": {
"p0": [
{
"x": 124.5,
"y": 30.5
}
],
"p1": [
{
"x": 124.5,
"y": 44.5
}
],
"p2": [
{
"x": 124.5,
"y": 58.5
}
]
}
},
"props": {},
"output": {
"p0": [
"fc341306-d60e-4e88-99e8-84888ac2e841"
],
"p1": [
"8e00dea7-19d0-40f6-abf4-bb8351f96a2c"
],
"p2": [
"43fc1923-0a23-4ea5-8b64-a6196260a211"
]
},
"alias": "错误分流"
},
"6ced550f-e3eb-4010-8205-65aaa68e4905": {
"uuid": "6ced550f-e3eb-4010-8205-65aaa68e4905",
"meta": "3f02e64a-b20d-4834-acf9-8b5e979671c0",
"design": {
"x": 656.2857142857142,
"y": 138,
"input": {
"default": [
{
"x": 5.214285714285779,
"y": 56
}
]
},
"output": {
"success": [
{
"x": 124.21428571428578,
"y": 56
}
]
}
},
"props": {
"target": "node://e748ccc3-0281-4559-a907-2ea0f05459d8",
"divide": 6,
"duration": 3000
},
"output": {
"success": [
"5a727c49-f660-4736-89d7-cf74f186a345"
]
}
},
"e3fb3404-2e41-4384-9d3c-a51a391ad509": {
"uuid": "e3fb3404-2e41-4384-9d3c-a51a391ad509",
"meta": "compare",
"design": {
"x": 1001,
"y": 192,
"input": {
"default": [
{
"x": 5.5,
"y": 56
}
]
},
"output": {
"true": [
{
"x": 124.5,
"y": 49
}
],
"false": [
{
"x": 124.5,
"y": 63
}
]
}
},
"props": {
"left": {
"type": "data-center",
"value": "orderStatus.lottery.type"
},
"right": {
"type": "static",
"value": "thanks"
}
},
"output": {
"true": [
"63fa6201-3acd-41fe-80a1-d0a502b971f8"
],
"false": [
"4ae2c447-2bf2-4f01-8e40-e8a6984592f4"
]
}
},
"4ae2c447-2bf2-4f01-8e40-e8a6984592f4": {
"uuid": "4ae2c447-2bf2-4f01-8e40-e8a6984592f4",
"meta": "push-dialog",
"design": {
"x": 1187,
"y": 277,
"input": {
"default": [
{
"x": 5.5,
"y": 47.5
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 47.5
}
]
}
},
"props": {
"viewName": {
"type": "link",
"alias": "prizeView"
}
},
"output": {}
},
"43fc1923-0a23-4ea5-8b64-a6196260a211": {
"uuid": "43fc1923-0a23-4ea5-8b64-a6196260a211",
"meta": "d47c5143-c958-4a1f-8d74-958626af9bf8",
"design": {
"x": 851,
"y": 551,
"input": {
"default": [
{
"x": 5.5,
"y": 39
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
],
"failed": [
{
"x": 124.5,
"y": 46
}
]
}
},
"props": {
"target": "node://e748ccc3-0281-4559-a907-2ea0f05459d8"
},
"output": {}
},
"5a727c49-f660-4736-89d7-cf74f186a345": {
"uuid": "5a727c49-f660-4736-89d7-cf74f186a345",
"meta": "wait",
"design": {
"x": 811,
"y": 192,
"input": {
"default": [
{
"x": 5.5,
"y": 39
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 39
}
]
}
},
"props": {
"duration": 500
},
"output": {
"complete": [
"82216b90-f6c2-4060-9fb1-4e335f946a73"
]
}
}
},
"metas": [
{
"id": "d2c886c5-b29a-488a-8928-5e5ffe476696",
"script": "var key = 'state-' + vm.id;\nglobal[key] = true;\nengine.Tween.get(props.target)\n .set({ rotation: 0 })\n .to({ rotation: 360 }, props.duration, engine.Ease.quintIn)\n .call(function () {\n next('success');\n playLoop();\n});\nfunction playLoop() {\n var goon = global[key];\n if (goon) {\n engine.Tween.get(props.target)\n .set({ rotation: 0 })\n .to({ rotation: 360 }, props.duration / 4)\n .call(function () {\n engine.globalEvent.dispatchEvent('loop-end');\n playLoop();\n });\n }\n}\n",
"props": {
"target": {
"type": "node",
"enum": [],
"alias": "目标节点"
},
"duration": {
"type": "number",
"enum": [],
"default": 1000,
"alias": "时间"
}
},
"isInline": true,
"name": "转动转盘",
"output": [
"success"
]
},
{
"id": "31df5957-3f8f-44d8-9e6b-325b04b2c0cf",
"script": "",
"props": {},
"isInline": true,
"name": "Divider",
"output": [
"p0",
"p1"
],
"isDivider": true
},
{
"id": "14d59115-f556-400e-913b-9e8d3d7235c3",
"script": "",
"props": {},
"isInline": true,
"name": "Divider",
"output": [
"p0",
"p1",
"p2"
],
"isDivider": true
},
{
"id": "3f02e64a-b20d-4834-acf9-8b5e979671c0",
"script": "if (args && args.hasOwnProperty('index')) {\n var key = 'state-' + vm.id;\n var index = args.index;\n var per = 360 / props.divide;\n var ratio = per * props.ratio;\n var rotation_1 = 360 * 3 - index * per + Math.random() * ratio + (per - ratio) / 2;\n delete global[key];\n engine.globalEvent.once('loop-end', function () {\n engine.Tween.get(props.target || target)\n .to({ rotation: rotation_1 }, props.duration, engine.Ease.quintOut)\n .call(function () {\n next('success');\n });\n });\n}\nelse {\n engine.Tween.removeTweens(props.target || target);\n next('success');\n}\n",
"props": {
"target": {
"type": "node",
"alias": "目标节点"
},
"divide": {
"type": "number",
"default": 6,
"alias": "转盘格数"
},
"duration": {
"type": "number",
"default": 1000,
"alias": "时间"
},
"ratio": {
"alias": "占比",
"type": "number",
"default": "0.9"
}
},
"isInline": true,
"name": "转盘出奖",
"output": [
"success"
]
},
{
"id": "d47c5143-c958-4a1f-8d74-958626af9bf8",
"script": "engine.Tween.removeTweens(props.target || target);\nnext('success');",
"props": {
"target": {
"type": "node",
"enum": [],
"alias": "目标节点"
}
},
"isInline": true,
"name": "转盘骤停",
"output": [
"success",
"failed"
]
}
],
"output": [],
"isPrefab": true,
"type": "builtin",
"script": "",
"group": "prefabs"
}
if (props.closeAll) {
engine.gameStage.popupContainer.popAll();
}
else {
engine.gameStage.popupContainer.pop();
}
next('complete');
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
"complete" "complete"
], ],
"id": "pop-dialog", "id": "pop-dialog",
"script": "if (props.closeAll) {\n engine.gameStage.popupContainer.popAll();\n}\nelse {\n engine.gameStage.popupContainer.pop();\n}\n", "script": "if (props.closeAll) {\n engine.gameStage.popupContainer.popAll();\n}\nelse {\n engine.gameStage.popupContainer.pop();\n}\nnext('complete');\n",
"group": "base", "group": "view",
"type": "builtin" "type": "builtin"
} }
if (props.closeAll) {
if (!props.viewName) {
console.log('没有设置视图名');
next('exception', '没有设置视图名');
}
else {
var gameStage = engine.gameStage;
var viewConfig = gameStage.getViewConfigByName(props.viewName);
if (viewConfig) {
var view = engine.instantiate(viewConfig);
gameStage.sceneContainer.push(view);
}
else {
console.error('view config not exists');
}
next('complete');
}
}
else {
engine.gameStage.popupContainer.pop();
next('complete');
}
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
"complete" "complete"
], ],
"id": "pop-scene", "id": "pop-scene",
"script": "if (props.closeAll) {\n if (!props.viewName) {\n console.log('没有设置视图名');\n next('exception', '没有设置视图名');\n }\n else {\n var gameStage = engine.gameStage;\n var viewConfig = gameStage.getViewConfigByName(props.viewName);\n if (viewConfig) {\n var view = engine.instantiate(viewConfig);\n gameStage.sceneContainer.push(view);\n }\n else {\n console.error('view config not exists');\n }\n }\n}\nelse {\n engine.gameStage.popupContainer.pop();\n}\n", "script": "if (props.closeAll) {\n if (!props.viewName) {\n console.log('没有设置视图名');\n next('exception', '没有设置视图名');\n }\n else {\n var gameStage = engine.gameStage;\n var viewConfig = gameStage.getViewConfigByName(props.viewName);\n if (viewConfig) {\n var view = engine.instantiate(viewConfig);\n gameStage.sceneContainer.push(view);\n }\n else {\n console.error('view config not exists');\n }\n next('complete');\n }\n}\nelse {\n engine.gameStage.popupContainer.pop();\n next('complete');\n}\n",
"group": "base", "group": "view",
"type": "builtin" "type": "builtin"
} }
if (!props.viewName) {
console.log('没有设置视图名');
next('exception', '没有设置视图名');
}
else {
var gameStage = engine.gameStage;
var viewConfig = gameStage.getViewConfigByName(props.viewName);
if (viewConfig) {
var view = engine.instantiate(viewConfig);
gameStage.popupContainer.push(view, { center: props.center });
}
else {
console.error('view config not exists');
}
next('complete');
}
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
"complete" "complete"
], ],
"id": "push-dialog", "id": "push-dialog",
"script": "if (!props.viewName) {\n console.log('没有设置视图名');\n next('exception', '没有设置视图名');\n}\nelse {\n var gameStage = engine.gameStage;\n var viewConfig = gameStage.getViewConfigByName(props.viewName);\n if (viewConfig) {\n var view = engine.instantiate(viewConfig);\n gameStage.popupContainer.push(view, { center: props.center || true });\n }\n else {\n console.error('view config not exists');\n }\n}\n", "script": "if (!props.viewName) {\n console.log('没有设置视图名');\n next('exception', '没有设置视图名');\n}\nelse {\n var gameStage = engine.gameStage;\n var viewConfig = gameStage.getViewConfigByName(props.viewName);\n if (viewConfig) {\n var view = engine.instantiate(viewConfig);\n gameStage.popupContainer.push(view, { center: props.center });\n }\n else {\n console.error('view config not exists');\n }\n next('complete');\n}\n",
"group": "base", "group": "view",
"type": "builtin" "type": "builtin"
} }
if (!props.viewName) {
console.log('没有设置视图名');
next('exception', '没有设置视图名');
}
else {
var gameStage = engine.gameStage;
var viewConfig = gameStage.getViewConfigByName(props.viewName);
if (viewConfig) {
var view = engine.instantiate(viewConfig);
gameStage.sceneContainer.push(view);
}
else {
console.error('view config not exists');
}
next('complete');
}
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"complete" "complete"
], ],
"id": "push-scene", "id": "push-scene",
"script": "if (!props.viewName) {\n console.log('没有设置视图名');\n next('exception', '没有设置视图名');\n}\nelse {\n var gameStage = engine.gameStage;\n var viewConfig = gameStage.getViewConfigByName(props.viewName);\n if (viewConfig) {\n var view = engine.instantiate(viewConfig);\n gameStage.sceneContainer.push(view);\n }\n else {\n console.error('view config not exists');\n }\n}\n", "script": "if (!props.viewName) {\n console.log('没有设置视图名');\n next('exception', '没有设置视图名');\n}\nelse {\n var gameStage = engine.gameStage;\n var viewConfig = gameStage.getViewConfigByName(props.viewName);\n if (viewConfig) {\n var view = engine.instantiate(viewConfig);\n gameStage.sceneContainer.push(view);\n }\n else {\n console.error('view config not exists');\n }\n next('complete');\n}\n",
"group": "base", "group": "view",
"type": "builtin" "type": "builtin"
} }
var targetNode = target || props.target;
if (targetNode) {
targetNode.mouseEnabled = props.enabled;
}
next('success');
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
"success" "success"
], ],
"id": "set-mouse-enabled", "id": "set-mouse-enabled",
"script": "var targetNode = target || props.target;\nif (targetNode) {\n targetNode.mouseEnabled = props.enabled;\n next('success');\n}\n", "script": "var targetNode = target || props.target;\nif (targetNode) {\n targetNode.mouseEnabled = props.enabled;\n}\nnext('success');\n",
"group": "base", "group": "view",
"type": "builtin" "type": "builtin"
} }
var targetNode = target || props.target;
if (targetNode) {
var field = props.field, valueType = props.valueType, value = props.value;
if (field && value) {
var tValue = void 0;
switch (valueType) {
case 'number':
tValue = parseFloat(value);
break;
case 'string':
tValue = value;
break;
case 'boolean':
tValue = value === 'true' ? true : (value === 'false' ? false : value);
break;
}
if (tValue !== undefined) {
targetNode[field] = tValue;
}
}
}
next('success');
{
"name": "设置节点属性",
"desc": "设置节点属性",
"props": {
"target": {
"type": "node",
"alias": "目标节点"
},
"field": {
"type": "string",
"alias": "属性名"
},
"valueType": {
"type": "enum",
"enum": [
"number",
"string",
"boolean"
],
"alias": "数值类型",
"default": "number"
},
"value": {
"type": "string",
"alias": "数值"
}
},
"output": [
"success"
],
"id": "set-node-property",
"script": "var targetNode = target || props.target;\nif (targetNode) {\n var field = props.field, valueType = props.valueType, value = props.value;\n if (field && value) {\n var tValue = void 0;\n switch (valueType) {\n case 'number':\n tValue = parseFloat(value);\n break;\n case 'string':\n tValue = value;\n break;\n case 'boolean':\n tValue = value === 'true' ? true : (value === 'false' ? false : value);\n break;\n }\n if (tValue !== undefined) {\n targetNode[field] = tValue;\n }\n }\n}\nnext('success');\n",
"group": "view",
"type": "builtin"
}
var targetNode = target || props.target;
if (targetNode) {
targetNode.visible = props.visible;
}
next('success');
{
"name": "设置节点可见性",
"desc": "设置节点可见性",
"props": {
"target": {
"type": "node",
"alias": "目标节点"
},
"visible": {
"type": "boolean",
"alias": "可否可见",
"default": false
}
},
"output": [
"success"
],
"id": "set-node-visibility",
"script": "var targetNode = target || props.target;\nif (targetNode) {\n targetNode.visible = props.visible;\n}\nnext('success');\n",
"group": "view",
"type": "builtin"
}
var targetNode = target || props.target;
if (targetNode) {
var scriptsProxy = targetNode.scriptsProxy;
var scriptIndex = props.scriptIndex, scriptName = props.scriptName, enabled = props.enabled;
var script = void 0;
if (scriptIndex !== undefined) {
script = scriptsProxy.all[scriptIndex];
}
else if (scriptName !== undefined) {
script = scriptsProxy.get(scriptName);
}
if (script) {
script.disabled = !enabled;
}
}
next('success');
{
"name": "设置脚本有效性",
"desc": "设置脚本有效性,优先查找索引",
"props": {
"target": {
"type": "node",
"alias": "目标节点"
},
"scriptIndex": {
"type": "number",
"alias": "脚本索引"
},
"name": {
"type": "string",
"alias": "脚本名"
},
"enabled": {
"type": "boolean",
"alias": "可否有效",
"default": false
}
},
"output": [
"success"
],
"id": "set-script-enabled",
"script": "var targetNode = target || props.target;\nif (targetNode) {\n var scriptsProxy = targetNode.scriptsProxy;\n var scriptIndex = props.scriptIndex, scriptName = props.scriptName, enabled = props.enabled;\n var script = void 0;\n if (scriptIndex !== undefined) {\n script = scriptsProxy.all[scriptIndex];\n }\n else if (scriptName !== undefined) {\n script = scriptsProxy.get(scriptName);\n }\n if (script) {\n script.disabled = !enabled;\n }\n}\nnext('success');\n",
"group": "view",
"type": "builtin"
}
var targetNode = target || props.target;
if (targetNode) {
var scriptsProxy = targetNode.scriptsProxy;
var scriptIndex = props.scriptIndex, scriptName = props.scriptName, enabled = props.enabled;
var script = void 0;
if (scriptIndex !== undefined) {
script = scriptsProxy.all[scriptIndex];
}
else if (scriptName !== undefined) {
script = scriptsProxy.get(scriptName);
}
if (script) {
var field = props.field, valueType = props.valueType, value = props.value;
if (field && value) {
var tValue = void 0;
switch (valueType) {
case 'number':
tValue = parseFloat(value);
break;
case 'string':
tValue = value;
break;
case 'boolean':
tValue = value === 'true' ? true : (value === 'false' ? false : value);
break;
}
if (tValue !== undefined) {
script[field] = tValue;
}
}
}
}
next('success');
{
"name": "设置脚本属性",
"desc": "设置脚本属性,优先查找索引",
"props": {
"target": {
"type": "node",
"alias": "目标节点"
},
"scriptIndex": {
"type": "number",
"alias": "脚本索引"
},
"name": {
"type": "string",
"alias": "脚本名"
},
"field": {
"type": "string",
"alias": "属性名"
},
"valueType": {
"type": "enum",
"enum": [
"number",
"string",
"boolean"
],
"alias": "数值类型",
"default": "number"
},
"value": {
"type": "string",
"alias": "数值"
}
},
"output": [
"success"
],
"id": "set-script-property",
"script": "var targetNode = target || props.target;\nif (targetNode) {\n var scriptsProxy = targetNode.scriptsProxy;\n var scriptIndex = props.scriptIndex, scriptName = props.scriptName, enabled = props.enabled;\n var script = void 0;\n if (scriptIndex !== undefined) {\n script = scriptsProxy.all[scriptIndex];\n }\n else if (scriptName !== undefined) {\n script = scriptsProxy.get(scriptName);\n }\n if (script) {\n var field = props.field, valueType = props.valueType, value = props.value;\n if (field && value) {\n var tValue = void 0;\n switch (valueType) {\n case 'number':\n tValue = parseFloat(value);\n break;\n case 'string':\n tValue = value;\n break;\n case 'boolean':\n tValue = value === 'true' ? true : (value === 'false' ? false : value);\n break;\n }\n if (tValue !== undefined) {\n script[field] = tValue;\n }\n }\n }\n}\nnext('success');\n",
"group": "view",
"type": "builtin"
}
...@@ -2,10 +2,12 @@ ...@@ -2,10 +2,12 @@
* Created by rockyl on 2019-11-16. * Created by rockyl on 2019-11-16.
*/ */
let leftValue = typeof props.left === 'string' ? '"' + props.left + '"' : props.left;
let rightValue = typeof props.right === 'string' ? '"' + props.right + '"' : props.right;
let operator = (args ? args.operator : props.operator) || '=='; let operator = (args ? args.operator : props.operator) || '==';
if(operator === '==' || operator === '!='){ if(operator === '==' || operator === '!='){
operator += '='; operator += '=';
} }
let func = new Function('return ' + props.left + operator + props.right); let func = new Function('return ' + leftValue + operator + rightValue);
let result = func(); let result = func();
next(result ? 'true' : 'false'); next(result ? 'true' : 'false');
...@@ -4,9 +4,8 @@ ...@@ -4,9 +4,8 @@
"props": { "props": {
"left": {"alias": "左值","type": "data", "default": ""}, "left": {"alias": "左值","type": "data", "default": ""},
"right": {"alias": "右值","type": "data", "default": ""}, "right": {"alias": "右值","type": "data", "default": ""},
"strict": {"alias": "严格模式","type": "boolean", "default": false},
"operator": {"alias": "操作符","type": "enum", "operator": {"alias": "操作符","type": "enum",
"enum": ["==",">",">=","<","<=","!="], "enum": ["==","!=","===","!==",">",">=","<","<="],
"default": "=="} "default": "=="}
}, },
"output": [ "output": [
......
/**
* Created by rockyl on 2019-11-16.
*/
if (args && args.url) {
location.href = args.url;
} else if (props.url) {
location.href = props.url;
}
next('complete');
{
"name": "跳转页面",
"desc": "跳转页面",
"props": {
"url": {
"alias": "地址",
"type": "data"
}
},
"output": [
"complete"
]
}
\ No newline at end of file
...@@ -4,4 +4,4 @@ ...@@ -4,4 +4,4 @@
setTimeout(function(){ setTimeout(function(){
next('complete') next('complete')
}, args ? args.duration : (props.duration || 0)); }, args ? args.duration : props.duration);
/**
* Created by rockyl on 2019-11-16.
*/
const key = 'state-' + vm.id;
global[key] = true;
engine.Tween.get(props.target)
.set({rotation: 0})
.to({rotation: 360}, props.duration, engine.Ease.quintIn)
.call(function () {
next('success');
playLoop();
});
function playLoop() {
let goon = global[key];
if (goon) {
engine.Tween.get(props.target)
.set({rotation: 0})
.to({rotation: 360}, props.duration / 4)
.call(function () {
engine.globalEvent.dispatchEvent('loop-end');
playLoop();
})
}
}
{
"name": "入口",
"desc": "入口节点,每个行为的入口",
"props": {},
"output": [
"success"
]
}
/**
* Created by rockyl on 2019-11-16.
*/
if (args && args.hasOwnProperty('index')) {
const key = 'state-' + vm.id;
let index = args.index;
let per = 360 / props.divid;
let ratio = per * props.ratio;
let rotation = 360 * 3 - index * per + Math.random() * ratio + (per - ratio) / 2;
delete global[key];
engine.globalEvent.once('loop-end', function () {
engine.Tween.get(props.target || target)
.to({rotation}, props.duration, engine.Ease.quintOut)
.call(function () {
next('success');
})
});
} else {
engine.Tween.removeTweens(props.target || target);
next('success');
}
{
"name": "入口",
"desc": "入口节点,每个行为的入口",
"props": {
"target": {
"type": "node",
"alias": "目标节点"
},
"divide": {
"type": "number",
"default": 6,
"alias": "转盘格数"
},
"duration": {
"type": "number",
"default": 1000,
"alias": "时间"
},
"ratio": {
"alias": "占比",
"type": "number",
"default": "0.9"
}
},
"output": [
"success"
]
}
...@@ -8,9 +8,9 @@ let counting = global[key] || 0; ...@@ -8,9 +8,9 @@ let counting = global[key] || 0;
counting++; counting++;
let successArr = successValues.split(','); let successArr = successValues.split(',');
if (successArr.indexOf(args[field]) >= 0) { if (successArr.indexOf(args[field] + '') >= 0) {
delete global[key]; delete global[key];
next('success'); next('success', args);
} else if (counting < count) { } else if (counting < count) {
global[key] = counting; global[key] = counting;
next('continue'); next('continue');
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"alias": "字段名", "alias": "字段名",
"default": "status" "default": "status"
}, },
"successArr": { "successValues": {
"type": "string", "type": "string",
"alias": "成功值" "alias": "成功值"
} }
......
...@@ -2,19 +2,3 @@ ...@@ -2,19 +2,3 @@
* Created by rockyl on 2019-11-16. * Created by rockyl on 2019-11-16.
*/ */
const {count, field, successValues} = props;
const key = 'counting-' + vm.id;
let counting = global[key] || 0;
counting++;
let successArr = successValues.split(',');
if (successArr.indexOf(args[field]) >= 0) {
delete global[key];
next('success');
} else if (counting < count) {
global[key] = counting;
next('continue');
} else {
delete global[key];
next('timeout');
}
{ {
"id": "polling", "name": "Http轮询",
"name": "轮询",
"script": "",
"props": { "props": {
"url": { "url": {
"type": "string", "type": "string",
...@@ -211,7 +209,7 @@ ...@@ -211,7 +209,7 @@
"subEntry": "442452af-e4d2-47be-b931-86fef866056f", "subEntry": "442452af-e4d2-47be-b931-86fef866056f",
"metas": [ "metas": [
{ {
"script": "var count = props.count, field = props.field, successValues = props.successValues;\nvar key = 'counting-' + vm.id;\nvar counting = global[key] || 0;\ncounting++;\nvar successArr = successValues.split(',');\nif (successArr.indexOf(args[field]) >= 0) {\n delete global[key];\n next('success');\n}\nelse if (counting < count) {\n global[key] = counting;\n next('continue');\n}\nelse {\n delete global[key];\n next('timeout');\n}\n", "script": "var count = props.count, field = props.field, successValues = props.successValues;\nvar key = 'counting-' + vm.id;\nvar counting = global[key] || 0;\ncounting++;\nvar successArr = successValues.split(',');\nif (successArr.indexOf(args[field] + '') >= 0) {\n delete global[key];\n next('success', args);\n}\nelse if (counting < count) {\n global[key] = counting;\n next('continue');\n}\nelse {\n delete global[key];\n next('timeout');\n}\n",
"props": { "props": {
"count": { "count": {
"type": "number", "type": "number",
...@@ -223,7 +221,7 @@ ...@@ -223,7 +221,7 @@
"alias": "字段名", "alias": "字段名",
"default": "status" "default": "status"
}, },
"successArr": { "successValues": {
"type": "string", "type": "string",
"alias": "成功值" "alias": "成功值"
} }
......
...@@ -13,5 +13,5 @@ if(!props.url){ ...@@ -13,5 +13,5 @@ if(!props.url){
}else{ }else{
next('failed', payload); next('failed', payload);
} }
}, props.url, props.method || 'get', 'json'); }, props.url, props.method, 'json');
} }
{ {
"name": "HttpRequest", "name": "Http请求",
"desc": "http请求", "desc": "Http请求",
"props": { "props": {
"url": {"type": "string", "alias": "地址"}, "url": {"type": "string", "alias": "地址"},
"method": {"type": "enum", "enum": ["get", "post"], "alias": "方法", "default": "get"} "method": {"type": "enum", "enum": ["get", "post"], "alias": "方法", "default": "get"}
......
/**
* Created by rockyl on 2019-11-20.
*/
{
"id": "turntable",
"name": "转盘抽奖",
"props": {
"errorView": {
"type": "string",
"alias": "错误弹窗视图"
},
"creditsView": {
"type": "string",
"alias": "积分不足弹窗视图"
},
"pityView": {
"type": "string",
"alias": "未中奖弹窗视图"
},
"prizeView": {
"type": "string",
"alias": "中奖弹窗视图"
},
"target": {
"type": "node",
"alias": "转盘节点"
},
"divide": {
"type": "number",
"default": 6,
"alias": "转盘格数"
}
},
"subEntry": "11f3efcc-c2f2-4b2d-be68-61ee4ceb0d7a",
"sub": {
"11f3efcc-c2f2-4b2d-be68-61ee4ceb0d7a": {
"uuid": "11f3efcc-c2f2-4b2d-be68-61ee4ceb0d7a",
"alias": "Entry",
"meta": "entry",
"design": {
"x": 15,
"y": 2,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 31
}
]
}
},
"props": {},
"output": {
"success": [
"ae449fab-5a4a-48e2-a72d-6b745586d20d"
]
}
},
"1dc4c11e-27a2-4b66-a230-dee1f47dcb9d": {
"uuid": "1dc4c11e-27a2-4b66-a230-dee1f47dcb9d",
"meta": "set-mouse-enabled",
"design": {
"x": 345.8888888888889,
"y": 75,
"input": {
"default": [
{
"x": 5.611111111111086,
"y": 47.5
}
]
},
"output": {
"success": [
{
"x": 124.61111111111109,
"y": 47.5
}
]
}
},
"props": {},
"output": {
"success": [
"b96a3296-766a-4add-a9e2-5439779421f5"
]
}
},
"ae449fab-5a4a-48e2-a72d-6b745586d20d": {
"uuid": "ae449fab-5a4a-48e2-a72d-6b745586d20d",
"meta": "log",
"design": {
"x": 190,
"y": 11,
"input": {
"default": [
{
"x": 5.5,
"y": 47.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 47.5
}
]
}
},
"props": {
"content": "开始抽奖"
},
"output": {
"success": [
"d56e2901-749e-43ee-93fc-bb480f234294"
]
}
},
"fc341306-d60e-4e88-99e8-84888ac2e841": {
"uuid": "fc341306-d60e-4e88-99e8-84888ac2e841",
"meta": "set-mouse-enabled",
"design": {
"x": 1005.6666666666667,
"y": 355.1111111111111,
"input": {
"default": [
{
"x": 5.8333333333332575,
"y": 47.388888888888914
}
]
},
"output": {
"success": [
{
"x": 124.83333333333326,
"y": 47.388888888888914
}
]
}
},
"props": {
"enabled": true
},
"output": {}
},
"1a6d2146-d4fa-4901-b227-858e9fb05497": {
"uuid": "1a6d2146-d4fa-4901-b227-858e9fb05497",
"meta": "duiba-api",
"design": {
"x": 337,
"y": 366,
"input": {
"default": [
{
"x": 5.5,
"y": 56
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 49
}
],
"failed": [
{
"x": 124.5,
"y": 63
}
]
}
},
"props": {
"url": "http://10.10.94.134:3003/hdtool/recon/doJoin",
"name": "doJoin"
},
"output": {
"success": [
"f1dae956-de13-403e-864c-0d3855e57017"
],
"failed": [
"bb4ce362-0389-4c2b-bb78-288a6a839c05"
]
},
"alias": "参与请求"
},
"f1dae956-de13-403e-864c-0d3855e57017": {
"uuid": "f1dae956-de13-403e-864c-0d3855e57017",
"meta": "http-polling",
"design": {
"x": 499.33333333333326,
"y": 255.66666666666669,
"input": {
"default": [
{
"x": 5.1666666666667425,
"y": 90.33333333333331
}
]
},
"output": {
"success": [
{
"x": 124.16666666666674,
"y": 76.33333333333331
}
],
"failed": [
{
"x": 124.16666666666674,
"y": 90.33333333333331
}
],
"timeout": [
{
"x": 124.16666666666674,
"y": 104.33333333333331
}
]
}
},
"props": {
"delay": 500,
"url": "http://10.10.94.134:3003/hdtool/recon/getOrderStatus",
"name": "orderStatus",
"field": "status",
"successValues": "2",
"count": 10
},
"output": {
"success": [
"6ced550f-e3eb-4010-8205-65aaa68e4905"
],
"failed": [
"bb4ce362-0389-4c2b-bb78-288a6a839c05"
],
"timeout": [
"bb4ce362-0389-4c2b-bb78-288a6a839c05"
]
},
"alias": "获取订单状态"
},
"b96a3296-766a-4add-a9e2-5439779421f5": {
"uuid": "b96a3296-766a-4add-a9e2-5439779421f5",
"meta": "d2c886c5-b29a-488a-8928-5e5ffe476696",
"design": {
"x": 270.6666666666667,
"y": 223,
"input": {
"default": [
{
"x": 5.833333333333314,
"y": 47.5
}
]
},
"output": {
"success": [
{
"x": 124.83333333333331,
"y": 47.5
}
]
}
},
"props": {
"duration": 2000,
"target": {
"type": "link"
}
},
"output": {
"success": [
"1a6d2146-d4fa-4901-b227-858e9fb05497"
]
}
},
"416be49e-f2e0-4fc0-bf28-879a6fd29015": {
"uuid": "416be49e-f2e0-4fc0-bf28-879a6fd29015",
"meta": "push-dialog",
"design": {
"x": 139.55555555555554,
"y": 305.44444444444446,
"input": {
"default": [
{
"x": 5.944444444444457,
"y": 47.05555555555554
}
]
},
"output": {
"complete": [
{
"x": 124.94444444444446,
"y": 47.05555555555554
}
]
}
},
"props": {
"viewName": {
"type": "link",
"alias": "creditsView"
}
},
"output": {
"complete": []
}
},
"d56e2901-749e-43ee-93fc-bb480f234294": {
"uuid": "d56e2901-749e-43ee-93fc-bb480f234294",
"meta": "compare",
"design": {
"x": 87.22222222222223,
"y": 119,
"input": {
"default": [
{
"x": 5.2777777777777715,
"y": 56
}
]
},
"output": {
"true": [
{
"x": 124.27777777777777,
"y": 49
}
],
"false": [
{
"x": 124.27777777777777,
"y": 63
}
]
}
},
"props": {
"left": {
"type": "data-center",
"value": "我的积分"
},
"operator": ">=",
"right": {
"type": "static",
"value": "1"
}
},
"output": {
"false": [
"416be49e-f2e0-4fc0-bf28-879a6fd29015"
],
"true": [
"1dc4c11e-27a2-4b66-a230-dee1f47dcb9d"
]
}
},
"63fa6201-3acd-41fe-80a1-d0a502b971f8": {
"uuid": "63fa6201-3acd-41fe-80a1-d0a502b971f8",
"meta": "push-dialog",
"design": {
"x": 1183,
"y": 148,
"input": {
"default": [
{
"x": 5.5,
"y": 47.5
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 47.5
}
]
}
},
"props": {
"viewName": {
"type": "link",
"alias": "pityView"
}
},
"output": {}
},
"82216b90-f6c2-4060-9fb1-4e335f946a73": {
"uuid": "82216b90-f6c2-4060-9fb1-4e335f946a73",
"meta": "31df5957-3f8f-44d8-9e6b-325b04b2c0cf",
"design": {
"x": 800,
"y": 310,
"input": {
"default": [
{
"x": 5.5,
"y": 44.5
}
]
},
"output": {
"p0": [
{
"x": 124.5,
"y": 37.5
}
],
"p1": [
{
"x": 124.5,
"y": 51.5
}
]
}
},
"props": {},
"output": {
"p0": [
"e3fb3404-2e41-4384-9d3c-a51a391ad509"
],
"p1": [
"fc341306-d60e-4e88-99e8-84888ac2e841"
]
},
"alias": "成功分流"
},
"8e00dea7-19d0-40f6-abf4-bb8351f96a2c": {
"uuid": "8e00dea7-19d0-40f6-abf4-bb8351f96a2c",
"meta": "push-dialog",
"design": {
"x": 878,
"y": 451,
"input": {
"default": [
{
"x": 5.5,
"y": 47.5
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 47.5
}
]
}
},
"props": {
"viewName": {
"type": "link",
"alias": "errorView"
}
},
"output": {}
},
"bb4ce362-0389-4c2b-bb78-288a6a839c05": {
"uuid": "bb4ce362-0389-4c2b-bb78-288a6a839c05",
"meta": "14d59115-f556-400e-913b-9e8d3d7235c3",
"design": {
"x": 664,
"y": 434,
"input": {
"default": [
{
"x": 5.5,
"y": 44.5
}
]
},
"output": {
"p0": [
{
"x": 124.5,
"y": 30.5
}
],
"p1": [
{
"x": 124.5,
"y": 44.5
}
],
"p2": [
{
"x": 124.5,
"y": 58.5
}
]
}
},
"props": {},
"output": {
"p0": [
"fc341306-d60e-4e88-99e8-84888ac2e841"
],
"p1": [
"8e00dea7-19d0-40f6-abf4-bb8351f96a2c"
],
"p2": [
"43fc1923-0a23-4ea5-8b64-a6196260a211"
]
},
"alias": "错误分流"
},
"6ced550f-e3eb-4010-8205-65aaa68e4905": {
"uuid": "6ced550f-e3eb-4010-8205-65aaa68e4905",
"meta": "3f02e64a-b20d-4834-acf9-8b5e979671c0",
"design": {
"x": 656.2857142857142,
"y": 138,
"input": {
"default": [
{
"x": 5.214285714285779,
"y": 64.5
}
]
},
"output": {
"success": [
{
"x": 124.21428571428578,
"y": 64.5
}
]
}
},
"props": {
"target": {
"type": "link"
},
"divide": 6,
"duration": 3000,
"ratio": 0.9
},
"output": {
"success": [
"5a727c49-f660-4736-89d7-cf74f186a345"
]
}
},
"e3fb3404-2e41-4384-9d3c-a51a391ad509": {
"uuid": "e3fb3404-2e41-4384-9d3c-a51a391ad509",
"meta": "compare",
"design": {
"x": 1001,
"y": 192,
"input": {
"default": [
{
"x": 5.5,
"y": 56
}
]
},
"output": {
"true": [
{
"x": 124.5,
"y": 49
}
],
"false": [
{
"x": 124.5,
"y": 63
}
]
}
},
"props": {
"left": {
"type": "data-center",
"value": "orderStatus.lottery.type"
},
"right": {
"type": "static",
"value": "thanks"
}
},
"output": {
"true": [
"63fa6201-3acd-41fe-80a1-d0a502b971f8"
],
"false": [
"4ae2c447-2bf2-4f01-8e40-e8a6984592f4"
]
}
},
"4ae2c447-2bf2-4f01-8e40-e8a6984592f4": {
"uuid": "4ae2c447-2bf2-4f01-8e40-e8a6984592f4",
"meta": "push-dialog",
"design": {
"x": 1187,
"y": 277,
"input": {
"default": [
{
"x": 5.5,
"y": 47.5
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 47.5
}
]
}
},
"props": {
"viewName": {
"type": "link",
"alias": "prizeView"
}
},
"output": {}
},
"43fc1923-0a23-4ea5-8b64-a6196260a211": {
"uuid": "43fc1923-0a23-4ea5-8b64-a6196260a211",
"meta": "d47c5143-c958-4a1f-8d74-958626af9bf8",
"design": {
"x": 851,
"y": 551,
"input": {
"default": [
{
"x": 5.5,
"y": 39
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
],
"failed": [
{
"x": 124.5,
"y": 46
}
]
}
},
"props": {
"target": {
"type": "link"
}
},
"output": {}
},
"5a727c49-f660-4736-89d7-cf74f186a345": {
"uuid": "5a727c49-f660-4736-89d7-cf74f186a345",
"meta": "wait",
"design": {
"x": 811,
"y": 192,
"input": {
"default": [
{
"x": 5.5,
"y": 39
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 39
}
]
}
},
"props": {
"duration": 500
},
"output": {
"complete": [
"82216b90-f6c2-4060-9fb1-4e335f946a73"
]
}
}
},
"metas": [
{
"id": "d2c886c5-b29a-488a-8928-5e5ffe476696",
"script": "var key = 'state-' + vm.id;\nglobal[key] = true;\nengine.Tween.get(props.target)\n .set({ rotation: 0 })\n .to({ rotation: 360 }, props.duration, engine.Ease.quintIn)\n .call(function () {\n next('success');\n playLoop();\n});\nfunction playLoop() {\n var goon = global[key];\n if (goon) {\n engine.Tween.get(props.target)\n .set({ rotation: 0 })\n .to({ rotation: 360 }, props.duration / 4)\n .call(function () {\n engine.globalEvent.dispatchEvent('loop-end');\n playLoop();\n });\n }\n}\n",
"props": {
"target": {
"type": "node",
"enum": [],
"alias": "目标节点"
},
"duration": {
"type": "number",
"enum": [],
"default": 1000,
"alias": "时间"
}
},
"isInline": true,
"name": "转动转盘",
"output": [
"success"
]
},
{
"id": "31df5957-3f8f-44d8-9e6b-325b04b2c0cf",
"script": "",
"props": {},
"isInline": true,
"name": "Divider",
"output": [
"p0",
"p1"
],
"isDivider": true
},
{
"id": "14d59115-f556-400e-913b-9e8d3d7235c3",
"script": "",
"props": {},
"isInline": true,
"name": "Divider",
"output": [
"p0",
"p1",
"p2"
],
"isDivider": true
},
{
"id": "3f02e64a-b20d-4834-acf9-8b5e979671c0",
"script": "if (args && args.hasOwnProperty('index')) {\n var key = 'state-' + vm.id;\n var index = args.index;\n var per = 360 / props.divide;\n var ratio = per * props.ratio;\n var rotation_1 = 360 * 3 - index * per + Math.random() * ratio + (per - ratio) / 2;\n delete global[key];\n engine.globalEvent.once('loop-end', function () {\n engine.Tween.get(props.target || target)\n .to({ rotation: rotation_1 }, props.duration, engine.Ease.quintOut)\n .call(function () {\n next('success');\n });\n });\n}\nelse {\n engine.Tween.removeTweens(props.target || target);\n next('success');\n}\n",
"props": {
"target": {
"type": "node",
"alias": "目标节点"
},
"divide": {
"type": "number",
"default": 6,
"alias": "转盘格数"
},
"duration": {
"type": "number",
"default": 1000,
"alias": "时间"
},
"ratio": {
"alias": "占比",
"type": "number",
"default": "0.9"
}
},
"isInline": true,
"name": "转盘出奖",
"output": [
"success"
]
},
{
"id": "d47c5143-c958-4a1f-8d74-958626af9bf8",
"script": "engine.Tween.removeTweens(props.target || target);\nnext('success');",
"props": {
"target": {
"type": "node",
"enum": [],
"alias": "目标节点"
}
},
"isInline": true,
"name": "转盘骤停",
"output": [
"success",
"failed"
]
}
],
"output": [],
"isPrefab": true,
"isInline": false
}
\ No newline at end of file
...@@ -7,3 +7,4 @@ if(props.closeAll){ ...@@ -7,3 +7,4 @@ if(props.closeAll){
}else{ }else{
engine.gameStage.popupContainer.pop(); engine.gameStage.popupContainer.pop();
} }
next('complete');
...@@ -15,7 +15,13 @@ if(props.closeAll){ ...@@ -15,7 +15,13 @@ if(props.closeAll){
} else { } else {
console.error('view config not exists'); console.error('view config not exists');
} }
next('complete');
} }
}else{ }else{
engine.gameStage.popupContainer.pop(); engine.gameStage.popupContainer.pop();
next('complete');
} }
\ No newline at end of file
...@@ -10,8 +10,11 @@ if (!props.viewName) { ...@@ -10,8 +10,11 @@ if (!props.viewName) {
let viewConfig = gameStage.getViewConfigByName(props.viewName); let viewConfig = gameStage.getViewConfigByName(props.viewName);
if (viewConfig) { if (viewConfig) {
let view = engine.instantiate(viewConfig); let view = engine.instantiate(viewConfig);
gameStage.popupContainer.push(view, {center: props.center || true}); gameStage.popupContainer.push(view, {center: props.center});
} else { } else {
console.error('view config not exists'); console.error('view config not exists');
} }
next('complete');
} }
...@@ -14,4 +14,7 @@ if (!props.viewName) { ...@@ -14,4 +14,7 @@ if (!props.viewName) {
} else { } else {
console.error('view config not exists'); console.error('view config not exists');
} }
next('complete');
} }
...@@ -5,5 +5,6 @@ ...@@ -5,5 +5,6 @@
let targetNode = target || props.target; let targetNode = target || props.target;
if(targetNode){ if(targetNode){
targetNode.mouseEnabled = props.enabled; targetNode.mouseEnabled = props.enabled;
next('success')
} }
next('success');
/**
* Created by rockyl on 2019-11-16.
*/
let targetNode = target || props.target;
if (targetNode) {
const {field, valueType, value} = props;
if (field && value) {
let tValue;
switch (valueType) {
case 'number':
tValue = parseFloat(value);
break;
case 'string':
tValue = value;
break;
case 'boolean':
tValue = value === 'true' ? true : (value === 'false' ? false : value);
break;
}
if (tValue !== undefined) {
targetNode[field] = tValue;
}
}
}
next('success');
{
"name": "设置节点属性",
"desc": "设置节点属性",
"props": {
"target": {
"type": "node",
"alias": "目标节点"
},
"field": {
"type": "string",
"alias": "属性名"
},
"valueType": {
"type": "enum",
"enum": ["number", "string", "boolean"],
"alias": "数值类型",
"default": "number"
},
"value": {
"type": "string",
"alias": "数值"
}
},
"output": [
"success"
]
}
\ No newline at end of file
/**
* Created by rockyl on 2019-11-16.
*/
let targetNode = target || props.target;
if(targetNode){
targetNode.visible = props.visible;
}
next('success');
{
"name": "设置节点可见性",
"desc": "设置节点可见性",
"props": {
"target": {
"type": "node",
"alias": "目标节点"
},
"visible": {
"type": "boolean",
"alias": "可否可见",
"default": false
}
},
"output": [
"success"
]
}
\ No newline at end of file
/**
* Created by rockyl on 2019-11-16.
*/
let targetNode = target || props.target;
if (targetNode) {
const {scriptsProxy} = targetNode;
const {scriptIndex, scriptName, enabled} = props;
let script;
if (scriptIndex !== undefined) {
script = scriptsProxy.all[scriptIndex];
} else if (scriptName !== undefined) {
script = scriptsProxy.get(scriptName);
}
if (script) {
script.disabled = !enabled;
}
}
next('success');
{
"name": "设置脚本有效性",
"desc": "设置脚本有效性,优先查找索引",
"props": {
"target": {
"type": "node",
"alias": "目标节点"
},
"scriptIndex": {
"type": "number",
"alias": "脚本索引"
},
"name": {
"type": "string",
"alias": "脚本名"
},
"enabled": {
"type": "boolean",
"alias": "可否有效",
"default": false
}
},
"output": [
"success"
]
}
\ No newline at end of file
/**
* Created by rockyl on 2019-11-16.
*/
let targetNode = target || props.target;
if (targetNode) {
const {scriptsProxy} = targetNode;
const {scriptIndex, scriptName, enabled} = props;
let script;
if (scriptIndex !== undefined) {
script = scriptsProxy.all[scriptIndex];
} else if (scriptName !== undefined) {
script = scriptsProxy.get(scriptName);
}
if (script) {
const {field, valueType, value} = props;
if (field && value) {
let tValue;
switch (valueType) {
case 'number':
tValue = parseFloat(value);
break;
case 'string':
tValue = value;
break;
case 'boolean':
tValue = value === 'true' ? true : (value === 'false' ? false : value);
break;
}
if (tValue !== undefined) {
script[field] = tValue;
}
}
}
}
next('success');
{
"name": "设置脚本属性",
"desc": "设置脚本属性,优先查找索引",
"props": {
"target": {
"type": "node",
"alias": "目标节点"
},
"scriptIndex": {
"type": "number",
"alias": "脚本索引"
},
"name": {
"type": "string",
"alias": "脚本名"
},
"field": {
"type": "string",
"alias": "属性名"
},
"valueType": {
"type": "enum",
"enum": ["number", "string", "boolean"],
"alias": "数值类型",
"default": "number"
},
"value": {
"type": "string",
"alias": "数值"
}
},
"output": [
"success"
]
}
\ No newline at end of file
...@@ -24,9 +24,10 @@ function compileProcess(sourcePath, output, isBuiltin) { ...@@ -24,9 +24,10 @@ function compileProcess(sourcePath, output, isBuiltin) {
meta.type = 'builtin' meta.type = 'builtin'
} }
const outputPath = path.join(output, sourcePath + '.json'); const outputPath = path.join(output, sourcePath);
fs.ensureDirSync(path.dirname(outputPath)); fs.ensureDirSync(path.dirname(outputPath));
fs.writeJsonSync(outputPath, meta, {spaces: ' '}); fs.writeJsonSync(outputPath + '.json', meta, {spaces: ' '});
fs.writeFileSync(outputPath + '.js', code);
console.log(`compile process [${sourcePath}] successfully!`); console.log(`compile process [${sourcePath}] successfully!`);
} }
......
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