Commit 092956b1 authored by rockyl's avatar rockyl

重新组织

parents
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
{
"name": "比较",
"desc": "比较两个值",
"props": {
"left": {
"alias": "左值",
"type": "data",
"default": ""
},
"right": {
"alias": "右值",
"type": "data",
"default": ""
},
"strict": {
"alias": "严格模式",
"type": "boolean",
"default": false
},
"operator": {
"alias": "操作符",
"type": "enum",
"enum": [
"==",
">",
">=",
"<",
"<=",
"!="
],
"default": "=="
}
},
"output": [
"true",
"false"
],
"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",
"group": "base",
"type": "builtin"
}
{
"name": "入口",
"desc": "入口节点,每个行为的入口",
"props": {},
"output": [
"success"
],
"id": "entry",
"script": "next('success');\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"
}
{
"name": "日志",
"desc": "打印日志",
"props": {
"content": {
"alias": "内容",
"type": "string",
"default": ""
},
"error": {
"alias": "是否错误模式",
"type": "boolean",
"default": false
}
},
"output": [
"success"
],
"id": "log",
"script": "console.log(props ? props.content : (args ? args.content : ''));\nnext('success');\n",
"group": "base",
"type": "builtin"
}
{
"name": "关闭弹窗",
"desc": "关闭弹窗",
"props": {
"closeAll": {
"alias": "是否关闭全部弹窗",
"type": "boolean",
"default": false
}
},
"output": [
"complete"
],
"id": "pop-dialog",
"script": "if (props.closeAll) {\n engine.gameStage.popupContainer.popAll();\n}\nelse {\n engine.gameStage.popupContainer.pop();\n}\n",
"group": "base",
"type": "builtin"
}
{
"name": "回退场景",
"desc": "回退到上一个场景",
"props": {
"popAll": {
"alias": "是否回退到最低层场景",
"type": "boolean",
"default": false
},
"viewName": {
"alias": "目标视图名",
"type": "string"
}
},
"output": [
"complete"
],
"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",
"group": "base",
"type": "builtin"
}
{
"name": "弹出弹窗",
"desc": "根据视图名弹出弹窗",
"props": {
"viewName": {
"alias": "目标视图名",
"type": "string"
},
"center": {
"alias": "是否居中展示",
"type": "boolean",
"default": true
}
},
"output": [
"complete"
],
"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",
"group": "base",
"type": "builtin"
}
{
"name": "展示场景",
"desc": "根据视图名展示场景",
"props": {
"viewName": {
"alias": "目标视图名",
"type": "string"
}
},
"output": [
"complete"
],
"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",
"group": "base",
"type": "builtin"
}
{
"name": "放置数据",
"desc": "在数据中心放置数据",
"props": {
"name": {
"type": "string",
"alias": "名称"
},
"path": {
"type": "string",
"alias": "路径"
}
},
"output": [
"success"
],
"id": "put-data",
"script": "engine.gameStage.dataCenter.mutate(props.name, args, props.path);\nnext('success', args);\n",
"group": "base",
"type": "builtin"
}
{
"name": "设置可否交互",
"desc": "设置可否交互",
"props": {
"target": {
"type": "node",
"alias": "目标节点"
},
"enabled": {
"type": "boolean",
"alias": "可否交互",
"default": false
}
},
"output": [
"success"
],
"id": "set-mouse-enabled",
"script": "var targetNode = target || props.target;\nif (targetNode) {\n targetNode.mouseEnabled = props.enabled;\n next('success');\n}\n",
"group": "base",
"type": "builtin"
}
{
"name": "等待",
"desc": "等待一段时间后继续",
"props": {
"duration": {
"alias": "时间(毫秒)",
"type": "number",
"default": 1000
}
},
"output": [
"complete"
],
"id": "wait",
"script": "setTimeout(function () {\n next('complete');\n}, args ? args.duration : (props.duration || 0));\n",
"group": "base",
"type": "builtin"
}
{
"name": "兑吧接口",
"desc": "通用兑吧接口",
"props": {
"url": {
"type": "string",
"alias": "链接"
},
"method": {
"type": "enum",
"enum": [
"get",
"post"
],
"alias": "方法",
"default": "get"
},
"name": {
"type": "string",
"alias": "数据名"
}
},
"output": [
"success",
"failed"
],
"sub": {
"5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56": {
"uuid": "5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 31
}
]
}
},
"props": {},
"output": {
"success": [
"69e28053-dfb3-459e-a9e5-4964c6e35193"
]
}
},
"69e28053-dfb3-459e-a9e5-4964c6e35193": {
"uuid": "69e28053-dfb3-459e-a9e5-4964c6e35193",
"meta": "http-request",
"design": {
"x": 67,
"y": 139,
"input": {
"default": [
{
"x": 5.5,
"y": 47.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 33.5
}
],
"failed": [
{
"x": 124.5,
"y": 47.5
}
],
"exception": [
{
"x": 124.5,
"y": 61.5
}
]
}
},
"props": {
"url": {
"type": "link"
},
"method": {
"type": "link"
}
},
"output": {
"success": [
"39dce565-539b-44b6-901c-0344467795a8"
]
}
},
"39dce565-539b-44b6-901c-0344467795a8": {
"uuid": "39dce565-539b-44b6-901c-0344467795a8",
"meta": "duiba-api-transform",
"design": {
"x": 184,
"y": 275,
"input": {
"default": [
{
"x": 5.5,
"y": 30.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 23.5
}
],
"failed": [
{
"x": 124.5,
"y": 37.5
}
]
}
},
"props": {},
"output": {
"success": [
"e95e7bbc-b592-4f87-b433-77fd03a9ef51"
]
}
},
"e95e7bbc-b592-4f87-b433-77fd03a9ef51": {
"uuid": "e95e7bbc-b592-4f87-b433-77fd03a9ef51",
"meta": "put-data",
"design": {
"x": 280,
"y": 367,
"input": {
"default": [
{
"x": 5.5,
"y": 47.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 47.5
}
]
}
},
"props": {
"name": {
"type": "link"
}
},
"output": {}
}
},
"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",
"type": "builtin"
}
{
"name": "跳转到中奖记录",
"desc": "跳转到中奖记录页面",
"props": {},
"output": [
"success"
],
"id": "goto-record",
"script": "location.href = '/record';\nnext('success');\n",
"group": "duiba",
"type": "builtin"
}
{
"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",
"props": {
"count": {
"type": "number",
"default": 5,
"alias": "次数"
},
"field": {
"type": "string",
"alias": "字段名",
"default": "status"
},
"successArr": {
"type": "string",
"alias": "成功值"
}
},
"name": "轮询判断",
"output": [
"success",
"continue",
"timeout"
],
"id": "http-polling-judge",
"group": "net",
"type": "builtin"
}
{
"name": "HttpRequest",
"desc": "http请求",
"props": {
"url": {
"type": "string",
"alias": "地址"
},
"method": {
"type": "enum",
"enum": [
"get",
"post"
],
"alias": "方法",
"default": "get"
}
},
"output": [
"success",
"failed",
"exception"
],
"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",
"group": "net",
"type": "builtin"
}
{
"name": "点击缩放",
"props": {
"zoomTo": {
"alias": "缩放至",
"type": "number",
"default": 1.1
}
},
"id": "touch-zoom",
"code": "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar TouchZoom = (function () {\n function TouchZoom() {\n this.zoomTo = 1.1;\n }\n TouchZoom.prototype.mounted = function () {\n this.host.anchorX = this.host.width / 2;\n this.host.anchorY = this.host.height / 2;\n this.host.addEventListener(engine.MouseEvent.MOUSE_DOWN, this._onMouseDown, this);\n };\n TouchZoom.prototype._onMouseDown = function (e) {\n this.host.scaleX = this.host.scaleY = this.zoomTo;\n this.host.stage.once(engine.MouseEvent.MOUSE_UP, this._onMouseUp, this);\n };\n TouchZoom.prototype._onMouseUp = function (e) {\n this.host.scaleX = this.host.scaleY = 1;\n };\n TouchZoom.id = 'touch-zoom';\n return TouchZoom;\n}());\nexports.default = TouchZoom;\n"
}
This diff is collapsed.
{
"name": "process-lib",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"build-process": "node scripts/compiler-process",
"build-script": "node scripts/compiler-script"
},
"devDependencies": {
"fs-extra": "^8.1.0",
"typescript": "^3.7.2"
},
"dependencies": {
"glob": "^7.1.6"
}
}
/**
* Created by rockyl on 2019-11-16.
*/
let operator = (args ? args.operator : props.operator) || '==';
if(operator === '==' || operator === '!='){
operator += '=';
}
let func = new Function('return ' + props.left + operator + props.right);
let result = func();
next(result ? 'true' : 'false');
{
"name": "比较",
"desc": "比较两个值",
"props": {
"left": {"alias": "左值","type": "data", "default": ""},
"right": {"alias": "右值","type": "data", "default": ""},
"strict": {"alias": "严格模式","type": "boolean", "default": false},
"operator": {"alias": "操作符","type": "enum",
"enum": ["==",">",">=","<","<=","!="],
"default": "=="}
},
"output": [
"true", "false"
]
}
\ No newline at end of file
/**
* Created by rockyl on 2019-11-16.
*/
next('success');
{
"name": "入口",
"desc": "入口节点,每个行为的入口",
"props": {},
"output": [
"success"
]
}
/**
* 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"
]
}
/**
* Created by rockyl on 2019-11-16.
*/
console.log(props ? props.content : (args ? args.content : ''));
next('success');
\ No newline at end of file
{
"name": "日志",
"desc": "打印日志",
"props": {
"content": {
"alias": "内容",
"type": "string",
"default": ""
},
"error": {
"alias": "是否错误模式",
"type": "boolean",
"default": false
}
},
"output": [
"success"
]
}
\ No newline at end of file
/**
* Created by rockyl on 2019-11-16.
*/
if(props.closeAll){
engine.gameStage.popupContainer.popAll();
}else{
engine.gameStage.popupContainer.pop();
}
{
"name": "关闭弹窗",
"desc": "关闭弹窗",
"props": {
"closeAll": {
"alias": "是否关闭全部弹窗",
"type": "boolean",
"default": false
}
},
"output": [
"complete"
]
}
\ No newline at end of file
/**
* Created by rockyl on 2019-11-16.
*/
if(props.closeAll){
if (!props.viewName) {
console.log('没有设置视图名');
next('exception', '没有设置视图名');
}else{
let gameStage = engine.gameStage;
let viewConfig = gameStage.getViewConfigByName(props.viewName);
if (viewConfig) {
let view = engine.instantiate(viewConfig);
gameStage.sceneContainer.push(view);
} else {
console.error('view config not exists');
}
}
}else{
engine.gameStage.popupContainer.pop();
}
{
"name": "回退场景",
"desc": "回退到上一个场景",
"props": {
"popAll": {
"alias": "是否回退到最低层场景",
"type": "boolean",
"default": false
},
"viewName": {
"alias": "目标视图名",
"type": "string"
}
},
"output": [
"complete"
]
}
\ No newline at end of file
/**
* Created by rockyl on 2019-11-16.
*/
if (!props.viewName) {
console.log('没有设置视图名');
next('exception', '没有设置视图名');
}else{
let gameStage = engine.gameStage;
let viewConfig = gameStage.getViewConfigByName(props.viewName);
if (viewConfig) {
let view = engine.instantiate(viewConfig);
gameStage.popupContainer.push(view, {center: props.center || true});
} else {
console.error('view config not exists');
}
}
{
"name": "弹出弹窗",
"desc": "根据视图名弹出弹窗",
"props": {
"viewName": {
"alias": "目标视图名",
"type": "string"
},
"center": {
"alias": "是否居中展示",
"type": "boolean",
"default": true
}
},
"output": [
"complete"
]
}
\ No newline at end of file
/**
* Created by rockyl on 2019-11-16.
*/
if (!props.viewName) {
console.log('没有设置视图名');
next('exception', '没有设置视图名');
}else{
let gameStage = engine.gameStage;
let viewConfig = gameStage.getViewConfigByName(props.viewName);
if (viewConfig) {
let view = engine.instantiate(viewConfig);
gameStage.sceneContainer.push(view);
} else {
console.error('view config not exists');
}
}
{
"name": "展示场景",
"desc": "根据视图名展示场景",
"props": {
"viewName": {
"alias": "目标视图名",
"type": "string"
}
},
"output": [
"complete"
]
}
\ No newline at end of file
/**
* Created by rockyl on 2019-11-16.
*/
engine.gameStage.dataCenter.mutate(props.name, args, props.path);
next('success', args);
{
"name": "放置数据",
"desc": "在数据中心放置数据",
"props": {
"name": {
"type": "string",
"alias": "名称"
},
"path": {
"type": "string",
"alias": "路径"
}
},
"output": [
"success"
]
}
/**
* Created by rockyl on 2019-11-16.
*/
let targetNode = target || props.target;
if(targetNode){
targetNode.mouseEnabled = props.enabled;
next('success')
}
\ No newline at end of file
{
"name": "设置可否交互",
"desc": "设置可否交互",
"props": {
"target": {
"type": "node",
"alias": "目标节点"
},
"enabled": {
"type": "boolean",
"alias": "可否交互",
"default": false
}
},
"output": [
"success"
]
}
\ No newline at end of file
/**
* Created by rockyl on 2019-11-16.
*/
setTimeout(function(){
next('complete')
}, args ? args.duration : (props.duration || 0));
{
"name": "等待",
"desc": "等待一段时间后继续",
"props": {
"duration": {
"alias": "时间(毫秒)",
"type": "number",
"default": 1000
}
},
"output": [
"complete"
]
}
\ No newline at end of file
/**
* Created by rockyl on 2019-11-16.
*/
next('success');
{
"name": "兑吧接口",
"desc": "通用兑吧接口",
"props": {
"url": {
"type": "string",
"alias": "链接"
},
"method": {
"type": "enum",
"enum": [
"get",
"post"
],
"alias": "方法",
"default": "get"
},
"name": {
"type": "string",
"alias": "数据名"
}
},
"output": [
"success",
"failed"
],
"sub": {
"5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56": {
"uuid": "5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 31
}
]
}
},
"props": {},
"output": {
"success": [
"69e28053-dfb3-459e-a9e5-4964c6e35193"
]
}
},
"69e28053-dfb3-459e-a9e5-4964c6e35193": {
"uuid": "69e28053-dfb3-459e-a9e5-4964c6e35193",
"meta": "http-request",
"design": {
"x": 67,
"y": 139,
"input": {
"default": [
{
"x": 5.5,
"y": 47.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 33.5
}
],
"failed": [
{
"x": 124.5,
"y": 47.5
}
],
"exception": [
{
"x": 124.5,
"y": 61.5
}
]
}
},
"props": {
"url": {
"type": "link"
},
"method": {
"type": "link"
}
},
"output": {
"success": [
"39dce565-539b-44b6-901c-0344467795a8"
]
}
},
"39dce565-539b-44b6-901c-0344467795a8": {
"uuid": "39dce565-539b-44b6-901c-0344467795a8",
"meta": "duiba-api-transform",
"design": {
"x": 184,
"y": 275,
"input": {
"default": [
{
"x": 5.5,
"y": 30.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 23.5
}
],
"failed": [
{
"x": 124.5,
"y": 37.5
}
]
}
},
"props": {},
"output": {
"success": [
"e95e7bbc-b592-4f87-b433-77fd03a9ef51"
]
}
},
"e95e7bbc-b592-4f87-b433-77fd03a9ef51": {
"uuid": "e95e7bbc-b592-4f87-b433-77fd03a9ef51",
"meta": "put-data",
"design": {
"x": 280,
"y": 367,
"input": {
"default": [
{
"x": 5.5,
"y": 47.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 47.5
}
]
}
},
"props": {
"name": {
"type": "link"
}
},
"output": {}
}
},
"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请求返回成兑吧接口的解析"
}
]
}
/**
* Created by rockyl on 2019-11-16.
*/
location.href='/record';
next('success');
{
"name": "跳转到中奖记录",
"desc": "跳转到中奖记录页面",
"props": {
},
"output": [
"success"
]
}
\ No newline at end of file
/**
* 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');
}
{
"script": "",
"props": {
"count": {
"type": "number",
"default": 5,
"alias": "次数"
},
"field": {
"type": "string",
"alias": "字段名",
"default": "status"
},
"successArr": {
"type": "string",
"alias": "成功值"
}
},
"name": "轮询判断",
"output": [
"success",
"continue",
"timeout"
]
}
\ No newline at end of file
/**
* 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": "轮询",
"script": "",
"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');\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"
},
"successArr": {
"type": "string",
"alias": "成功值"
}
},
"name": "轮询判断",
"output": [
"success",
"continue",
"timeout"
],
"id": "http-polling-judge",
"group": "net",
"type": "builtin"
}
]
}
\ No newline at end of file
/**
* Created by rockyl on 2019-11-16.
*/
if(!props.url){
console.log('url is empty');
next('exception', '\'url is empty\'');
}else{
engine.globalLoader.httpRequest((s, payload) => {
if(s){
next('success', payload);
}else{
next('failed', payload);
}
}, props.url, props.method || 'get', 'json');
}
{
"name": "HttpRequest",
"desc": "http请求",
"props": {
"url": {"type": "string", "alias": "地址"},
"method": {"type": "enum", "enum": ["get", "post"], "alias": "方法", "default": "get"}
},
"output": ["success", "failed", "exception"]
}
\ No newline at end of file
/**
* Created by rockyl on 2019-11-20.
*/
export default class TouchZoom {
static id = 'touch-zoom';
host;
zoomTo = 1.1;
mounted() {
this.host.anchorX = this.host.width / 2;
this.host.anchorY = this.host.height / 2;
this.host.addEventListener(engine.MouseEvent.MOUSE_DOWN, this._onMouseDown, this);
}
private _onMouseDown(e) {
this.host.scaleX = this.host.scaleY = this.zoomTo;
this.host.stage.once(engine.MouseEvent.MOUSE_UP, this._onMouseUp, this);
}
private _onMouseUp(e) {
this.host.scaleX = this.host.scaleY = 1;
}
}
{
"name": "点击缩放",
"props": {
"zoomTo": {
"alias": "缩放至",
"type": "number",
"default": 1.1
}
}
}
\ No newline at end of file
/**
* Created by rockyl on 2019-11-17.
*/
const {prepare, compile} = require('./tscompiler');
const fs = require('fs-extra');
const path = require('path');
const glob = require('glob');
const tsconfig = fs.readJsonSync('tsconfig.json');
prepare(tsconfig, process.cwd());
function compileProcess(sourcePath, output, isBuiltin) {
const arr = sourcePath.split('/');
const group = arr[0];
const id = arr[1];
const meta = fs.readJsonSync(path.join('process/' + sourcePath, 'meta.json'));
const {code} = compile('process/' + sourcePath);
meta.id = id;
meta.script = code;
meta.group = group;
if(isBuiltin){
meta.type = 'builtin'
}
const outputPath = path.join(output, sourcePath + '.json');
fs.ensureDirSync(path.dirname(outputPath));
fs.writeJsonSync(outputPath, meta, {spaces: ' '});
console.log(`compile process [${sourcePath}] successfully!`);
}
const [_, __, sourcePath, outputPath = 'dist/processes', builtin] = process.argv;
const isBuiltin = builtin ? builtin === 'builtin' : true;
if (sourcePath) {
compileProcess(sourcePath, outputPath, isBuiltin);
} else {
const files = glob.sync('*/*', {cwd: process.cwd() + '/process'});
for (let file of files) {
compileProcess(file, outputPath, isBuiltin);
}
}
console.log('complete!');
/**
* Created by rockyl on 2019-11-17.
*/
const {prepare, compile} = require('./tscompiler');
const fs = require('fs-extra');
const path = require('path');
const glob = require('glob');
const tsconfig = fs.readJsonSync('tsconfig.json');
prepare(tsconfig, process.cwd());
function compileProcess(sourcePath, output) {
const id = sourcePath;
const meta = fs.readJsonSync(path.join('script/' + sourcePath, 'meta.json'));
const {code} = compile('script/' + sourcePath);
meta.id = id;
meta.code = code;
const outputPath = path.join(output, sourcePath + '.json');
fs.ensureDirSync(path.dirname(outputPath));
fs.writeJsonSync(outputPath, meta, {spaces: ' '});
console.log(`compile process [${sourcePath}] successfully!`);
}
const [_, __, sourcePath, outputPath = 'dist/scripts'] = process.argv;
if (sourcePath) {
compileProcess(sourcePath, outputPath);
} else {
const files = glob.sync('*', {cwd: process.cwd() + '/script'});
for (let file of files) {
compileProcess(file, outputPath);
}
}
console.log('complete!');
/**
* Created by rockyl on 2019-03-28.
*/
const ts = require("typescript");
const fs = require('fs-extra');
const path = require('path');
let _options, _projectPath;
exports.prepare = function (tsconfig, projectPath) {
const config = ts.parseJsonConfigFileContent(tsconfig, ts.sys, projectPath);
_options = config.options;
_projectPath = projectPath;
};
exports.compile = function (file) {
if (!_options) {
throw Error('no options input')
}
let filePath = path.resolve(_projectPath, file + (file.endsWith('.ts') ? '' : '.ts'));
if (!fs.existsSync(filePath)) {
filePath = path.resolve(_projectPath, file + '/index.ts');
if (!fs.existsSync(filePath)) {
throw new Error('source code file not exists');
}
}
let source = fs.readFileSync(filePath, 'utf-8');
let result = ts.transpileModule(source, {compilerOptions: _options});
return {
code: result.outputText,
filePath,
relativeFilePath: './' + path.relative(_projectPath, filePath),
};
};
{
"compilerOptions": {
"target": "es5",
"noImplicitAny": false,
"removeComments": true,
"noEmitOnError": true,
"declarationDir": "types",
"declaration": true,
"experimentalDecorators": true,
"outDir": "dist",
"lib": [
"es5",
"dom",
"es2015.promise"
]
},
"include": [
"libs",
"process",
"script"
],
"exclude": [
"node_modules"
]
}
\ No newline at end of file
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
balanced-match@^1.0.0:
version "1.0.0"
resolved "https://registry.npm.taobao.org/balanced-match/download/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.npm.taobao.org/brace-expansion/download/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
integrity sha1-PH/L9SnYcibz0vUrlm/1Jx60Qd0=
dependencies:
balanced-match "^1.0.0"
concat-map "0.0.1"
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.npm.taobao.org/concat-map/download/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
fs-extra@^8.1.0:
version "8.1.0"
resolved "https://registry.npm.taobao.org/fs-extra/download/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0"
integrity sha1-SdQ8RaiM2Wd2aMt74bRu/bjS4cA=
dependencies:
graceful-fs "^4.2.0"
jsonfile "^4.0.0"
universalify "^0.1.0"
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.npm.taobao.org/fs.realpath/download/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
glob@^7.1.6:
version "7.1.6"
resolved "https://registry.npm.taobao.org/glob/download/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
integrity sha1-FB8zuBp8JJLhJVlDB0gMRmeSeKY=
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"
graceful-fs@^4.1.6, graceful-fs@^4.2.0:
version "4.2.3"
resolved "https://registry.npm.taobao.org/graceful-fs/download/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423"
integrity sha1-ShL/G2A3bvCYYsIJPt2Qgyi+hCM=
inflight@^1.0.4:
version "1.0.6"
resolved "https://registry.npm.taobao.org/inflight/download/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=
dependencies:
once "^1.3.0"
wrappy "1"
inherits@2:
version "2.0.4"
resolved "https://registry.npm.taobao.org/inherits/download/inherits-2.0.4.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Finherits%2Fdownload%2Finherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w=
jsonfile@^4.0.0:
version "4.0.0"
resolved "https://registry.npm.taobao.org/jsonfile/download/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"
integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=
optionalDependencies:
graceful-fs "^4.1.6"
minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.npm.taobao.org/minimatch/download/minimatch-3.0.4.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fminimatch%2Fdownload%2Fminimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
integrity sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=
dependencies:
brace-expansion "^1.1.7"
once@^1.3.0:
version "1.4.0"
resolved "https://registry.npm.taobao.org/once/download/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
dependencies:
wrappy "1"
path-is-absolute@^1.0.0:
version "1.0.1"
resolved "https://registry.npm.taobao.org/path-is-absolute/download/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
typescript@^3.7.2:
version "3.7.2"
resolved "https://registry.npm.taobao.org/typescript/download/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb"
integrity sha1-J+SJuV+lkJRF6f717kjYFpetGPs=
universalify@^0.1.0:
version "0.1.2"
resolved "https://registry.npm.taobao.org/universalify/download/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
integrity sha1-tkb2m+OULavOzJ1mOcgNwQXvqmY=
wrappy@1:
version "1.0.2"
resolved "https://registry.npm.taobao.org/wrappy/download/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$/../zeroing-libs" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ 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