diff --git a/_server/editor.js b/_server/editor.js index db7bf80b..6217c361 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -20,7 +20,7 @@ editor.prototype.init = function (callback) { editor.updateMap(); editor.currentFloorId = core.status.floorId; editor.currentFloorData = core.floors[core.status.floorId]; - + editor.drawEventBlock(); if (Boolean(callback)) callback(); }); } @@ -193,7 +193,33 @@ editor.prototype.drawMapBg = function (img) { } } -editor.prototype +editor.prototype.drawEventBlock = function () { + var fg=document.getElementById('efg').getContext('2d'); + + fg.clearRect(0, 0, 416, 416); + for (var i=0;i<13;i++) { + for (var j=0;j<13;j++) { + var color=null; + var loc=i+","+j; + if (core.isset(editor.currentFloorData.events[loc])) + color = '#FF0000'; + else if (core.isset(editor.currentFloorData.changeFloor[loc])) + color = '#00FF00'; + else if (core.isset(editor.currentFloorData.afterBattle[loc])) + color = '#0000FF'; + else if (core.isset(editor.currentFloorData.afterGetItem[loc])) + color = '#FFFF00'; + else if (core.isset(editor.currentFloorData.afterOpenDoor[loc])) + color = '#FF00FF'; + else if (core.isset(editor.currentFloorData.cannotMove[loc])) + color = '#00FFFF'; + if (color!=null) { + fg.fillStyle = color; + fg.fillRect(32*i, 32*j+32-12, 12, 12); + } + } + } +} editor.prototype.updateMap = function () { var blocks = main.editor.mapIntoBlocks(editor.map.map(function (v) { @@ -342,6 +368,7 @@ editor.prototype.changeFloor = function (floorId, callback) { editor.currentFloorId = core.status.floorId; editor.currentFloorData = core.floors[core.status.floorId]; editor_mode.floor(); + editor.drawEventBlock(); if (core.isset(callback)) callback(); }); } diff --git a/_server/editor_mode.js b/_server/editor_mode.js index a754ad2a..278d1428 100644 --- a/_server/editor_mode.js +++ b/_server/editor_mode.js @@ -195,7 +195,8 @@ editor_mode = function (editor) { printe(objs_.slice(-1)[0]); throw(objs_.slice(-1)[0]) } - ;printf('修改成功') + ;printf('修改成功'); + editor.drawEventBlock(); }); break; case 'emenyitem': @@ -222,7 +223,7 @@ editor_mode = function (editor) { printe(objs_.slice(-1)[0]); throw(objs_.slice(-1)[0]) } - ;printf('修改成功') + ;printf('修改成功'); }); } break; @@ -233,7 +234,7 @@ editor_mode = function (editor) { printe(objs_.slice(-1)[0]); throw(objs_.slice(-1)[0]) } - ;printf('修改成功') + ;printf('修改成功'); }); break; case 'tower':