Commit 9b0501ea authored by rockyl's avatar rockyl

增加toast

修改projectX目录
parent af202e25
......@@ -246,6 +246,6 @@
}
],
"id": "api-polling",
"group": "projextX",
"group": "projectX",
"type": "builtin"
}
{
"props": {
"animation": {
"type": "boolean",
"default": true,
"alias": "消失动画"
},
"hideDuration": {
"type": "number",
"default": 200,
"alias": "消失动画时间"
}
},
"name": "隐藏Toast",
"output": [
"success"
],
"id": "hide-toast",
"script": "var animation = engine.findVariable('animation', args, props);\nvar hideDuration = engine.findVariable('hideDuration', args, props);\nglobal.gameStage.toast.hide(animation, hideDuration);\nnext('success');\n",
"group": "view",
"type": "builtin"
}
......@@ -24,7 +24,7 @@
"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', args);\n",
"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 if (scriptIndex !== undefined) {\n var script = scriptsProxy.all[scriptIndex];\n if (script) {\n script.disabled = !enabled;\n }\n }\n else if (scriptName !== undefined) {\n var scripts = scriptsProxy.get(scriptName);\n for (var _i = 0, scripts_1 = scripts; _i < scripts_1.length; _i++) {\n var script = scripts_1[_i];\n script.disabled = !enabled;\n }\n }\n}\nnext('success', args);\n",
"group": "view",
"type": "builtin"
}
{
"props": {
"viewName": {
"type": "string",
"alias": "视图名"
},
"text": {
"type": "string",
"alias": "内容"
},
"padding": {
"type": "number",
"default": 10,
"alias": "边距"
},
"duration": {
"type": "number",
"default": 1000,
"alias": "停留时间"
},
"showDuration": {
"type": "number",
"default": 300,
"alias": "展示动画时间"
},
"hideDuration": {
"type": "number",
"default": 200,
"alias": "消失动画时间"
}
},
"name": "显示Toast",
"output": [
"success"
],
"id": "show-toast",
"script": "var toastProps = Object.assign({}, props, args);\nglobal.gameStage.toast.show(toastProps);\nnext('success');\n",
"group": "view",
"type": "builtin"
}
{
"props": {
"uri": {
"type": "string",
"alias": "链接"
},
"method": {
"type": "enum",
"enum": [
"get",
"post"
],
"alias": "方法",
"default": "get"
},
"count": {
"type": "number",
"alias": "次数",
"default": 10
},
"delay": {
"type": "number",
"default": 500,
"alias": "单次延时"
},
"dataName": {
"type": "string",
"alias": "数据名"
},
"field": {
"type": "string",
"alias": "字段名"
},
"successValues": {
"type": "string",
"alias": "成功值"
},
"params": {
"type": "map",
"alias": "参数"
}
},
"name": "API轮询",
"output": [
"success",
"failed",
"timeout",
"exception"
],
"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": [
"37b87a14-679b-49b8-9293-321b82d6019d"
]
}
},
"9def8371-1326-4daa-8220-78cf888297e3": {
"uuid": "9def8371-1326-4daa-8220-78cf888297e3",
"meta": "wait",
"design": {
"x": 265,
"y": 313,
"input": {
"default": [
{
"x": 5.5,
"y": 39
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 39
}
]
}
},
"props": {
"duration": {
"type": "link",
"alias": "delay"
}
},
"output": {
"complete": [
"37b87a14-679b-49b8-9293-321b82d6019d"
]
}
},
"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": {
"success": [
{
"x": 124.5,
"y": 42
}
],
"continue": [
{
"x": 124.5,
"y": 56
}
],
"timeout": [
{
"x": 124.5,
"y": 70
}
]
}
},
"props": {
"count": {
"type": "link"
},
"field": {
"type": "link"
},
"successValues": {
"type": "link"
}
},
"output": {
"continue": [
"9def8371-1326-4daa-8220-78cf888297e3"
]
}
},
"37b87a14-679b-49b8-9293-321b82d6019d": {
"uuid": "37b87a14-679b-49b8-9293-321b82d6019d",
"meta": "api-request",
"design": {
"x": 250,
"y": 43,
"input": {
"default": [
{
"x": 5.5,
"y": 64.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 50.5
}
],
"failed": [
{
"x": 124.5,
"y": 64.5
}
],
"exception": [
{
"x": 124.5,
"y": 78.5
}
]
}
},
"props": {
"uri": {
"type": "link"
},
"method": {
"type": "link"
},
"dataName": {
"type": "link"
},
"params": {
"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": "projextX",
"type": "builtin"
}
]
}
\ No newline at end of file
......@@ -134,7 +134,7 @@
"metas": [
{
"id": "a4b27753-4cbb-47e3-9b31-51ced475e41a",
"script": "var projectX = 'projectx';\nvar projectID = engine.env.projectID;\nvar uri = engine.findVariable('uri', args, props);\nnext('success', {url: engine.joinPath(projectX, projectID, uri)});",
"script": "var uri = engine.findVariable('uri', args, props);\nvar url;\nif(location.pathname === '/preview'){\n\tvar projectX = 'projectx';\n\tvar projectID = engine.env.projectID;\n url = engine.joinPath(projectX, projectID, uri);\n}else{\n url = uri;\n}\nnext('success', {url:url});",
"props": {
"uri": {
"type": "string",
......
/**
* Created by rockyl on 2019-11-16.
*/
const animation = engine.findVariable('animation', args, props);
const hideDuration = engine.findVariable('hideDuration', args, props);
global.gameStage.toast.hide(animation, hideDuration);
next('success');
\ No newline at end of file
{
"props": {
"animation": {
"type": "boolean",
"default": true,
"alias": "消失动画"
},
"hideDuration": {
"type": "number",
"default": 200,
"alias": "消失动画时间"
}
},
"name": "隐藏Toast",
"output": [
"success"
]
}
\ No newline at end of file
/**
* Created by rockyl on 2019-11-16.
*/
const toastProps = Object.assign({}, props, args);
global.gameStage.toast.show(toastProps);
next('success');
\ No newline at end of file
{
"props": {
"viewName": {
"type": "string",
"alias": "视图名"
},
"text": {
"type": "string",
"alias": "内容"
},
"padding": {
"type": "number",
"default": 10,
"alias": "边距"
},
"duration": {
"type": "number",
"default": 1000,
"alias": "停留时间"
},
"showDuration": {
"type": "number",
"default": 300,
"alias": "展示动画时间"
},
"hideDuration": {
"type": "number",
"default": 200,
"alias": "消失动画时间"
}
},
"name": "显示Toast",
"output": [
"success"
]
}
\ No newline at end of file
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