From 11fe36a44edbb8dfbbfd5dd3e5e5babef6b8f54e Mon Sep 17 00:00:00 2001 From: YouWei Zhao Date: Sat, 30 Mar 2019 19:25:57 -0400 Subject: [PATCH] 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) { +