From 92ecb5210ce3737e1d1a2876882bf9d752026055 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Fri, 20 Aug 2021 12:41:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=B4=A0=E6=9D=90=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/editor.js | 19 ++++++++++++++----- _server/editor_materialpanel.js | 4 ++-- editor.html | 23 +++++++++++------------ project/plugins.js | 7 +++++-- 4 files changed, 32 insertions(+), 21 deletions(-) diff --git a/_server/editor.js b/_server/editor.js index 8bf28c04..5afe7a24 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -769,9 +769,14 @@ editor.prototype.drawInitData = function (icons) { } var width = images[img].width, height = images[img].height, mh = height; if (editor.uivalues.folded) { - var per_height = (img == 'enemy48' || img == 'npc48' ? 48 : 32); - width = Math.ceil(height / per_height / editor.uivalues.foldPerCol) * 32; - if (width > 32) mh = per_height * editor.uivalues.foldPerCol; + if (img == 'terrains') { + width = Math.ceil((height / 32 + 2) / editor.uivalues.foldPerCol) * 32; + if (width > 32) mh = 32 * editor.uivalues.foldPerCol; + } else { + var per_height = (img == 'enemy48' || img == 'npc48' ? 48 : 32); + width = Math.ceil(height / per_height / editor.uivalues.foldPerCol) * 32; + if (width > 32) mh = per_height * editor.uivalues.foldPerCol; + } } editor.widthsX[img] = [img, sumWidth / 32, (sumWidth + width) / 32, height]; sumWidth += width; @@ -852,10 +857,14 @@ editor.prototype.drawInitData = function (icons) { })(editor.airwallImg,nowx); if (editor.uivalues.folded) { // --- 单列 & 折行 - var subimgs = core.splitImage(images[img], 32, editor.uivalues.foldPerCol * 32); + var canvas = document.createElement("canvas"); + canvas.width = 32; + canvas.height = images[img].height + 64; + canvas.getContext('2d').drawImage(images[img], 0, 64); + var subimgs = core.splitImage(canvas, 32, editor.uivalues.foldPerCol * 32); var frames = images[img].width / 32; for (var i = 0; i < subimgs.length; i+=frames) { - drawImage(subimgs[i], nowx, i==0?2*32:0, img); + drawImage(subimgs[i], nowx, 0, img); nowx += 32; } } diff --git a/_server/editor_materialpanel.js b/_server/editor_materialpanel.js index 8b7b8adb..cf18c927 100644 --- a/_server/editor_materialpanel.js +++ b/_server/editor_materialpanel.js @@ -150,10 +150,10 @@ editor_materialpanel_wrapper = function (editor) { } else { var height = editor.widthsX[spriter][3], col = height / ysize; + if (spriter == 'terrains') col += 2; if (editor.uivalues.folded && core.tilesets.indexOf(pos.images) == -1) { col = (pos.x == editor.widthsX[spriter][2] - 1) ? ((col - 1) % editor.uivalues.foldPerCol + 1) : editor.uivalues.foldPerCol; } - if (spriter == 'terrains' && pos.x == editor.widthsX[spriter][1]) col += 2; pos.y = Math.min(pos.y, col - 1); } @@ -177,7 +177,7 @@ editor_materialpanel_wrapper = function (editor) { if (editor.uivalues.folded) { y += editor.uivalues.foldPerCol * (pos.x - editor.widthsX[spriter][1]); } - if (pos.images == 'terrains' && pos.x == 0) y -= 2; + if (pos.images == 'terrains') y -= 2; editor.info = { 'images': pos.images, 'y': y } } diff --git a/editor.html b/editor.html index 0c0354c8..e3f5d4df 100644 --- a/editor.html +++ b/editor.html @@ -305,16 +305,16 @@
- + + + + + + + + + 通行度 前景层
-
+
-
diff --git a/project/plugins.js b/project/plugins.js index 6c2b8969..47e7b99d 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -438,13 +438,16 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = // 背景层2插入事件层前 parent.insertBefore(input, child); // 不能直接更改背景层2的innerText 所以创建文本节点 - var txt = document.createTextNode('背景层2'); + var txt = document.createTextNode('bg2'); // 插入事件层前(即新插入的背景层2前) parent.insertBefore(txt, child); // 向最后插入前景层2(即插入前景层后) parent.appendChild(input2); - var txt2 = document.createTextNode('前景层2'); + var txt2 = document.createTextNode('fg2'); parent.appendChild(txt2); + parent.childNodes[2].replaceWith("bg"); + parent.childNodes[6].replaceWith("事件"); + parent.childNodes[8].replaceWith("fg"); } else { var input = createCanvasBtn_mobile('bg2'); var input2 = createCanvasBtn_mobile('fg2');