Create bigmap
This commit is contained in:
parent
0dab4301bd
commit
fb540a6976
@ -511,6 +511,24 @@ editor.prototype.listen = function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
document.getElementById('mid').onkeydown = function (e) {
|
||||||
|
console.log(e);
|
||||||
|
if (e.keyCode==37) {
|
||||||
|
editor.moveViewport(-1, 0);
|
||||||
|
}
|
||||||
|
if (e.keyCode==38) {
|
||||||
|
editor.moveViewport(0, -1);
|
||||||
|
}
|
||||||
|
if (e.keyCode==39) {
|
||||||
|
editor.moveViewport(1, 0);
|
||||||
|
}
|
||||||
|
if (e.keyCode==40) {
|
||||||
|
editor.moveViewport(0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
document.getElementById('mid').onmousewheel = function (e) {
|
document.getElementById('mid').onmousewheel = function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var wheel = function (direct) {
|
var wheel = function (direct) {
|
||||||
@ -591,18 +609,6 @@ editor.prototype.listen = function () {
|
|||||||
editor.changeFloor(toId);
|
editor.changeFloor(toId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e.keyCode==37) {
|
|
||||||
editor.moveViewport(-1, 0);
|
|
||||||
}
|
|
||||||
if (e.keyCode==38) {
|
|
||||||
editor.moveViewport(0, -1);
|
|
||||||
}
|
|
||||||
if (e.keyCode==39) {
|
|
||||||
editor.moveViewport(1, 0);
|
|
||||||
}
|
|
||||||
if (e.keyCode==40) {
|
|
||||||
editor.moveViewport(0, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var dataSelection = document.getElementById('dataSelection');
|
var dataSelection = document.getElementById('dataSelection');
|
||||||
|
|||||||
@ -83,12 +83,21 @@ 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')
|
if (editor.currentFloorData.map == 'new') {
|
||||||
|
/*
|
||||||
editor.currentFloorData.map = editor.map.map(function (v) {
|
editor.currentFloorData.map = editor.map.map(function (v) {
|
||||||
return v.map(function () {
|
return v.map(function () {
|
||||||
return 0
|
return 0
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
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
|
else
|
||||||
editor.currentFloorData.map = editor.map.map(function (v) {
|
editor.currentFloorData.map = editor.map.map(function (v) {
|
||||||
return v.map(function (v) {
|
return v.map(function (v) {
|
||||||
@ -115,14 +124,15 @@ editor_file = function (editor, callback) {
|
|||||||
if (!isset(callback)) {
|
if (!isset(callback)) {
|
||||||
printe('未设置callback');
|
printe('未设置callback');
|
||||||
throw('未设置callback')
|
throw('未设置callback')
|
||||||
}
|
};
|
||||||
;
|
|
||||||
var currData=editor.currentFloorData;
|
var currData=editor.currentFloorData;
|
||||||
var saveStatus = document.getElementById('newMapStatus').checked;
|
var saveStatus = document.getElementById('newMapStatus').checked;
|
||||||
editor.currentFloorData = {
|
editor.currentFloorData = {
|
||||||
floorId: saveFilename,
|
floorId: saveFilename,
|
||||||
title: saveStatus?currData.title:"新建楼层",
|
title: saveStatus?currData.title:"新建楼层",
|
||||||
name: saveStatus?currData.name:"0",
|
name: saveStatus?currData.name:"0",
|
||||||
|
width: parseInt(document.getElementById('newMapWidth').value),
|
||||||
|
height: parseInt(document.getElementById('newMapHeight').value),
|
||||||
canFlyTo: saveStatus?currData.canFlyTo:true,
|
canFlyTo: saveStatus?currData.canFlyTo:true,
|
||||||
canUseQuickShop: saveStatus?currData.canUseQuickShop:true,
|
canUseQuickShop: saveStatus?currData.canUseQuickShop:true,
|
||||||
cannotViewMap: saveStatus?currData.cannotViewMap:false,
|
cannotViewMap: saveStatus?currData.cannotViewMap:false,
|
||||||
|
|||||||
@ -469,6 +469,12 @@ editor_mode = function (editor) {
|
|||||||
printe("楼层名不合法!请使用字母、数字、下划线,且不能以数字开头!");
|
printe("楼层名不合法!请使用字母、数字、下划线,且不能以数字开头!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var width = parseInt(document.getElementById('newMapWidth').value);
|
||||||
|
var height = parseInt(document.getElementById('newMapHeight').value);
|
||||||
|
if (!core.isset(width) || !core.isset(height) || width<13 || height<13 || width*height>1000) {
|
||||||
|
printe("新建地图的宽高都不得小于13,且宽高之积不能超过1000");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
editor_mode.onmode('');
|
editor_mode.onmode('');
|
||||||
editor.file.saveNewFile(newFileName.value, function (err) {
|
editor.file.saveNewFile(newFileName.value, function (err) {
|
||||||
|
|||||||
@ -23,7 +23,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="editTip">
|
<div id="editTip">
|
||||||
<input type="button" value="新建空白地图" id='newMap'/>
|
<input type="button" value="新建空白地图" id='newMap'/>
|
||||||
<input id='newFileName' placeholder="输入新楼层id" style="width: 120px"/>
|
<input id='newFileName' placeholder="新楼层id" style="width: 70px"/>
|
||||||
|
<span style="vertical-align: bottom">宽</span>
|
||||||
|
<input id='newMapWidth' value="13" style="width: 20px"/>
|
||||||
|
<span style="vertical-align: bottom">高</span>
|
||||||
|
<input id='newMapHeight' value="13" style="width: 20px"/>
|
||||||
<input type="checkbox" id='newMapStatus' checked='checked' style='vertical-align: bottom'/>
|
<input type="checkbox" id='newMapStatus' checked='checked' style='vertical-align: bottom'/>
|
||||||
<span style='vertical-align: bottom; margin-left: -4px'>保留楼层属性</span>
|
<span style='vertical-align: bottom; margin-left: -4px'>保留楼层属性</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user