commit
8e1bcee350
@ -235,6 +235,7 @@ editor.prototype.changeFloor = function (floorId, callback) {
|
|||||||
});
|
});
|
||||||
editor.currentFloorData[name]=mapArray;
|
editor.currentFloorData[name]=mapArray;
|
||||||
}
|
}
|
||||||
|
editor.preMapData = null;
|
||||||
core.changeFloor(floorId, null, {"x": 0, "y": 0, "direction": "up"}, null, function () {
|
core.changeFloor(floorId, null, {"x": 0, "y": 0, "direction": "up"}, null, function () {
|
||||||
core.bigmap.offsetX=0;
|
core.bigmap.offsetX=0;
|
||||||
core.bigmap.offsetY=0;
|
core.bigmap.offsetY=0;
|
||||||
@ -728,7 +729,7 @@ editor.prototype.listen = function () {
|
|||||||
holdingPath = 0;
|
holdingPath = 0;
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (stepPostfix && stepPostfix.length) {
|
if (stepPostfix && stepPostfix.length) {
|
||||||
preMapData = JSON.parse(JSON.stringify({map:editor.map,fgmap:editor.fgmap,bgmap:editor.bgmap}));
|
editor.preMapData = JSON.parse(JSON.stringify({map:editor.map,fgmap:editor.fgmap,bgmap:editor.bgmap}));
|
||||||
if(editor.brushMod!=='line'){
|
if(editor.brushMod!=='line'){
|
||||||
var x0=stepPostfix[0].x;
|
var x0=stepPostfix[0].x;
|
||||||
var y0=stepPostfix[0].y;
|
var y0=stepPostfix[0].y;
|
||||||
@ -822,7 +823,7 @@ editor.prototype.listen = function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var preMapData = {};
|
editor.preMapData = null;
|
||||||
var currDrawData = {
|
var currDrawData = {
|
||||||
pos: [],
|
pos: [],
|
||||||
info: {}
|
info: {}
|
||||||
@ -836,18 +837,18 @@ editor.prototype.listen = function () {
|
|||||||
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();
|
||||||
//Ctrl+z 撤销上一步undo
|
//Ctrl+z 撤销上一步undo
|
||||||
if (e.keyCode == 90 && e.ctrlKey && preMapData && currDrawData.pos.length && selectBox.isSelected) {
|
if (e.keyCode == 90 && e.ctrlKey && editor.preMapData && currDrawData.pos.length && selectBox.isSelected) {
|
||||||
editor.map = JSON.parse(JSON.stringify(preMapData.map));
|
editor.map = JSON.parse(JSON.stringify(editor.preMapData.map));
|
||||||
editor.fgmap = JSON.parse(JSON.stringify(preMapData.fgmap));
|
editor.fgmap = JSON.parse(JSON.stringify(editor.preMapData.fgmap));
|
||||||
editor.bgmap = JSON.parse(JSON.stringify(preMapData.bgmap));
|
editor.bgmap = JSON.parse(JSON.stringify(editor.preMapData.bgmap));
|
||||||
editor.updateMap();
|
editor.updateMap();
|
||||||
reDo = JSON.parse(JSON.stringify(currDrawData));
|
reDo = JSON.parse(JSON.stringify(currDrawData));
|
||||||
currDrawData = {pos: [], info: {}};
|
currDrawData = {pos: [], info: {}};
|
||||||
preMapData = null;
|
editor.preMapData = null;
|
||||||
}
|
}
|
||||||
//Ctrl+y 重做一步redo
|
//Ctrl+y 重做一步redo
|
||||||
if (e.keyCode == 89 && e.ctrlKey && reDo && reDo.pos.length && selectBox.isSelected) {
|
if (e.keyCode == 89 && e.ctrlKey && reDo && reDo.pos.length && selectBox.isSelected) {
|
||||||
preMapData = JSON.parse(JSON.stringify({map:editor.map,fgmap:editor.fgmap,bgmap:editor.bgmap}));
|
editor.preMapData = JSON.parse(JSON.stringify({map:editor.map,fgmap:editor.fgmap,bgmap:editor.bgmap}));
|
||||||
for (var j = 0; j < reDo.pos.length; j++)
|
for (var j = 0; j < reDo.pos.length; j++)
|
||||||
editor.map[reDo.pos[j].y][reDo.pos[j].x] = JSON.parse(JSON.stringify(reDo.info));
|
editor.map[reDo.pos[j].y][reDo.pos[j].x] = JSON.parse(JSON.stringify(reDo.info));
|
||||||
|
|
||||||
@ -1027,7 +1028,7 @@ editor.prototype.listen = function () {
|
|||||||
copyLoc.onmousedown = function(e){
|
copyLoc.onmousedown = function(e){
|
||||||
editor.hideMidMenu();
|
editor.hideMidMenu();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
preMapData = null;
|
editor.preMapData = null;
|
||||||
reDo = null;
|
reDo = null;
|
||||||
editor_mode.onmode('');
|
editor_mode.onmode('');
|
||||||
var now = editor.pos;
|
var now = editor.pos;
|
||||||
@ -1060,7 +1061,7 @@ editor.prototype.listen = function () {
|
|||||||
moveLoc.onmousedown = function(e){
|
moveLoc.onmousedown = function(e){
|
||||||
editor.hideMidMenu();
|
editor.hideMidMenu();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
preMapData = null;
|
editor.preMapData = null;
|
||||||
reDo = null;
|
reDo = null;
|
||||||
var thisevent = editor.map[editor.pos.y][editor.pos.x];
|
var thisevent = editor.map[editor.pos.y][editor.pos.x];
|
||||||
if(thisevent==0){
|
if(thisevent==0){
|
||||||
@ -1106,7 +1107,7 @@ editor.prototype.listen = function () {
|
|||||||
clearLoc.onmousedown = function(e){
|
clearLoc.onmousedown = function(e){
|
||||||
editor.hideMidMenu();
|
editor.hideMidMenu();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
preMapData = null;
|
editor.preMapData = null;
|
||||||
reDo = null;
|
reDo = null;
|
||||||
editor.info = 0;
|
editor.info = 0;
|
||||||
editor_mode.onmode('');
|
editor_mode.onmode('');
|
||||||
|
|||||||
@ -1821,19 +1821,6 @@ actions.prototype.clickSwitchs = function (x,y) {
|
|||||||
core.ui.drawSwitchs();
|
core.ui.drawSwitchs();
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
if (core.platform.isPC)
|
|
||||||
window.open("editor.html", "_blank");
|
|
||||||
else if (confirm("即将离开本塔,跳转至本塔工程页面,确认?")) {
|
|
||||||
window.location.href = "editor-mobile.html";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
if (core.platform.isPC)
|
|
||||||
window.open(core.firstData.name+".zip");
|
|
||||||
else
|
|
||||||
window.location.href = core.firstData.name+".zip";
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
core.status.event.selection=0;
|
core.status.event.selection=0;
|
||||||
core.ui.drawSettings();
|
core.ui.drawSettings();
|
||||||
break;
|
break;
|
||||||
@ -2414,6 +2401,13 @@ actions.prototype.clickGameInfo = function (x, y) {
|
|||||||
core.ui.drawStatistics();
|
core.ui.drawStatistics();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
if (core.platform.isPC)
|
||||||
|
window.open("editor.html", "_blank");
|
||||||
|
else if (confirm("即将离开本塔,跳转至本塔工程页面,确认?")) {
|
||||||
|
window.location.href = "editor-mobile.html";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
if (core.platform.isPC) {
|
if (core.platform.isPC) {
|
||||||
window.open("/score.php?name="+core.firstData.name+"&num=10", "_blank");
|
window.open("/score.php?name="+core.firstData.name+"&num=10", "_blank");
|
||||||
}
|
}
|
||||||
@ -2423,13 +2417,19 @@ actions.prototype.clickGameInfo = function (x, y) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 3:
|
||||||
core.ui.drawHelp();
|
core.ui.drawHelp();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 4:
|
||||||
core.ui.drawAbout();
|
core.ui.drawAbout();
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 5:
|
||||||
|
if (core.platform.isPC)
|
||||||
|
window.open(core.firstData.name+".zip");
|
||||||
|
else
|
||||||
|
window.location.href = core.firstData.name+".zip";
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
core.status.event.selection=5;
|
core.status.event.selection=5;
|
||||||
core.ui.drawSettings();
|
core.ui.drawSettings();
|
||||||
break;
|
break;
|
||||||
|
|||||||
54
libs/ui.js
54
libs/ui.js
@ -927,9 +927,17 @@ ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
|
|||||||
if (!core.isset(core.status.event.selection) || core.status.event.selection>1) core.status.event.selection=1;
|
if (!core.isset(core.status.event.selection) || core.status.event.selection>1) core.status.event.selection=1;
|
||||||
if (core.status.event.selection<0) core.status.event.selection=0;
|
if (core.status.event.selection<0) core.status.event.selection=0;
|
||||||
|
|
||||||
core.clearMap('ui');
|
var background = core.status.textAttribute.background;
|
||||||
core.setAlpha('ui', 1);
|
var isWindowSkin = false;
|
||||||
core.setFillStyle('ui', core.material.groundPattern);
|
if (typeof background == 'string') {
|
||||||
|
background = core.material.images.images[background];
|
||||||
|
if (core.isset(background) && background.width==192 && background.height==128) isWindowSkin = true;
|
||||||
|
else background = core.initStatus.textAttribute.background;
|
||||||
|
}
|
||||||
|
if (!isWindowSkin) background = core.arrayToRGBA(background);
|
||||||
|
var borderColor = core.status.globalAttribute.borderColor;
|
||||||
|
var textColor = core.arrayToRGBA(core.status.textAttribute.text);
|
||||||
|
|
||||||
var globalFont = core.status.globalAttribute.font;
|
var globalFont = core.status.globalAttribute.font;
|
||||||
core.setFont('ui', "bold 19px "+globalFont);
|
core.setFont('ui', "bold 19px "+globalFont);
|
||||||
|
|
||||||
@ -942,29 +950,35 @@ ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
|
|||||||
|
|
||||||
var left = Math.min(208 - 40 - parseInt(max_length / 2), 100);
|
var left = Math.min(208 - 40 - parseInt(max_length / 2), 100);
|
||||||
var top = 140 - (lines-1)*30;
|
var top = 140 - (lines-1)*30;
|
||||||
var right = 416 - 2 * left, bottom = 416 - 140 - top;
|
var right = 416 - left, bottom = 416 - 140, width = right - left, height = bottom - top;
|
||||||
|
|
||||||
var borderColor = core.status.globalAttribute.borderColor;
|
core.clearMap('ui');
|
||||||
|
if (isWindowSkin) {
|
||||||
|
core.setAlpha('ui', 0.85);
|
||||||
|
this.drawWindowSkin(background,'ui',left,top,width,height);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.fillRect('ui', left, top, width, height, background);
|
||||||
|
core.strokeRect('ui', left - 1, top - 1, width + 1, height + 1, borderColor, 2);
|
||||||
|
}
|
||||||
|
core.setAlpha('ui', 1);
|
||||||
|
|
||||||
if (core.isPlaying())
|
|
||||||
core.fillRect('ui', left, top, right, bottom, core.material.groundPattern);
|
|
||||||
if (core.isPlaying())
|
|
||||||
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, borderColor, 2);
|
|
||||||
core.canvas.ui.textAlign = "center";
|
core.canvas.ui.textAlign = "center";
|
||||||
for (var i in contents) {
|
for (var i in contents) {
|
||||||
core.fillText('ui', contents[i], 208, top + 50 + i*30, "#FFFFFF");
|
core.fillText('ui', contents[i], 208, top + 50 + i*30, textColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
core.fillText('ui', "确定", 208 - 38, top + bottom - 35, "#FFFFFF", "bold 17px "+globalFont);
|
core.fillText('ui', "确定", 208 - 38, bottom - 35, null, "bold 17px "+globalFont);
|
||||||
core.fillText('ui', "取消", 208 + 38, top + bottom - 35);
|
core.fillText('ui', "取消", 208 + 38, bottom - 35);
|
||||||
|
|
||||||
var len=core.canvas.ui.measureText("确定").width;
|
var len=core.canvas.ui.measureText("确定").width;
|
||||||
if (core.status.event.selection==0) {
|
|
||||||
core.strokeRect('ui', 208-38-parseInt(len/2)-5, top+bottom-35-20, len+10, 28, "#FFD700", 2);
|
var strokeLeft = 208 + (76*core.status.event.selection-38) - parseInt(len/2) - 5;
|
||||||
}
|
|
||||||
if (core.status.event.selection==1) {
|
if (isWindowSkin)
|
||||||
core.strokeRect('ui', 208+38-parseInt(len/2)-5, top+bottom-35-20, len+10, 28, "#FFD700", 2);
|
this.drawWindowSelector(background, 'ui', strokeLeft, bottom-35-20, len+10, 28);
|
||||||
}
|
else
|
||||||
|
core.strokeRect('ui', strokeLeft, bottom-35-20, len+10, 28, "#FFD700", 2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -981,8 +995,6 @@ ui.prototype.drawSwitchs = function() {
|
|||||||
"领域显伤: "+(core.flags.displayExtraDamage ? "[ON]" : "[OFF]"),
|
"领域显伤: "+(core.flags.displayExtraDamage ? "[ON]" : "[OFF]"),
|
||||||
"新版存档: "+(core.platform.useLocalForage ? "[ON]":"[OFF]"),
|
"新版存档: "+(core.platform.useLocalForage ? "[ON]":"[OFF]"),
|
||||||
"单击瞬移: "+(core.getFlag('clickMove', true) ? "[ON]":"[OFF]"),
|
"单击瞬移: "+(core.getFlag('clickMove', true) ? "[ON]":"[OFF]"),
|
||||||
"查看工程",
|
|
||||||
"下载离线版本",
|
|
||||||
"返回主菜单"
|
"返回主菜单"
|
||||||
];
|
];
|
||||||
this.drawChoices(null, choices);
|
this.drawChoices(null, choices);
|
||||||
@ -1387,7 +1399,7 @@ ui.prototype.drawReplay = function () {
|
|||||||
ui.prototype.drawGameInfo = function () {
|
ui.prototype.drawGameInfo = function () {
|
||||||
core.status.event.id = 'gameInfo';
|
core.status.event.id = 'gameInfo';
|
||||||
this.drawChoices(null, [
|
this.drawChoices(null, [
|
||||||
"数据统计", "查看评论", "操作帮助", "关于本塔", "返回上级菜单"
|
"数据统计", "查看工程", "查看评论", "操作帮助", "关于本塔","下载离线版本", "返回主菜单"
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user