move, copy, cut and paste blocks
This commit is contained in:
parent
14071c287f
commit
396b984ca5
@ -262,10 +262,6 @@ body {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
.egameCanvas {
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
.gameCanvas {
|
.gameCanvas {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -247,10 +247,6 @@ body {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
.egameCanvas {
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
.gameCanvas {
|
.gameCanvas {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -491,4 +491,69 @@ editor.prototype.mobile_listen=function(){
|
|||||||
// 移动至 editor_unsorted_1.js
|
// 移动至 editor_unsorted_1.js
|
||||||
}
|
}
|
||||||
|
|
||||||
|
editor.prototype.copyFromPos = function (pos) {
|
||||||
|
var fields = Object.keys(editor.file.comment._data.floors._data.loc._data);
|
||||||
|
pos = pos || editor.pos;
|
||||||
|
var map = core.clone(editor.map[pos.y][pos.x]);
|
||||||
|
var events = {};
|
||||||
|
fields.forEach(function(v){
|
||||||
|
events[v] = core.clone(editor.currentFloorData[v][pos.x+','+pos.y]);
|
||||||
|
})
|
||||||
|
return {map: map, events: events};
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.prototype.pasteToPos = function (info, pos) {
|
||||||
|
if (info == null) return;
|
||||||
|
var fields = Object.keys(editor.file.comment._data.floors._data.loc._data);
|
||||||
|
pos = pos || editor.pos;
|
||||||
|
editor.map[pos.y][pos.x] = core.clone(info.map);
|
||||||
|
fields.forEach(function(v){
|
||||||
|
if (info.events[v] == null) delete editor.currentFloorData[v][pos.x+","+pos.y];
|
||||||
|
else editor.currentFloorData[v][pos.x+","+pos.y] = core.clone(info.events[v]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.prototype.movePos = function (startPos, endPos, callback) {
|
||||||
|
if (!startPos || !endPos) return;
|
||||||
|
if (startPos.x == endPos.x && startPos.y == endPos.y) return;
|
||||||
|
var copyed = editor.copyFromPos(startPos);
|
||||||
|
editor.pasteToPos({map:0, events: {}}, startPos);
|
||||||
|
editor.pasteToPos(copyed, endPos);
|
||||||
|
editor.updateMap();
|
||||||
|
editor.file.saveFloorFile(function (err) {
|
||||||
|
if (err) {
|
||||||
|
printe(err);
|
||||||
|
throw(err)
|
||||||
|
}
|
||||||
|
;printf('移动事件成功');
|
||||||
|
editor.drawPosSelection();
|
||||||
|
if (callback) callback();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.prototype.clearPos = function (clearPos, pos, callback) {
|
||||||
|
var fields = Object.keys(editor.file.comment._data.floors._data.loc._data);
|
||||||
|
pos = pos || editor.pos;
|
||||||
|
editor.hideMidMenu();
|
||||||
|
editor.preMapData = null;
|
||||||
|
editor.info = 0;
|
||||||
|
editor_mode.onmode('');
|
||||||
|
if (clearPos)
|
||||||
|
editor.map[pos.y][pos.x]=editor.info;
|
||||||
|
editor.updateMap();
|
||||||
|
fields.forEach(function(v){
|
||||||
|
delete editor.currentFloorData[v][pos.x+','+pos.y];
|
||||||
|
})
|
||||||
|
editor.file.saveFloorFile(function (err) {
|
||||||
|
if (err) {
|
||||||
|
printe(err);
|
||||||
|
throw(err)
|
||||||
|
}
|
||||||
|
;printf(clearPos?'清空该点和事件成功':'只清空该点事件成功');
|
||||||
|
editor.drawPosSelection();
|
||||||
|
if (callback) callback();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
editor = new editor();
|
editor = new editor();
|
||||||
@ -114,8 +114,7 @@ editor_mode = function (editor) {
|
|||||||
editor.drawEventBlock();
|
editor.drawEventBlock();
|
||||||
if (editor_mode[mode]) editor_mode[mode]();
|
if (editor_mode[mode]) editor_mode[mode]();
|
||||||
document.getElementById('editModeSelect').value = mode;
|
document.getElementById('editModeSelect').value = mode;
|
||||||
var tips = tip_in_showMode;
|
if (!selectBox.isSelected()) tip.showHelp();
|
||||||
if (!selectBox.isSelected()) printf('tips: ' + tips[~~(tips.length * Math.random())]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
editor_mode.prototype.loc = function (callback) {
|
editor_mode.prototype.loc = function (callback) {
|
||||||
|
|||||||
@ -104,6 +104,7 @@ editor.constructor.prototype.listen=function () {
|
|||||||
holdingPath = 0;
|
holdingPath = 0;
|
||||||
stepPostfix = [];
|
stepPostfix = [];
|
||||||
uc.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__);
|
uc.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__);
|
||||||
|
startPos = endPos = null;
|
||||||
}//用于鼠标移出canvas时的自动清除状态
|
}//用于鼠标移出canvas时的自动清除状态
|
||||||
|
|
||||||
eui.oncontextmenu=function(e){e.preventDefault()}
|
eui.oncontextmenu=function(e){e.preventDefault()}
|
||||||
@ -116,6 +117,7 @@ editor.constructor.prototype.listen=function () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var startPos=null, endPos=null;
|
||||||
eui.onmousedown = function (e) {
|
eui.onmousedown = function (e) {
|
||||||
if (e.button==2){
|
if (e.button==2){
|
||||||
var loc = eToLoc(e);
|
var loc = eToLoc(e);
|
||||||
@ -130,6 +132,10 @@ editor.constructor.prototype.listen=function () {
|
|||||||
editor_mode.onmode('loc');
|
editor_mode.onmode('loc');
|
||||||
//editor_mode.loc();
|
//editor_mode.loc();
|
||||||
//tip.whichShow(1);
|
//tip.whichShow(1);
|
||||||
|
tip.showHelp(6);
|
||||||
|
startPos = pos;
|
||||||
|
uc.strokeStyle = '#FF0000';
|
||||||
|
uc.lineWidth = 3;
|
||||||
if(editor.isMobile)editor.showMidMenu(e.clientX,e.clientY);
|
if(editor.isMobile)editor.showMidMenu(e.clientX,e.clientY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -149,7 +155,29 @@ editor.constructor.prototype.listen=function () {
|
|||||||
|
|
||||||
eui.onmousemove = function (e) {
|
eui.onmousemove = function (e) {
|
||||||
if (!selectBox.isSelected()) {
|
if (!selectBox.isSelected()) {
|
||||||
|
if (startPos == null) return;
|
||||||
//tip.whichShow(1);
|
//tip.whichShow(1);
|
||||||
|
var loc = eToLoc(e);
|
||||||
|
var pos = locToPos(loc,true);
|
||||||
|
if (endPos != null && endPos.x == pos.x && endPos.y == pos.y) return;
|
||||||
|
if (endPos != null) {
|
||||||
|
uc.clearRect(Math.min(32 * startPos.x - core.bigmap.offsetX, 32 * endPos.x - core.bigmap.offsetX),
|
||||||
|
Math.min(32 * startPos.y - core.bigmap.offsetY, 32 * endPos.y - core.bigmap.offsetY),
|
||||||
|
(Math.abs(startPos.x - endPos.x) + 1) * 32, (Math.abs(startPos.y - endPos.y) + 1) * 32)
|
||||||
|
}
|
||||||
|
endPos = pos;
|
||||||
|
if (startPos != null) {
|
||||||
|
if (startPos.x != endPos.x || startPos.y != endPos.y) {
|
||||||
|
core.drawArrow('eui',
|
||||||
|
32 * startPos.x + 16 - core.bigmap.offsetX, 32 * startPos.y + 16 - core.bigmap.offsetY,
|
||||||
|
32 * endPos.x + 16 - core.bigmap.offsetX, 32 * endPos.y + 16 - core.bigmap.offsetY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// editor_mode.onmode('nextChange');
|
||||||
|
// editor_mode.onmode('loc');
|
||||||
|
//editor_mode.loc();
|
||||||
|
//tip.whichShow(1);
|
||||||
|
// tip.showHelp(6);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,6 +209,9 @@ editor.constructor.prototype.listen=function () {
|
|||||||
eui.onmouseup = function (e) {
|
eui.onmouseup = function (e) {
|
||||||
if (!selectBox.isSelected()) {
|
if (!selectBox.isSelected()) {
|
||||||
//tip.whichShow(1);
|
//tip.whichShow(1);
|
||||||
|
editor.movePos(startPos, endPos);
|
||||||
|
startPos = endPos = null;
|
||||||
|
uc.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
holdingPath = 0;
|
holdingPath = 0;
|
||||||
@ -283,6 +314,7 @@ editor.constructor.prototype.listen=function () {
|
|||||||
};
|
};
|
||||||
var reDo = null;
|
var reDo = null;
|
||||||
var shortcut = core.getLocalStorage('shortcut',{48: 0, 49: 0, 50: 0, 51: 0, 52: 0, 53: 0, 54: 0, 55: 0, 56: 0, 57: 0});
|
var shortcut = core.getLocalStorage('shortcut',{48: 0, 49: 0, 50: 0, 51: 0, 52: 0, 53: 0, 54: 0, 55: 0, 56: 0, 57: 0});
|
||||||
|
var copyedInfo = null;
|
||||||
document.body.onkeydown = function (e) {
|
document.body.onkeydown = function (e) {
|
||||||
|
|
||||||
// UI预览 & 地图选点
|
// UI预览 & 地图选点
|
||||||
@ -317,7 +349,7 @@ editor.constructor.prototype.listen=function () {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// 禁止快捷键的默认行为
|
// 禁止快捷键的默认行为
|
||||||
if (e.ctrlKey && [89, 90, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57].indexOf(e.keyCode) !== -1)
|
if (e.ctrlKey && [88, 67, 86, 89, 90, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57].indexOf(e.keyCode) !== -1)
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (e.altKey && [48, 49, 50, 51, 52, 53, 54, 55, 56, 57].indexOf(e.keyCode) !== -1)
|
if (e.altKey && [48, 49, 50, 51, 52, 53, 54, 55, 56, 57].indexOf(e.keyCode) !== -1)
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -343,31 +375,23 @@ editor.constructor.prototype.listen=function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PGUP和PGDOWN切换楼层
|
// PGUP和PGDOWN切换楼层
|
||||||
if (e.keyCode==33) {
|
if (e.keyCode==33 || e.keyCode==34) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var index=editor.core.floorIds.indexOf(editor.currentFloorId);
|
var index=editor.core.floorIds.indexOf(editor.currentFloorId);
|
||||||
if (index<editor.core.floorIds.length-1) {
|
var nextIndex = index + (e.keyCode==33?1:-1);
|
||||||
var toId = editor.core.floorIds[index+1];
|
if (nextIndex>=0 && nextIndex<editor.core.floorIds.length) {
|
||||||
editor_mode.onmode('nextChange');
|
var toId = editor.core.floorIds[nextIndex];
|
||||||
editor_mode.onmode('floor');
|
|
||||||
document.getElementById('selectFloor').value = toId;
|
|
||||||
editor.changeFloor(toId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (e.keyCode==34) {
|
|
||||||
e.preventDefault();
|
|
||||||
var index=editor.core.floorIds.indexOf(editor.currentFloorId);
|
|
||||||
if (index>0) {
|
|
||||||
var toId = editor.core.floorIds[index-1];
|
|
||||||
editor_mode.onmode('nextChange');
|
editor_mode.onmode('nextChange');
|
||||||
editor_mode.onmode('floor');
|
editor_mode.onmode('floor');
|
||||||
document.getElementById('selectFloor').value = toId;
|
document.getElementById('selectFloor').value = toId;
|
||||||
editor.changeFloor(toId);
|
editor.changeFloor(toId);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
//ctrl + 0~9 切换到快捷图块
|
//ctrl + 0~9 切换到快捷图块
|
||||||
if (e.ctrlKey && [48, 49, 50, 51, 52, 53, 54, 55, 56, 57].indexOf(e.keyCode) !== -1){
|
if (e.ctrlKey && [48, 49, 50, 51, 52, 53, 54, 55, 56, 57].indexOf(e.keyCode) !== -1){
|
||||||
editor.setSelectBoxFromInfo(JSON.parse(JSON.stringify(shortcut[e.keyCode]||0)));
|
editor.setSelectBoxFromInfo(JSON.parse(JSON.stringify(shortcut[e.keyCode]||0)));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
//alt + 0~9 改变快捷图块
|
//alt + 0~9 改变快捷图块
|
||||||
if (e.altKey && [48, 49, 50, 51, 52, 53, 54, 55, 56, 57].indexOf(e.keyCode) !== -1){
|
if (e.altKey && [48, 49, 50, 51, 52, 53, 54, 55, 56, 57].indexOf(e.keyCode) !== -1){
|
||||||
@ -376,6 +400,52 @@ editor.constructor.prototype.listen=function () {
|
|||||||
shortcut[e.keyCode]=JSON.parse(infoToSave);
|
shortcut[e.keyCode]=JSON.parse(infoToSave);
|
||||||
printf('已保存该快捷图块, ctrl + '+(e.keyCode-48)+' 使用.')
|
printf('已保存该快捷图块, ctrl + '+(e.keyCode-48)+' 使用.')
|
||||||
core.setLocalStorage('shortcut',shortcut);
|
core.setLocalStorage('shortcut',shortcut);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Ctrl+C, Ctrl+X, Ctrl+V
|
||||||
|
if (e.ctrlKey && e.keyCode == 67) {
|
||||||
|
copyedInfo = editor.copyFromPos();
|
||||||
|
printf('该点事件已复制');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (e.ctrlKey && e.keyCode == 88) {
|
||||||
|
copyedInfo = editor.copyFromPos();
|
||||||
|
editor.clearPos(true, null, function () {
|
||||||
|
printf('该点事件已剪切');
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (e.keyCode == 86) {
|
||||||
|
if (!copyedInfo) {
|
||||||
|
printe("没有复制的事件");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
editor.pasteToPos(copyedInfo);
|
||||||
|
editor.updateMap();
|
||||||
|
editor.file.saveFloorFile(function (err) {
|
||||||
|
if (err) {
|
||||||
|
printe(err);
|
||||||
|
throw(err)
|
||||||
|
}
|
||||||
|
;printf('粘贴事件成功');
|
||||||
|
editor.drawPosSelection();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (e.keyCode == 27) {
|
||||||
|
if (selectBox.isSelected()) {
|
||||||
|
editor_mode.onmode('');
|
||||||
|
editor.file.saveFloorFile(function (err) {
|
||||||
|
if (err) {
|
||||||
|
printe(err);
|
||||||
|
throw(err)
|
||||||
|
}
|
||||||
|
;printf('地图保存成功');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
selectBox.isSelected(false);
|
||||||
|
editor.info = {};
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
var focusElement = document.activeElement;
|
var focusElement = document.activeElement;
|
||||||
if (!focusElement || focusElement.tagName.toLowerCase()=='body') {
|
if (!focusElement || focusElement.tagName.toLowerCase()=='body') {
|
||||||
@ -398,13 +468,14 @@ editor.constructor.prototype.listen=function () {
|
|||||||
// H
|
// H
|
||||||
case 72: editor.showHelp(); break;
|
case 72: editor.showHelp(); break;
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.showHelp = function () {
|
editor.showHelp = function () {
|
||||||
alert(
|
alert(
|
||||||
"快捷操作帮助:\n" +
|
"快捷操作帮助:\n" +
|
||||||
"点击空白处:自动保存当前修改" +
|
"ESC / 点击空白处:自动保存当前修改" +
|
||||||
"WASD / 长按箭头:平移大地图\n" +
|
"WASD / 长按箭头:平移大地图\n" +
|
||||||
"PgUp, PgDn / 鼠标滚轮:上下切换楼层\n" +
|
"PgUp, PgDn / 鼠标滚轮:上下切换楼层\n" +
|
||||||
"Z~.(键盘的第三排):快捷切换标签\n" +
|
"Z~.(键盘的第三排):快捷切换标签\n" +
|
||||||
@ -547,10 +618,13 @@ editor.constructor.prototype.listen=function () {
|
|||||||
var midMenu=document.getElementById('midMenu');
|
var midMenu=document.getElementById('midMenu');
|
||||||
midMenu.oncontextmenu=function(e){e.preventDefault()}
|
midMenu.oncontextmenu=function(e){e.preventDefault()}
|
||||||
editor.lastRightButtonPos=[{x:0,y:0},{x:0,y:0}];
|
editor.lastRightButtonPos=[{x:0,y:0},{x:0,y:0}];
|
||||||
|
editor.lastCopyedInfo = [null, null];
|
||||||
editor.showMidMenu=function(x,y){
|
editor.showMidMenu=function(x,y){
|
||||||
editor.lastRightButtonPos=JSON.parse(JSON.stringify(
|
editor.lastRightButtonPos=JSON.parse(JSON.stringify(
|
||||||
[editor.pos,editor.lastRightButtonPos[0]]
|
[editor.pos,editor.lastRightButtonPos[0]]
|
||||||
));
|
));
|
||||||
|
// --- copy
|
||||||
|
editor.lastCopyedInfo = [editor.copyFromPos(), editor.lastCopyedInfo[0]];
|
||||||
var locStr='('+editor.lastRightButtonPos[1].x+','+editor.lastRightButtonPos[1].y+')';
|
var locStr='('+editor.lastRightButtonPos[1].x+','+editor.lastRightButtonPos[1].y+')';
|
||||||
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
|
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
|
||||||
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
||||||
@ -636,8 +710,6 @@ editor.constructor.prototype.listen=function () {
|
|||||||
editor.setSelectBoxFromInfo(thisevent);
|
editor.setSelectBoxFromInfo(thisevent);
|
||||||
}
|
}
|
||||||
|
|
||||||
var fields = Object.keys(editor.file.comment._data.floors._data.loc._data);
|
|
||||||
|
|
||||||
var copyLoc = document.getElementById('copyLoc');
|
var copyLoc = document.getElementById('copyLoc');
|
||||||
copyLoc.onmousedown = function(e){
|
copyLoc.onmousedown = function(e){
|
||||||
editor.hideMidMenu();
|
editor.hideMidMenu();
|
||||||
@ -645,22 +717,10 @@ editor.constructor.prototype.listen=function () {
|
|||||||
editor.preMapData = null;
|
editor.preMapData = null;
|
||||||
reDo = null;
|
reDo = null;
|
||||||
editor_mode.onmode('');
|
editor_mode.onmode('');
|
||||||
var now = editor.pos;
|
var now = editor.pos, last = editor.lastRightButtonPos[1];
|
||||||
var last = editor.lastRightButtonPos[1];
|
if (now.x == last.x && now.y == last.y) return;
|
||||||
var lastevent = editor.map[last.y][last.x];
|
editor.pasteToPos(editor.lastCopyedInfo[1]);
|
||||||
var lastinfo = 0;
|
|
||||||
if(lastevent==0){
|
|
||||||
lastinfo = 0;
|
|
||||||
} else {
|
|
||||||
var ids=editor.indexs[lastevent.idnum];
|
|
||||||
ids=ids[0]?ids[0]:ids;
|
|
||||||
lastinfo=editor.ids[ids];
|
|
||||||
}
|
|
||||||
editor.map[now.y][now.x]=lastinfo;
|
|
||||||
editor.updateMap();
|
editor.updateMap();
|
||||||
fields.forEach(function(v){
|
|
||||||
editor.currentFloorData[v][now.x+','+now.y]=editor.currentFloorData[v][last.x+','+last.y]
|
|
||||||
})
|
|
||||||
editor.file.saveFloorFile(function (err) {
|
editor.file.saveFloorFile(function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
printe(err);
|
printe(err);
|
||||||
@ -677,36 +737,12 @@ editor.constructor.prototype.listen=function () {
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
editor.preMapData = null;
|
editor.preMapData = null;
|
||||||
reDo = null;
|
reDo = null;
|
||||||
var thisevent = editor.map[editor.pos.y][editor.pos.x];
|
|
||||||
if(thisevent==0){
|
|
||||||
editor.info = 0;
|
|
||||||
} else {
|
|
||||||
var ids=editor.indexs[thisevent.idnum];
|
|
||||||
ids=ids[0]?ids[0]:ids;
|
|
||||||
editor.info=editor.ids[ids];
|
|
||||||
}
|
|
||||||
editor_mode.onmode('');
|
editor_mode.onmode('');
|
||||||
var now = editor.pos;
|
var now = editor.pos, last = editor.lastRightButtonPos[1];
|
||||||
var last = editor.lastRightButtonPos[1];
|
if (now.x == last.x && now.y == last.y) return;
|
||||||
|
editor.pasteToPos(editor.lastCopyedInfo[1], now);
|
||||||
var lastevent = editor.map[last.y][last.x];
|
editor.pasteToPos(editor.lastCopyedInfo[0], last);
|
||||||
var lastinfo = 0;
|
|
||||||
if(lastevent==0){
|
|
||||||
lastinfo = 0;
|
|
||||||
} else {
|
|
||||||
var ids=editor.indexs[lastevent.idnum];
|
|
||||||
ids=ids[0]?ids[0]:ids;
|
|
||||||
lastinfo=editor.ids[ids];
|
|
||||||
}
|
|
||||||
editor.map[last.y][last.x]=editor.info;
|
|
||||||
editor.map[now.y][now.x]=lastinfo;
|
|
||||||
editor.updateMap();
|
editor.updateMap();
|
||||||
|
|
||||||
fields.forEach(function(v){
|
|
||||||
var temp_atsfcytaf=editor.currentFloorData[v][now.x+','+now.y];
|
|
||||||
editor.currentFloorData[v][now.x+','+now.y]=editor.currentFloorData[v][last.x+','+last.y];
|
|
||||||
editor.currentFloorData[v][last.x+','+last.y]=temp_atsfcytaf;
|
|
||||||
})
|
|
||||||
editor.file.saveFloorFile(function (err) {
|
editor.file.saveFloorFile(function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
printe(err);
|
printe(err);
|
||||||
@ -717,39 +753,18 @@ editor.constructor.prototype.listen=function () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var _clearPoint = function (clearPoint) {
|
|
||||||
editor.hideMidMenu();
|
|
||||||
editor.preMapData = null;
|
|
||||||
reDo = null;
|
|
||||||
editor.info = 0;
|
|
||||||
editor_mode.onmode('');
|
|
||||||
var now = editor.pos;
|
|
||||||
if (clearPoint)
|
|
||||||
editor.map[now.y][now.x]=editor.info;
|
|
||||||
editor.updateMap();
|
|
||||||
fields.forEach(function(v){
|
|
||||||
delete editor.currentFloorData[v][now.x+','+now.y];
|
|
||||||
})
|
|
||||||
editor.file.saveFloorFile(function (err) {
|
|
||||||
if (err) {
|
|
||||||
printe(err);
|
|
||||||
throw(err)
|
|
||||||
}
|
|
||||||
;printf(clearPoint?'清空该点和事件成功':'只清空该点事件成功');
|
|
||||||
editor.drawPosSelection();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var clearEvent = document.getElementById('clearEvent');
|
var clearEvent = document.getElementById('clearEvent');
|
||||||
clearEvent.onmousedown = function (e) {
|
clearEvent.onmousedown = function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
_clearPoint(false);
|
reDo = null;
|
||||||
|
editor.clearPos(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var clearLoc = document.getElementById('clearLoc');
|
var clearLoc = document.getElementById('clearLoc');
|
||||||
clearLoc.onmousedown = function(e){
|
clearLoc.onmousedown = function(e){
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
_clearPoint(true);
|
reDo = null;
|
||||||
|
editor.clearPos(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
var brushMod=document.getElementById('brushMod');
|
var brushMod=document.getElementById('brushMod');
|
||||||
@ -763,8 +778,11 @@ editor.constructor.prototype.listen=function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var brushMod3=document.getElementById('brushMod3');
|
var brushMod3=document.getElementById('brushMod3');
|
||||||
if(brushMod3)brushMod3.onchange=function(){
|
if(brushMod3) {
|
||||||
editor.brushMod=brushMod3.value;
|
brushMod3.onchange=function(){
|
||||||
|
tip.showHelp(5)
|
||||||
|
editor.brushMod=brushMod3.value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var bgc = document.getElementById('bg'), fgc = document.getElementById('fg'),
|
var bgc = document.getElementById('bg'), fgc = document.getElementById('fg'),
|
||||||
|
|||||||
@ -206,14 +206,20 @@ printf = function (str_, type) {
|
|||||||
printe = function (str_) {
|
printe = function (str_) {
|
||||||
printf(str_, 'error')
|
printf(str_, 'error')
|
||||||
}
|
}
|
||||||
tip_in_showMode = [
|
|
||||||
'表格的文本域可以双击进行编辑',
|
|
||||||
'双击地图可以选中素材,右键可以弹出菜单',
|
|
||||||
'双击事件编辑器的图块可以进行长文本编辑/脚本编辑/地图选点/UI绘制预览等操作',
|
|
||||||
'点击空白处可以自动保存当前修改',
|
|
||||||
'H键可以打开操作帮助哦',
|
|
||||||
];
|
|
||||||
tip=document.getElementById('tip')
|
tip=document.getElementById('tip')
|
||||||
|
tip.showHelp = function(value) {
|
||||||
|
var tips = [
|
||||||
|
'表格的文本域可以双击进行编辑',
|
||||||
|
'双击地图可以选中素材,右键可以弹出菜单',
|
||||||
|
'双击事件编辑器的图块可以进行长文本编辑/脚本编辑/地图选点/UI绘制预览等操作',
|
||||||
|
'ESC或点击空白处可以自动保存当前修改',
|
||||||
|
'H键可以打开操作帮助哦',
|
||||||
|
'tileset贴图模式下可以按选中tileset素材,并在地图上拖动来一次绘制一个区域',
|
||||||
|
'可以拖动地图上的图块和事件,或按Ctrl+C, Ctrl+X和Ctrl+V进行复制,剪切和粘贴'
|
||||||
|
];
|
||||||
|
if (value == null) value = Math.floor(Math.random() * tips.length);
|
||||||
|
printf('tips: ' + tips[value])
|
||||||
|
}
|
||||||
tip._infos= {}
|
tip._infos= {}
|
||||||
tip.infos=function(value){
|
tip.infos=function(value){
|
||||||
if(value!=null){
|
if(value!=null){
|
||||||
|
|||||||
@ -297,7 +297,7 @@
|
|||||||
<canvas class='gameCanvas' id='event2' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='event2' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='fg' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='fg' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='efg' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='efg' width='416' height='416'></canvas>
|
||||||
<canvas class='egameCanvas' id='eui' width='416' height='416' style='z-index:100'></canvas>
|
<canvas class='gameCanvas' id='eui' width='416' height='416' style='z-index:100'></canvas>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -293,7 +293,7 @@
|
|||||||
<canvas class='gameCanvas' id='event2' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='event2' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='fg' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='fg' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='efg' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='efg' width='416' height='416'></canvas>
|
||||||
<canvas class='egameCanvas' id='eui' width='416' height='416' style='z-index:100'></canvas>
|
<canvas class='gameCanvas' id='eui' width='416' height='416' style='z-index:100'></canvas>
|
||||||
</div>
|
</div>
|
||||||
<div class="tools">
|
<div class="tools">
|
||||||
<div id="tip">
|
<div id="tip">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user