Update drawMapGUI

把错误图块标红,改成了点导出,如果失败了,把所有未识别id的块标红5秒
This commit is contained in:
YouWei Zhao 2017-12-26 09:15:19 +08:00
parent 0a15e303c1
commit 24689ce46e

View File

@ -623,7 +623,7 @@ editor.prototype.afterImportGrass = function (callback) {
return x + y * (fullX + 1); return x + y * (fullX + 1);
} }
editor.updateMap = function (clearError) { editor.updateMap = function (error) {
//clearGrass(); //clearGrass();
// console.log(editor.map) // console.log(editor.map)
for (var xx = 0; xx <= fullX; xx++) { for (var xx = 0; xx <= fullX; xx++) {
@ -675,14 +675,16 @@ editor.prototype.afterImportGrass = function (callback) {
cxt.drawImage(core.material.images[mapxy.images], 0, mapxy.y*32, 32, 32, xx*32, yy*32, 32, 32); cxt.drawImage(core.material.images[mapxy.images], 0, mapxy.y*32, 32, 32, xx*32, yy*32, 32, 32);
if(typeof(mapxy) != typeof({}) || !('idnum' in mapxy) ) {//未定义块画红块 if(typeof(mapxy) != typeof({}) || !('idnum' in mapxy) ) {//未定义块画红块
if (clearError=='clearError'){ if (error=='clearError'){
editor.map[editor.m(xx,yy)]=0; editor.map[editor.m(xx,yy)]=0;
cxt.clearRect(xx*32, yy*32, 32, 32); cxt.clearRect(xx*32, yy*32, 32, 32);
continue; continue;
} }
cxt.fillStyle = 'rgba(255,0,0,0.8)'; if (error=='showError'){
var tmpNum =6; cxt.fillStyle = 'rgba(255,0,0,0.8)';
cxt.fillRect(xx*32+tmpNum, yy*32+tmpNum, 32-tmpNum*2, 32-tmpNum*2); var tmpNum =6;
cxt.fillRect(xx*32+tmpNum, yy*32+tmpNum, 32-tmpNum*2, 32-tmpNum*2);
}
} }
} }
} }
@ -914,6 +916,7 @@ editor.prototype.listen = function() {
/* /*
editor.updateMap editor.updateMap
现在可以通过editor.updateMap('clearError')把所有错误id置零并绘图 现在可以通过editor.updateMap('clearError')把所有错误id置零并绘图
以及editor.updateMap('showError')显示所有错误
editor.loc editor.loc
editor.pos editor.pos
@ -939,8 +942,10 @@ editor.init();
methods: { methods: {
exportMap: function(){ exportMap: function(){
setTimeout(function(){editor.updateMap();},5000);
if(editArea.error) { if(editArea.error) {
tip.whichShow = 3; tip.whichShow = 3;
editor.updateMap('showError');
return; return;
} }
var filestr=''; var filestr='';
@ -953,10 +958,12 @@ editor.init();
else { else {
// mapxy='!!?'; // mapxy='!!?';
tip.whichShow = 3; tip.whichShow = 3;
editor.updateMap('showError');
return; return;
} }
}else if(typeof(mapxy)=='undefined'){ }else if(typeof(mapxy)=='undefined'){
tip.whichShow = 3; tip.whichShow = 3;
editor.updateMap('showError');
return; return;
} }
mapxy=String(mapxy); mapxy=String(mapxy);