Commit 857e99eb authored by rockyl's avatar rockyl

修改processes和scripts为json字符串,在编辑器端转换成obj

parent 29348cbc
...@@ -10,138 +10,14 @@ ...@@ -10,138 +10,14 @@
"custom": [] "custom": []
}, },
"processes": [ "processes": [
{ "{\"id\":\"entry\",\"name\":\"Entry\",\"desc\":\"入口\",\"group\":\"base\",\"type\":\"builtin\",\"props\":{},\"output\":[\"success\"]}",
"id": "entry", "{\"id\":\"wait\",\"name\":\"Wait\",\"desc\":\"等待执行\",\"group\":\"base\",\"type\":\"builtin\",\"props\":{\"duration\":{\"type\":\"number\",\"default\":1000}},\"output\":[\"complete\"]}",
"name": "Entry", "{\"id\":\"hehe\",\"name\":\"Hehe\",\"desc\":\"呵呵\",\"type\":\"builtin\",\"subEntry\":\"1\",\"sub\":{\"1\":{\"uuid\":\"1\",\"alias\":\"入口\",\"meta\":\"entry\",\"output\":{\"success\":[\"2\"]}},\"2\":{\"uuid\":\"2\",\"meta\":\"wait\",\"alias\":\"等待\",\"props\":{\"duration\":500}}}}",
"desc": "入口", "{\"id\":\"prefab1\",\"name\":\"Prefab1\",\"desc\":\"转盘预设\",\"type\":\"builtin\",\"isPrefab\":true,\"subEntry\":\"1\",\"sub\":{\"1\":{\"uuid\":\"1\",\"alias\":\"入口\",\"meta\":\"entry\",\"output\":{\"success\":[\"2\"]}},\"2\":{\"uuid\":\"2\",\"meta\":\"wait\",\"alias\":\"等待\",\"props\":{\"duration\":500}}}}"
"group": "base",
"type": "builtin",
"props": {},
"output": [
"success"
]
},
{
"id": "wait",
"name": "Wait",
"desc": "等待执行",
"group": "base",
"type": "builtin",
"props": {
"duration": {
"type": "number",
"default": 1000
}
},
"output": [
"complete"
]
},
{
"id": "hehe",
"name": "Hehe",
"desc": "呵呵",
"type": "builtin",
"subEntry": "1",
"sub": {
"1": {
"uuid": "1",
"alias": "入口",
"meta": "entry",
"output": {
"success": [
"2"
]
}
},
"2": {
"uuid": "2",
"meta": "wait",
"alias": "等待",
"props": {
"duration": 500
}
}
}
},
{
"id": "prefab1",
"name": "Prefab1",
"desc": "转盘预设",
"type": "builtin",
"isPrefab": true,
"subEntry": "1",
"sub": {
"1": {
"uuid": "1",
"alias": "入口",
"meta": "entry",
"output": {
"success": [
"2"
]
}
},
"2": {
"uuid": "2",
"meta": "wait",
"alias": "等待",
"props": {
"duration": 500
}
}
}
}
], ],
"scripts": [ "scripts": [
{ "{\"id\":\"wave\",\"name\":\"Wave\",\"props\":{\"duration\":{\"type\":\"number\",\"default\":1000},\"name\":{\"type\":\"string\",\"default\":\"hello\"},\"color\":{\"type\":\"color\",\"default\":\"#123456\"},\"type\":{\"type\":[\"rotate\",\"jump\",\"breath\"],\"default\":\"rotate\"},\"ease\":{\"type\":[\"linear\",\"cubic\",\"back\"],\"default\":\"linear\"},\"autoPlay\":{\"type\":\"boolean\",\"default\":false}}}",
"id": "wave", "{\"id\":\"zoom-button\",\"name\":\"ZoomButton\",\"props\":{\"zoomTo\":{\"type\":\"number\",\"default\":1.1}}}"
"name": "Wave",
"props": {
"duration": {
"type": "number",
"default": 1000
},
"name": {
"type": "string",
"default": "hello"
},
"color": {
"type": "color",
"default": "#123456"
},
"type": {
"type": [
"rotate",
"jump",
"breath"
],
"default": "rotate"
},
"ease": {
"type": [
"linear",
"cubic",
"back"
],
"default": "linear"
},
"autoPlay": {
"type": "boolean",
"default": false
}
}
},
{
"id": "zoom-button",
"name": "ZoomButton",
"props": {
"zoomTo": {
"type": "number",
"default": 1.1
}
}
}
] ]
} }
} }
\ No newline at end of file
...@@ -22,6 +22,9 @@ export const envStore = { ...@@ -22,6 +22,9 @@ export const envStore = {
mutations: { mutations: {
updateEnv(state, env) { updateEnv(state, env) {
Object.assign(state, env); Object.assign(state, env);
parseItem(state.processes);
parseItem(state.scripts);
state.initialized = true; state.initialized = true;
}, },
}, },
...@@ -85,3 +88,9 @@ function groupProcesses(processes, filterFunc) { ...@@ -85,3 +88,9 @@ function groupProcesses(processes, filterFunc) {
}); });
return result; return result;
} }
function parseItem(list) {
for (let i = 0, li = list.length; i < li; i++) {
list[i] = JSON.parse(list[i]);
}
}
...@@ -33,7 +33,7 @@ export const projectStore = { ...@@ -33,7 +33,7 @@ export const projectStore = {
views: [], views: [],
assets: [], assets: [],
dataMapping: [], dataMapping: [],
processMap: {}, processes: [],
}, },
activeComponent: {}, activeComponent: {},
activeComponentCopy: {}, // 当前选中节点的镜像,用来处理拖拽时数据变化频繁的问题 activeComponentCopy: {}, // 当前选中节点的镜像,用来处理拖拽时数据变化频繁的问题
......
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