editor_file
This commit is contained in:
parent
59b1bee743
commit
b49fbc6c22
@ -14,31 +14,16 @@ editor_file = function (editor, callback) {
|
|||||||
} */
|
} */
|
||||||
var filename = 'project/floors/' + editor.currentFloorId + '.js';
|
var filename = 'project/floors/' + editor.currentFloorId + '.js';
|
||||||
var datastr = ['main.floors.', editor.currentFloorId, '=\n'];
|
var datastr = ['main.floors.', editor.currentFloorId, '=\n'];
|
||||||
if (editor.currentFloorData.map == 'new') {
|
|
||||||
/*
|
for(var ii=0,name;name=['map','bgmap','fgmap'][ii];ii++){
|
||||||
editor.currentFloorData.map = editor.map.map(function (v) {
|
var mapArray=editor[name].map(function (v) {
|
||||||
return v.map(function () {
|
return v.map(function (v) {
|
||||||
return 0
|
return v.idnum || v || 0
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
*/
|
editor.currentFloorData[name]=mapArray;
|
||||||
var width = parseInt(document.getElementById('newMapWidth').value);
|
|
||||||
var height = parseInt(document.getElementById('newMapHeight').value);
|
|
||||||
var row = [];
|
|
||||||
for (var i=0;i<width;i++) row.push(0);
|
|
||||||
editor.currentFloorData.map = [];
|
|
||||||
for (var i=0;i<height;i++) editor.currentFloorData.map.push(row);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
for(var ii=0,name;name=['map','bgmap','fgmap'][ii];ii++){
|
|
||||||
var mapArray=editor[name].map(function (v) {
|
|
||||||
return v.map(function (v) {
|
|
||||||
return v.idnum || v || 0
|
|
||||||
})
|
|
||||||
});
|
|
||||||
editor.currentFloorData[name]=mapArray;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// format 更改实现方式以支持undefined删除
|
// format 更改实现方式以支持undefined删除
|
||||||
var tempJsonObj=Object.assign({},editor.currentFloorData);
|
var tempJsonObj=Object.assign({},editor.currentFloorData);
|
||||||
var tempMap=[['map',editor.util.guid()],['bgmap',editor.util.guid()],['fgmap',editor.util.guid()]];
|
var tempMap=[['map',editor.util.guid()],['bgmap',editor.util.guid()],['fgmap',editor.util.guid()]];
|
||||||
@ -70,13 +55,19 @@ editor_file = function (editor, callback) {
|
|||||||
name = saveFilename.substring(2);
|
name = saveFilename.substring(2);
|
||||||
title = "主塔 "+name+" 层";
|
title = "主塔 "+name+" 层";
|
||||||
}
|
}
|
||||||
// editor.file.comment._data.floors_template
|
|
||||||
|
var width = parseInt(document.getElementById('newMapsWidth').value);
|
||||||
|
var height = parseInt(document.getElementById('newMapsHeight').value);
|
||||||
|
var row = [], map = [];
|
||||||
|
for (var i=0;i<width;i++) row.push(0);
|
||||||
|
for (var i=0;i<height;i++) map.push(row);
|
||||||
editor.currentFloorData = Object.assign(JSON.parse(JSON.stringify(editor.file.comment._data.floors_template)), {
|
editor.currentFloorData = Object.assign(JSON.parse(JSON.stringify(editor.file.comment._data.floors_template)), {
|
||||||
floorId: saveFilename,
|
floorId: saveFilename,
|
||||||
title: title,
|
title: title,
|
||||||
name: name,
|
name: name,
|
||||||
width: parseInt(document.getElementById('newMapWidth').value),
|
width: width,
|
||||||
height: parseInt(document.getElementById('newMapHeight').value),
|
height: height,
|
||||||
|
map: map,
|
||||||
},saveStatus?{
|
},saveStatus?{
|
||||||
canFlyTo: currData.canFlyTo,
|
canFlyTo: currData.canFlyTo,
|
||||||
canUseQuickShop: currData.canUseQuickShop,
|
canUseQuickShop: currData.canUseQuickShop,
|
||||||
@ -93,7 +84,6 @@ editor_file = function (editor, callback) {
|
|||||||
if (editor.currentFloorData[t] == null)
|
if (editor.currentFloorData[t] == null)
|
||||||
delete editor.currentFloorData[t];
|
delete editor.currentFloorData[t];
|
||||||
})
|
})
|
||||||
editor.currentFloorData.map = "new";
|
|
||||||
editor.currentFloorId = saveFilename;
|
editor.currentFloorId = saveFilename;
|
||||||
editor.file.saveFloorFile(callback);
|
editor.file.saveFloorFile(callback);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user