diff --git a/_server/editor.js b/_server/editor.js index 83c29c51..384191d3 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -195,7 +195,7 @@ editor.prototype.fetchMapFromCore = function(){ editor.map = mapArray.map(function (v) { return v.map(function (v) { var x = parseInt(v), y = editor.indexs[x]; - if (!core.isset(y)) { + if (y == null) { printe("素材数字"+x+"未定义。是不是忘了注册,或者接档时没有覆盖icons.js和maps.js?"); y = [0]; } @@ -213,7 +213,7 @@ editor.prototype.fetchMapFromCore = function(){ editor[name]=mapArray.map(function (v) { return v.map(function (v) { var x = parseInt(v), y = editor.indexs[x]; - if (!core.isset(y)) { + if (y == null) { printe("素材数字"+x+"未定义。是不是忘了注册,或者接档时没有覆盖icons.js和maps.js?"); y = [0]; } @@ -242,7 +242,7 @@ editor.prototype.changeFloor = function (floorId, callback) { editor.updateMap(); editor_mode.floor(); editor.drawEventBlock(); - if (core.isset(callback)) callback(); + if (callback) callback(); }); } @@ -251,22 +251,22 @@ editor.prototype.changeFloor = function (floorId, callback) { 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++) { + fg.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__); + for (var i=0;i'; colNum += tpl; } arrColMark.innerHTML = '' + colNum + ''; mapColMark.innerHTML = '' + colNum + ''; var rowNum = ' '; - for (var i = 0; i < 13; i++) { + for (var i = 0; i < core.__SIZE__; i++) { var tpl = '' + (i+offsetY) + '
'; rowNum += tpl; } @@ -522,29 +522,29 @@ editor.prototype.buildMark = function(){ } var buildMark_mobile = function (offsetX,offsetY) { var colNum = ' '; - for (var i = 0; i < 13; i++) { - var tpl = '' + (' '+i).slice(-2).replace(' ',' ') + '
'; + for (var i = 0; i < core.__SIZE__; i++) { + var tpl = '' + (' '+i).slice(-2).replace(' ',' ') + '
'; colNum += tpl; } arrColMark.innerHTML = '' + colNum + ''; //mapColMark.innerHTML = '' + colNum + ''; var rowNum = ' '; - for (var i = 0; i < 13; i++) { - var tpl = '' + (' '+i).slice(-2).replace(' ',' ') + '
'; + for (var i = 0; i < core.__SIZE__; i++) { + var tpl = '' + (' '+i).slice(-2).replace(' ',' ') + '
'; rowNum += tpl; } arrRowMark.innerHTML = rowNum; //mapRowMark.innerHTML = rowNum; //===== var colNum = ' '; - for (var i = 0; i < 13; i++) { - var tpl = '
' + (' '+(i+offsetX)).slice(-2).replace(' ',' ') + '
'; + for (var i = 0; i < core.__SIZE__; i++) { + var tpl = '
' + (' '+(i+offsetX)).slice(-2).replace(' ',' ') + '
'; colNum += tpl; } mapColMark.innerHTML = '
' + colNum + '
'; var rowNum = ' '; - for (var i = 0; i < 13; i++) { - var tpl = '
' + (' '+(i+offsetY)).slice(-2).replace(' ',' ') + '
'; + for (var i = 0; i < core.__SIZE__; i++) { + var tpl = '
' + (' '+(i+offsetY)).slice(-2).replace(' ',' ') + '
'; rowNum += tpl; } mapRowMark.innerHTML = rowNum; @@ -657,7 +657,7 @@ editor.prototype.listen = function () { editor.loc = { 'x': scrollLeft + xx - mid.offsetLeft - mapEdit.offsetLeft, 'y': scrollTop + yy - mid.offsetTop - mapEdit.offsetTop, - 'size': editor.isMobile?(32*innerWidth*0.96/416):32 + 'size': editor.isMobile?(32*innerWidth*0.96/core.__PIXELS__):32 }; return editor.loc; }//返回可用的组件内坐标 @@ -685,7 +685,7 @@ editor.prototype.listen = function () { } holdingPath = 0; stepPostfix = []; - uc.clearRect(0, 0, 416, 416); + uc.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__); }//用于鼠标移出canvas时的自动清除状态 eui.oncontextmenu=function(e){e.preventDefault()} @@ -807,7 +807,7 @@ editor.prototype.listen = function () { editor.updateMap(); holdingPath = 0; stepPostfix = []; - uc.clearRect(0, 0, 416, 416); + uc.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__); } } diff --git a/_server/editor_file.js b/_server/editor_file.js index 6094be7a..ffc860ab 100644 --- a/_server/editor_file.js +++ b/_server/editor_file.js @@ -154,7 +154,7 @@ editor_file = function (editor, callback) { cannotMove: {} }; Object.keys(editor.currentFloorData).forEach(function (t) { - if (!core.isset(editor.currentFloorData[t])) + if (editor.currentFloorData[t] == null) delete editor.currentFloorData[t]; }) editor.currentFloorData.map = "new"; @@ -216,7 +216,7 @@ editor_file = function (editor, callback) { cannotMove: {} }; Object.keys(data).forEach(function (t) { - if (!core.isset(data[t])) + if (data[t] == null) delete data[t]; else { if (t=='map') { @@ -278,7 +278,7 @@ editor_file = function (editor, callback) { // get id num var id = c+idnum; - if (image=='terrains' && core.isset(terrainsId[y])) { + if (image=='terrains' && terrainsId[y] != null) { id=terrainsId[y]; } else { @@ -999,8 +999,10 @@ editor_file = function (editor, callback) { if (file == 'floorloc') { actionList.forEach(function (value) { // 检测null/undefined - if (!core.isset(value[2]))value[2]=undefined; - eval("editor.currentFloorData" + value[1] + '=' + JSON.stringify(value[2])); + if (value[2]==null) + eval("delete editor.currentFloorData" + value[1]); + else + eval("editor.currentFloorData" + value[1] + '=' + JSON.stringify(value[2])); }); editor_file.saveFloorFile(callback); return; diff --git a/_server/editor_mode.js b/_server/editor_mode.js index d23f4abe..cbb63f17 100644 --- a/_server/editor_mode.js +++ b/_server/editor_mode.js @@ -608,8 +608,8 @@ editor_mode = function (editor) { } var width = parseInt(document.getElementById('newMapWidth').value); var height = parseInt(document.getElementById('newMapHeight').value); - if (!core.isset(width) || !core.isset(height) || width<13 || height<13 || width*height>1000) { - printe("新建地图的宽高都不得小于13,且宽高之积不能超过1000"); + if (!core.isset(width) || !core.isset(height) || width1000) { + printe("新建地图的宽高都不得小于"+core.__SIZE__+",且宽高之积不能超过1000"); return; } @@ -673,8 +673,8 @@ editor_mode = function (editor) { var width = parseInt(document.getElementById('newMapsWidth').value); var height = parseInt(document.getElementById('newMapsHeight').value); - if (!core.isset(width) || !core.isset(height) || width<13 || height<13 || width*height>1000) { - printe("新建地图的宽高都不得小于13,且宽高之积不能超过1000"); + if (!core.isset(width) || !core.isset(height) || width1000) { + printe("新建地图的宽高都不得小于"+core.__SIZE__+",且宽高之积不能超过1000"); return; } editor_mode.onmode('');