Merge pull request #276 from ckcz123/v2.0

V2.0
This commit is contained in:
Zhang Chen 2018-12-12 23:28:24 +08:00 committed by GitHub
commit 8e1bcee350
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 48 deletions

View File

@ -235,6 +235,7 @@ editor.prototype.changeFloor = function (floorId, callback) {
});
editor.currentFloorData[name]=mapArray;
}
editor.preMapData = null;
core.changeFloor(floorId, null, {"x": 0, "y": 0, "direction": "up"}, null, function () {
core.bigmap.offsetX=0;
core.bigmap.offsetY=0;
@ -728,7 +729,7 @@ editor.prototype.listen = function () {
holdingPath = 0;
e.stopPropagation();
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'){
var x0=stepPostfix[0].x;
var y0=stepPostfix[0].y;
@ -822,7 +823,7 @@ editor.prototype.listen = function () {
}
}
var preMapData = {};
editor.preMapData = null;
var currDrawData = {
pos: [],
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)
e.preventDefault();
//Ctrl+z 撤销上一步undo
if (e.keyCode == 90 && e.ctrlKey && preMapData && currDrawData.pos.length && selectBox.isSelected) {
editor.map = JSON.parse(JSON.stringify(preMapData.map));
editor.fgmap = JSON.parse(JSON.stringify(preMapData.fgmap));
editor.bgmap = JSON.parse(JSON.stringify(preMapData.bgmap));
if (e.keyCode == 90 && e.ctrlKey && editor.preMapData && currDrawData.pos.length && selectBox.isSelected) {
editor.map = JSON.parse(JSON.stringify(editor.preMapData.map));
editor.fgmap = JSON.parse(JSON.stringify(editor.preMapData.fgmap));
editor.bgmap = JSON.parse(JSON.stringify(editor.preMapData.bgmap));
editor.updateMap();
reDo = JSON.parse(JSON.stringify(currDrawData));
currDrawData = {pos: [], info: {}};
preMapData = null;
editor.preMapData = null;
}
//Ctrl+y 重做一步redo
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++)
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){
editor.hideMidMenu();
e.stopPropagation();
preMapData = null;
editor.preMapData = null;
reDo = null;
editor_mode.onmode('');
var now = editor.pos;
@ -1060,7 +1061,7 @@ editor.prototype.listen = function () {
moveLoc.onmousedown = function(e){
editor.hideMidMenu();
e.stopPropagation();
preMapData = null;
editor.preMapData = null;
reDo = null;
var thisevent = editor.map[editor.pos.y][editor.pos.x];
if(thisevent==0){
@ -1106,7 +1107,7 @@ editor.prototype.listen = function () {
clearLoc.onmousedown = function(e){
editor.hideMidMenu();
e.stopPropagation();
preMapData = null;
editor.preMapData = null;
reDo = null;
editor.info = 0;
editor_mode.onmode('');

View File

@ -1821,19 +1821,6 @@ actions.prototype.clickSwitchs = function (x,y) {
core.ui.drawSwitchs();
break;
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.ui.drawSettings();
break;
@ -2414,6 +2401,13 @@ actions.prototype.clickGameInfo = function (x, y) {
core.ui.drawStatistics();
break;
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) {
window.open("/score.php?name="+core.firstData.name+"&num=10", "_blank");
}
@ -2423,13 +2417,19 @@ actions.prototype.clickGameInfo = function (x, y) {
}
}
break;
case 2:
case 3:
core.ui.drawHelp();
break;
case 3:
case 4:
core.ui.drawAbout();
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.ui.drawSettings();
break;

View File

@ -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.status.event.selection<0) core.status.event.selection=0;
core.clearMap('ui');
core.setAlpha('ui', 1);
core.setFillStyle('ui', core.material.groundPattern);
var background = core.status.textAttribute.background;
var isWindowSkin = false;
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;
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 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";
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, top + bottom - 35);
core.fillText('ui', "确定", 208 - 38, bottom - 35, null, "bold 17px "+globalFont);
core.fillText('ui', "取消", 208 + 38, bottom - 35);
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);
}
if (core.status.event.selection==1) {
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 (isWindowSkin)
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.platform.useLocalForage ? "[ON]":"[OFF]"),
"单击瞬移: "+(core.getFlag('clickMove', true) ? "[ON]":"[OFF]"),
"查看工程",
"下载离线版本",
"返回主菜单"
];
this.drawChoices(null, choices);
@ -1387,7 +1399,7 @@ ui.prototype.drawReplay = function () {
ui.prototype.drawGameInfo = function () {
core.status.event.id = 'gameInfo';
this.drawChoices(null, [
"数据统计", "查看评论", "操作帮助", "关于本塔", "返回上级菜单"
"数据统计", "查看工程", "查看评论", "操作帮助", "关于本塔","下载离线版本", "返回主菜单"
]);
}