draw event block

This commit is contained in:
oc 2018-05-06 23:02:24 +08:00
parent b04b45070f
commit 579c57dc03
2 changed files with 33 additions and 5 deletions

View File

@ -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();
});
}

View File

@ -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':