From 0023a16007e1020710d2fde537d69e9c940f9ffd Mon Sep 17 00:00:00 2001 From: YouWei Zhao Date: Tue, 26 Mar 2019 14:27:10 -0400 Subject: [PATCH 1/5] Update refactoring.md --- _server/refactoring.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/_server/refactoring.md b/_server/refactoring.md index 5d92d0f4..0dd94dd4 100644 --- a/_server/refactoring.md +++ b/_server/refactoring.md @@ -10,32 +10,34 @@ + [x] editor_blockly 图块化事件编辑器, 基本不改动 + [x] editor_multi 多行文本编辑器, 基本不改动 -+ [ ] editor_table 处理表格的生成, 及其响应的事件, 从原editor\_mode中分离 ++ [x] editor_table 处理表格的生成, 及其响应的事件, 从原editor\_mode中分离 + [ ] editor_file 调用fs.js编辑文件, 把原editor\_file模块化 + [ ] editor_game 处理来自core的数据, 导入为editor的数据, 从原editor中分离 -+ [ ] editor_util 生成guid等函数, 从editor分离 ++ [x] editor_util 生成guid等函数, 从editor分离 + [ ] editor 执行初始化流程加组合各组件 - + [ ] 原editor_mode 移除 + [ ] 原vm 移除 --- -对象结构 ++ [ ] 对象结构 ``` editor: { __proto__: { - blockly: 组件 - multi: 组件 - file: 组件 - table: 组件 - util: 组件 + fs + util + file + table + multi + blockly } game: 来自游戏的数据 config: 编辑器配置 mode: 当前的模式(左侧的选择) map: 当前编辑层的地图 + isMobile: 编辑器是否是手机端 + currentFloorData: 当前编辑的楼层数据 ... } ``` From 05f6b37121e67ae9ab9c9b3cf871ca463d2376fb Mon Sep 17 00:00:00 2001 From: YouWei Zhao Date: Sat, 30 Mar 2019 12:38:56 -0400 Subject: [PATCH 2/5] update refactoring.md --- _server/refactoring.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/_server/refactoring.md b/_server/refactoring.md index 0dd94dd4..9ae0e115 100644 --- a/_server/refactoring.md +++ b/_server/refactoring.md @@ -46,6 +46,10 @@ editor: { 某些注意到的点 ++ 插入公共事件的参数的转义处理 + ++ 转义改由editor.blockly处理,editor.multi原样接受和返回 + + 地图的编辑与其他(如全塔属性和楼层属性), 现在的文件操作的模式是完全不同的 楼层文件的储存与其他不同 @@ -62,7 +66,7 @@ editor: { + [ ] ? 表格折叠 变为四栏, 可以折叠展开 -+ [ ] blockly对于无法识别的图块原样返回 ++ [x] blockly对于无法识别的图块原样返回 + [ ] ? 简洁的事件方块注册 `editor.registerEvent('log',[['test','Int','测试',0],['floorId','Idstring','楼层','MT0']])` From 52abd1274025e4ff75f812afcb4232023b1d7505 Mon Sep 17 00:00:00 2001 From: YouWei Zhao Date: Sat, 30 Mar 2019 12:54:34 -0400 Subject: [PATCH 3/5] update refactoring.md --- _server/refactoring.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/_server/refactoring.md b/_server/refactoring.md index 9ae0e115..90ae5681 100644 --- a/_server/refactoring.md +++ b/_server/refactoring.md @@ -59,6 +59,8 @@ editor: { ## 功能改进 ++ [ ] .g4中添加ObjectString, 要求其中的值可以JSON.parse, 生成的code中也是作为对象而不是字符串出现 + + [ ] 大地图 在切换时, 每次都回到最左上->每个楼层记录一个位置 四个箭头目前不能长按 From 11fe36a44edbb8dfbbfd5dd3e5e5babef6b8f54e Mon Sep 17 00:00:00 2001 From: YouWei Zhao Date: Sat, 30 Mar 2019 19:25:57 -0400 Subject: [PATCH 4/5] editor_game --- _server/editor.js | 119 ++------------------------------------- _server/editor_game.js | 124 +++++++++++++++++++++++++++++++++++++++++ editor-mobile.html | 1 + editor.html | 1 + 4 files changed, 131 insertions(+), 114 deletions(-) create mode 100644 _server/editor_game.js diff --git a/_server/editor.js b/_server/editor.js index 03b0cf01..3d50fa1f 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -43,24 +43,11 @@ editor.info editor.prototype.init = function (callback) { editor_util_wrapper(editor); + editor_game_wrapper(editor, main, core); editor_table_wrapper(editor); var afterMainInit = function () { - core.floors = JSON.parse(JSON.stringify(core.floors, function (k, v) { - if (v instanceof Function) { - return v.toString() - } else return v - })); - core.data = JSON.parse(JSON.stringify(core.data, function (k, v) { - if (v instanceof Function) { - return v.toString() - } else return v - })); - data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = JSON.parse(JSON.stringify(data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d, function (k, v) { - if (v instanceof Function) { - return v.toString() - } else return v - })); + editor.game.fixFunctionInGameData(); editor.main = main; editor.core = core; editor.fs = fs; @@ -78,10 +65,10 @@ editor.prototype.init = function (callback) { var afterCoreReset = function () { - editor.idsInit(core.maps, core.icons.icons); // 初始化图片素材信息 + editor.game.idsInit(core.maps, core.icons.icons); // 初始化图片素材信息 editor.drawInitData(core.icons.icons); // 初始化绘图 - editor.fetchMapFromCore(); + editor.game.fetchMapFromCore(); editor.updateMap(); editor.buildMark(); editor.drawEventBlock(); @@ -105,69 +92,6 @@ editor.prototype.init = function (callback) { afterMainInit(); } -editor.prototype.idsInit = function (maps, icons) { - editor.ids = [0]; - editor.indexs = []; - var MAX_NUM = 0; - var keys=Object.keys(maps_90f36752_8815_4be8_b32b_d7fad1d0542e); - for(var ii=0;iiMAX_NUM && v 32*32*3000){ - alert(imgName+'上的图块数量超过了3000,请修改后刷新页面'); - } - for (var id=startOffset; idMAX_NUM && v 32*32*3000){ + alert(imgName+'上的图块数量超过了3000,请修改后刷新页面'); + } + for (var id=startOffset; id + diff --git a/editor.html b/editor.html index 8f826432..0b5c4187 100644 --- a/editor.html +++ b/editor.html @@ -510,6 +510,7 @@ if (location.protocol.indexOf("http")!=0) { + From cfd3058b7e6ba46decc7b563873f00fa976b7d23 Mon Sep 17 00:00:00 2001 From: YouWei Zhao Date: Sat, 30 Mar 2019 19:35:10 -0400 Subject: [PATCH 5/5] update refactoring.md --- _server/refactoring.md | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/_server/refactoring.md b/_server/refactoring.md index 90ae5681..695e71ad 100644 --- a/_server/refactoring.md +++ b/_server/refactoring.md @@ -1,12 +1,11 @@ # 重构 -+ [ ] 按功能拆分文件 -+ [ ] 左侧页面模块化, 方便添加 -+ [ ] 不同的模式的文件操作尽可能模块化 ++ 按功能拆分文件 ++ 左侧页面模块化, 方便添加 ++ 不同的模式的文件操作尽可能模块化 ---- -文件结构 +## 文件结构 + [x] editor_blockly 图块化事件编辑器, 基本不改动 + [x] editor_multi 多行文本编辑器, 基本不改动 @@ -18,9 +17,8 @@ + [ ] 原editor_mode 移除 + [ ] 原vm 移除 ---- -+ [ ] 对象结构 +## 对象结构 ``` editor: { @@ -31,8 +29,8 @@ editor: { table multi blockly + game } - game: 来自游戏的数据 config: 编辑器配置 mode: 当前的模式(左侧的选择) map: 当前编辑层的地图 @@ -44,9 +42,9 @@ editor: { --- -某些注意到的点 +## 某些注意到的点&准备修改的内容 -+ 插入公共事件的参数的转义处理 ++ 插入公共事件的参数的转义处理, .g4中添加ObjectString, 要求其中的值可以JSON.parse, 生成的code中也是作为对象而不是字符串出现 + 转义改由editor.blockly处理,editor.multi原样接受和返回 @@ -57,9 +55,9 @@ editor: { + 目前editor.map中储存的是info\, 准备改为和core一致只储存数字 -## 功能改进 ++ editor.file在修改是不再返回obj和commentobj,只在查询时返回 -+ [ ] .g4中添加ObjectString, 要求其中的值可以JSON.parse, 生成的code中也是作为对象而不是字符串出现 +## 功能改进 + [ ] 大地图 在切换时, 每次都回到最左上->每个楼层记录一个位置