Editor last floorId
This commit is contained in:
parent
1216ae7d96
commit
9d8146ab29
@ -158,7 +158,8 @@ editor.prototype.init = function (callback) {
|
||||
editor_mode = editor_mode(editor);
|
||||
editor.mode = editor_mode;
|
||||
core.resetGame(core.firstData.hero, null, core.firstData.floorId, core.clone(core.initStatus.maps));
|
||||
core.changeFloor(core.status.floorId, null, core.firstData.hero.loc, null, function () {
|
||||
var lastFloorId = core.getLocalStorage('editorLastFloorId', core.status.floorId);
|
||||
core.changeFloor(lastFloorId, null, core.firstData.hero.loc, null, function () {
|
||||
afterCoreReset();
|
||||
}, true);
|
||||
core.events.setInitData(null);
|
||||
@ -256,6 +257,7 @@ editor.prototype.changeFloor = function (floorId, callback) {
|
||||
var loc = editor.viewportLoc[floorId] || [], x = loc[0] || 0, y = loc[1] || 0;
|
||||
editor.setViewport(x, y);
|
||||
|
||||
core.setLocalStorage('editorLastFloorId', floorId);
|
||||
if (callback) callback();
|
||||
});
|
||||
}
|
||||
|
||||
@ -131,23 +131,31 @@ editor_ui_wrapper = function (editor) {
|
||||
|| focusElement.id == 'selectFloor') {
|
||||
|
||||
//Ctrl+z 撤销上一步undo
|
||||
if (e.keyCode == 90 && e.ctrlKey && editor.uivalues.preMapData.length > 0) {
|
||||
if (e.keyCode == 90 && e.ctrlKey) {
|
||||
e.preventDefault();
|
||||
if (editor.uivalues.preMapData.length > 0) {
|
||||
var data = editor.uivalues.preMapData.pop();
|
||||
editor.map = JSON.parse(JSON.stringify(data.map));
|
||||
editor.fgmap = JSON.parse(JSON.stringify(data.fgmap));
|
||||
editor.bgmap = JSON.parse(JSON.stringify(data.bgmap));
|
||||
editor.updateMap();
|
||||
editor.uivalues.postMapData.push(data);
|
||||
printf("已撤销此操作,你可能需要重新保存地图。");
|
||||
}
|
||||
return;
|
||||
}
|
||||
//Ctrl+y 重做一步redo
|
||||
if (e.keyCode == 89 && e.ctrlKey && editor.uivalues.postMapData.length > 0) {
|
||||
if (e.keyCode == 89 && e.ctrlKey) {
|
||||
e.preventDefault();
|
||||
if (editor.uivalues.postMapData.length > 0) {
|
||||
var data = editor.uivalues.postMapData.pop();
|
||||
editor.map = JSON.parse(JSON.stringify(data.map));
|
||||
editor.fgmap = JSON.parse(JSON.stringify(data.fgmap));
|
||||
editor.bgmap = JSON.parse(JSON.stringify(data.bgmap));
|
||||
editor.updateMap();
|
||||
editor.uivalues.preMapData.push(data);
|
||||
printf("已重做此操作,你可能需要重新保存地图。");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user