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