changeFloorId
This commit is contained in:
parent
432b5354df
commit
330e031bc7
@ -185,6 +185,41 @@ editor_unsorted_2_wrapper=function(editor_mode){
|
||||
});
|
||||
}
|
||||
|
||||
var changeFloorId = document.getElementById('changeFloorId');
|
||||
changeFloorId.children[1].onclick = function () {
|
||||
var floorId = changeFloorId.children[0].value;
|
||||
if (floorId) {
|
||||
if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(floorId)) {
|
||||
printe("楼层名 "+floorId+" 不合法!请使用字母、数字、下划线,且不能以数字开头!");
|
||||
return;
|
||||
}
|
||||
if (main.floorIds.indexOf(floorId)>=0) {
|
||||
printe("楼层名 "+floorId+" 已存在!");
|
||||
return;
|
||||
}
|
||||
var currentFloorId = editor.currentFloorId;
|
||||
editor.currentFloorId = floorId;
|
||||
editor.currentFloorData.floorId = floorId;
|
||||
editor.file.saveFloorFile(floorId, function (err) {
|
||||
if (err) {
|
||||
printe(err);
|
||||
throw(err);
|
||||
}
|
||||
core.floorIds[core.floorIds.indexOf(currentFloorId)] = floorId;
|
||||
editor.file.editTower([['change', "['main']['floorIds']", core.floorIds]], function (objs_) {//console.log(objs_);
|
||||
if (objs_.slice(-1)[0] != null) {
|
||||
printe(objs_.slice(-1)[0]);
|
||||
throw(objs_.slice(-1)[0])
|
||||
}
|
||||
alert("修改floorId成功,需要刷新编辑器生效。\n请注意,原始的楼层文件没有删除,请根据需要手动删除。");
|
||||
window.location.reload();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
printe('请输入要修改到的floorId');
|
||||
}
|
||||
}
|
||||
|
||||
var ratio = 1;
|
||||
var appendPicCanvas = document.getElementById('appendPicCanvas');
|
||||
var bg = appendPicCanvas.children[0];
|
||||
|
||||
@ -162,6 +162,10 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id='changeFloorId'><!-- id and idnum -->
|
||||
<input placeholder="修改floorId为"/>
|
||||
<button>save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="left5" class='leftTab' style="z-index:-1;opacity: 0;"><!-- tower -->
|
||||
|
||||
@ -158,6 +158,10 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id='changeFloorId'><!-- id and idnum -->
|
||||
<input placeholder="修改floorId为"/>
|
||||
<button>save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="left5" class='leftTab' style="z-index:-1;opacity: 0;"><!-- tower -->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user