Fix mapIntoBlocks bug

This commit is contained in:
oc 2018-08-27 01:59:56 +08:00
parent 5e5c653b81
commit 373e6a281e
2 changed files with 7 additions and 7 deletions

View File

@ -18,9 +18,9 @@ editor.prototype.init = function (callback) {
return editor.ids[[editor.indexs[parseInt(v)][0]]] return editor.ids[[editor.indexs[parseInt(v)][0]]]
}) })
}); });
editor.updateMap();
editor.currentFloorId = core.status.floorId; editor.currentFloorId = core.status.floorId;
editor.currentFloorData = core.floors[core.status.floorId]; editor.currentFloorData = core.floors[core.status.floorId];
editor.updateMap();
editor.buildMark(); editor.buildMark();
editor.drawEventBlock(); editor.drawEventBlock();
if (Boolean(callback)) callback(); if (Boolean(callback)) callback();
@ -229,7 +229,7 @@ editor.prototype.updateMap = function () {
return v.map(function (v) { return v.map(function (v) {
return v.idnum || v || 0 return v.idnum || v || 0
}) })
}), {'events': {}, 'changeFloor': {}}); }), {'events': {}, 'changeFloor': {}}, editor.currentFloorId);
core.status.thisMap.blocks = blocks; core.status.thisMap.blocks = blocks;
main.editor.updateMap(); main.editor.updateMap();
@ -340,9 +340,9 @@ editor.prototype.changeFloor = function (floorId, callback) {
return editor.ids[[editor.indexs[parseInt(v)][0]]] return editor.ids[[editor.indexs[parseInt(v)][0]]]
}) })
}); });
editor.updateMap();
editor.currentFloorId = core.status.floorId; editor.currentFloorId = core.status.floorId;
editor.currentFloorData = core.floors[core.status.floorId]; editor.currentFloorData = core.floors[core.status.floorId];
editor.updateMap();
editor_mode.floor(); editor_mode.floor();
editor.drawEventBlock(); editor.drawEventBlock();
if (core.isset(callback)) callback(); if (core.isset(callback)) callback();

View File

@ -16,7 +16,7 @@ maps.prototype.loadFloor = function (floorId, map) {
content['title'] = floor.title; content['title'] = floor.title;
content['canFlyTo'] = floor.canFlyTo; content['canFlyTo'] = floor.canFlyTo;
if (!core.isset(map)) map=floor.map; if (!core.isset(map)) map=floor.map;
var mapIntoBlocks = function(map,maps,floor){ var mapIntoBlocks = function(map,maps,floor,floorId){
var blocks = []; var blocks = [];
var mw = core.floors[floorId].width || 13; var mw = core.floors[floorId].width || 13;
var mh = core.floors[floorId].height || 13; var mh = core.floors[floorId].height || 13;
@ -32,12 +32,12 @@ maps.prototype.loadFloor = function (floorId, map) {
return blocks; return blocks;
} }
if (main.mode=='editor'){ if (main.mode=='editor'){
main.editor.mapIntoBlocks = function(map,floor){ main.editor.mapIntoBlocks = function(map,floor,floorId){
return mapIntoBlocks(map,core.maps,floor); return mapIntoBlocks(map,core.maps,floor,floorId);
} }
} }
// 事件处理 // 事件处理
content['blocks'] = mapIntoBlocks(map,this,floor); content['blocks'] = mapIntoBlocks(map,this,floor,floorId);
return content; return content;
} }