From 15c034c62ca5402d2372b8ad5c59d45bb7d6c0f5 Mon Sep 17 00:00:00 2001 From: ShakeFlower Date: Thu, 29 May 2025 10:33:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=B0=8F=E4=BF=AE=E5=A4=8D=E9=81=93?= =?UTF-8?q?=E5=85=B7=E6=A0=8F=E6=9C=AAreplaceText=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E5=8F=8A=E6=B7=BB=E5=8A=A0opus=E4=B8=8Ewebp?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/editor_uievent.js | 6 +++--- _server/table/comment.js | 2 +- _server/table/data.comment.js | 8 ++++---- project/plugins.js | 28 +++++++++++++++++----------- 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/_server/editor_uievent.js b/_server/editor_uievent.js index 3dba4c2a..3fd8c10b 100644 --- a/_server/editor_uievent.js +++ b/_server/editor_uievent.js @@ -587,12 +587,12 @@ editor_uievent_wrapper = function (editor) { var disabled = _isTileset && value.indexOf(one) >= 0 ? 'disabled' : '' html += ` ${one}`; // 预览图片 - if (one.endsWith('.png') || one.endsWith('.jpg') || one.endsWith('.jpeg') || one.endsWith('.gif')) { + if (one.endsWith('.png') || one.endsWith('.jpg') || one.endsWith('.jpeg') || one.endsWith('.gif') || one.endsWith('.webp')) { html += ""; html += '
'; } // 试听音频 - if (one.endsWith('.mp3') || one.endsWith('.ogg') || one.endsWith('.wav') || one.endsWith('.m4a') || one.endsWith('.flac')) { + if (one.endsWith('.mp3') || one.endsWith('.ogg') || one.endsWith('.wav') || one.endsWith('.m4a') || one.endsWith('.flac') || one.endsWith('.opus')) { html += "" html += " 音调:"; html += `0:00 / 0:00
@@ -611,7 +611,7 @@ editor_uievent_wrapper = function (editor) { var disabled = _isTileset && value.indexOf(one) >= 0 ? 'disabled' : ''; html += ` ${one}`; // 预览图片 - if (one.endsWith('.png') || one.endsWith('.jpg') || one.endsWith('.jpeg') || one.endsWith('.gif')) { + if (one.endsWith('.png') || one.endsWith('.jpg') || one.endsWith('.jpeg') || one.endsWith('.gif') || one.endsWith('.webp')) { html += ""; html += '

'; } diff --git a/_server/table/comment.js b/_server/table/comment.js index 06789f1a..e60e0778 100644 --- a/_server/table/comment.js +++ b/_server/table/comment.js @@ -657,7 +657,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_type": "material", "_directory": "./project/bgms/", "_transform": (function (one) { - if (one.endsWith('.mp3') || one.endsWith('.ogg') || one.endsWith('.wav') || one.endsWith('.m4a') || one.endsWith('.flac')) + if (one.endsWith('.mp3') || one.endsWith('.ogg') || one.endsWith('.wav') || one.endsWith('.m4a') || one.endsWith('.flac') || one.endsWith('.opus')) return one; return null; }).toString(), diff --git a/_server/table/data.comment.js b/_server/table/data.comment.js index d40625b1..0e6addfa 100644 --- a/_server/table/data.comment.js +++ b/_server/table/data.comment.js @@ -31,7 +31,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_range": "editor.mode.checkImages(thiseval, './project/images/')", "_directory": "./project/images/", "_transform": (function (one) { - if (one.endsWith('.png') || one.endsWith('.jpg') || one.endsWith('.jpeg') || one.endsWith('.gif')) + if (one.endsWith('.png') || one.endsWith('.jpg') || one.endsWith('.jpeg') || one.endsWith('.gif') || one.endsWith('.webp')) return one; return null; }).toString(), @@ -89,7 +89,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_range": "editor.mode.checkUnique(thiseval)", "_directory": "./project/bgms/", "_transform": (function (one) { - if (one.endsWith('.mp3') || one.endsWith('.ogg') || one.endsWith('.wav') || one.endsWith('.m4a') || one.endsWith('.flac')) + if (one.endsWith('.mp3') || one.endsWith('.ogg') || one.endsWith('.wav') || one.endsWith('.m4a') || one.endsWith('.flac') || one.endsWith('.opus')) return one; return null; }).toString(), @@ -102,7 +102,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_range": "editor.mode.checkUnique(thiseval)", "_directory": "./project/sounds/", "_transform": (function (one) { - if (one.endsWith('.mp3') || one.endsWith('.ogg') || one.endsWith('.wav') || one.endsWith('.m4a') || one.endsWith('.flac')) + if (one.endsWith('.mp3') || one.endsWith('.ogg') || one.endsWith('.wav') || one.endsWith('.m4a') || one.endsWith('.flac') || one.endsWith('.opus')) return one; return null; }).toString(), @@ -147,7 +147,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_type": "material", "_directory": "./project/bgms/", "_transform": (function (one) { - if (one.endsWith('.mp3') || one.endsWith('.ogg') || one.endsWith('.wav') || one.endsWith('.m4a') || one.endsWith('.flac')) + if (one.endsWith('.mp3') || one.endsWith('.ogg') || one.endsWith('.wav') || one.endsWith('.m4a') || one.endsWith('.flac') || one.endsWith('.opus')) return one; return null; }).toString(), diff --git a/project/plugins.js b/project/plugins.js index 51f69116..917686f4 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -2156,9 +2156,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = const loc = `${x},${y}`; const hasEvent = has(floor.events[loc]); if (hasEvent) return; // 如果有事件,直接不清了 - const block = core.getBlock(x,y); + const block = core.getBlock(x, y); if (block != null && block.event.cls !== 'items') return; // 角色站的位置为空地和物品以外的图块,不清(例如箭头,可能无法返回) - + let deep = Infinity; if (hasBlockDamage(loc)) { deep = core.flags.enableGentleClick ? 1 : 0; // 角色站的位置有地图伤害时,仍然允许轻点附近1格 @@ -2498,7 +2498,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.x = x ?? 0; this.y = y ?? 0; this.w = w ?? core.__PIXELS__; - this.h = h ?? core.__PIXELS__; + this.h = h ?? core.__PIXELS__; this.zIndex = zIndex ?? 136; // 136比uievent大1 /** 屏幕被按下时触发的事件 */ @@ -2548,7 +2548,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = createCanvas() { return core.createCanvas(this.name, this.x, this.y, this.w, this.h, this.zIndex); } - + drawButtonContent() { this.btnList.forEach((button) => { if (!button.disable) button.draw(); @@ -2760,6 +2760,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = return list; } + // 复写resize,保证屏幕变化时此画布表现正常 + const originResize = core.control.resize; + core.control.resize = function () { + originResize.apply(core.control, arguments); + [back, itemBoard, equipBoard, infoBoard].forEach((menu) => { if (menu && menu.onDraw) menu.drawContent(); }); + } + // #endregion const { ButtonBase, RoundBtn, IconBtn, ExitBtn, MenuBase } = core.plugin.uiBase; // #region 绘制用到的按钮类 @@ -3177,12 +3184,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.fillText(ctx, itemsUsedCount[itemId] || 0, 80, 113, 'rgb(47, 49, 54)', '14px Verdana'); } - const itemText = item.text + ((type === "equips") ? this.getEquipCompareInfo(item) : ""); // 物品描述信息 + const itemText = core.replaceText(item.text) + ((type === "equips") ? this.getEquipCompareInfo(item) : ""); // 物品描述信息 core.drawTextContent(ctx, itemText, { left: 20, top: 125, bold: false, color: "black", align: "left", fontSize: 15, maxWidth: 150 }); - const currItemHotKey = HotkeySelect.getHotkeyNum(itemId); + const currItemHotKey = HotkeySelect.getHotkeyNum(itemId); // 获取快捷键设置按钮当前的图标 /*** @type {IconBtnClass} */ const setHotkeyBtn = this.btnList.get('setHotkeyBtn'); @@ -3439,7 +3446,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (this.hotkeyNum != null) core.setLocalStorage('hotkey' + this.hotkeyNum, null); } - setHotkey(num) { + setHotkey(num) { this.deleteHotkey(); core.setLocalStorage('hotkey' + num, this.itemId); this.hotkeyNum = Number(num); @@ -3979,7 +3986,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (index > toorBarConfig[key].length) { core.drawFailTip('按钮中间不能有空白!'); return; - } + } const oldIndex = toorBarConfig[key].indexOf(value); if (oldIndex !== -1) { // 如果目标位置有图标,两者交换 if (toorBarConfig[key][index] === value) return; @@ -4101,7 +4108,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ['1,1', new SettingButton(40, 180, 150, 30, 'autoGet')], ]); */ - + // #region 复写 // 复写resize,保证屏幕变化时此画布表现正常 const originResize = core.control.resize; @@ -4822,7 +4829,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.ui.fillText(ctx, this.setting.getName(), this.x, this.y + this.h / 2 + 5, 'white', '16px Verdana'); const drawFunc = this.setting.draw; - if (this.status === 'selected'){ + if (this.status === 'selected') { core.drawUIEventSelector(0, "winskin.png", this.x, this.y, this.w, this.h, 137); } if (drawFunc) drawFunc.apply(this, [ctx]); @@ -5286,7 +5293,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = // 设置初始时选中的按键为第一个按键 settingMenu.changeBtn(gamePlayBtn); - /** @todo 修复resize时(尤其有输入框时)自定义画布被破坏的,及擦除不正确问题*/ settingMenu.init(); } }