From 92b5ca6e9b6b526f26a5d2c774f5b04bf944effe Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Thu, 15 Oct 2026 15:15:28 +0800 Subject: [PATCH] =?UTF-8?q?refactor(panel):=20=E7=A7=BB=E9=99=A4=E5=B7=A6?= =?UTF-8?q?=E4=B8=8A=E8=A7=92=E5=B8=B8=E9=A9=BB=20HUD=EF=BC=88=E3=80=8C3DT?= =?UTF-8?q?ank=20=E6=8E=A7=E5=88=B6=E5=8F=B0=E3=80=8D=E5=B0=8F=E7=AA=97?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - tools/hornet_panel.js:HUD 不再挂载到页面(等于不显示),原样式与 appendChild 一并去掉 - 保留 hud 对象与 UpdateHud 循环:循环里还负责 TryAutoEnable()(按保存状态自动开启工具) - 重新生成 hornet_bundle.js 并同步到 unpacked --- .../play/static/js/unpacked/hornet_bundle.js | 21 +++++++------------ 3dtank_bundle.js | 21 +++++++------------ tools/hornet_panel.js | 21 +++++++------------ 3 files changed, 21 insertions(+), 42 deletions(-) diff --git a/3dtank.com/play/static/js/unpacked/hornet_bundle.js b/3dtank.com/play/static/js/unpacked/hornet_bundle.js index f6230d9..178d898 100644 --- a/3dtank.com/play/static/js/unpacked/hornet_bundle.js +++ b/3dtank.com/play/static/js/unpacked/hornet_bundle.js @@ -5558,17 +5558,11 @@ } } - // ===== HUD(左上角状态显示,可拖动)===== + // ===== HUD(左上角状态显示)—— 已按需求移除:**不挂载到页面**,等于不再显示。 + // 注意:保留 hud 对象与 UpdateHud 循环 —— 循环里还负责 TryAutoEnable()(按保存状态自动开启工具)。 var hud = document.createElement('div'); hud.id = '3dtank-hud'; - hud.style.cssText = - 'position:fixed;top:10px;left:10px;z-index:100000;pointer-events:auto;cursor:move;' + - 'font:11px Consolas,monospace;color:#7df9ff;background:rgba(5,10,18,0.55);' + - 'backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);' + - 'padding:8px 12px;border-radius:6px;border:1px solid rgba(125,249,255,0.25);' + - 'white-space:pre;line-height:1.6;text-shadow:0 0 3px rgba(125,249,255,0.4);' + - 'user-select:none;-webkit-user-select:none;box-shadow:0 2px 12px rgba(0,0,0,0.4);'; - document.body.appendChild(hud); + // 原样式 + document.body.appendChild(hud) 已移除(那就是常驻左上角的「3DTank 控制台」小窗) var HudDrag = MakeDraggable(hud, null, null, 'hud'); // ===== 面板(可拖动,Alt+T 切换)===== @@ -6108,16 +6102,15 @@ }); } - // ===== 更新 HUD ===== + // ===== 更新 HUD(HUD 本体已移除,这里主要保留 TryAutoEnable 与循环)===== function UpdateHud() { requestAnimationFrame(UpdateHud); TryAutoEnable(); // gameMode 捕获后自动按保存状态开启工具 + if (!hud.parentNode) return; // HUD 未挂载(已移除)→ 不必拼状态文本/写 DOM var ght = window.__gameMode__; - var ghtStatus = ght ? '已捕获' : '未捕获'; - var ghtColor = ght ? '#7df9ff' : '#f5a623'; var lines = []; lines.push('3DTank 控制台 [拖动移动]'); - lines.push('GHT: ' + ghtStatus); + lines.push('GHT: ' + (ght ? '已捕获' : '未捕获')); var list = GetToolList(); list.forEach(function(t) { var status = t.obj ? t.obj.Status() : '未加载'; @@ -6125,7 +6118,7 @@ lines.push(dot + ' ' + t.label + ': ' + status); }); hud.textContent = lines.join('\n'); - hud.style.color = ghtColor; + hud.style.color = ght ? '#7df9ff' : '#f5a623'; } UpdateHud(); diff --git a/3dtank_bundle.js b/3dtank_bundle.js index f6230d9..178d898 100644 --- a/3dtank_bundle.js +++ b/3dtank_bundle.js @@ -5558,17 +5558,11 @@ } } - // ===== HUD(左上角状态显示,可拖动)===== + // ===== HUD(左上角状态显示)—— 已按需求移除:**不挂载到页面**,等于不再显示。 + // 注意:保留 hud 对象与 UpdateHud 循环 —— 循环里还负责 TryAutoEnable()(按保存状态自动开启工具)。 var hud = document.createElement('div'); hud.id = '3dtank-hud'; - hud.style.cssText = - 'position:fixed;top:10px;left:10px;z-index:100000;pointer-events:auto;cursor:move;' + - 'font:11px Consolas,monospace;color:#7df9ff;background:rgba(5,10,18,0.55);' + - 'backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);' + - 'padding:8px 12px;border-radius:6px;border:1px solid rgba(125,249,255,0.25);' + - 'white-space:pre;line-height:1.6;text-shadow:0 0 3px rgba(125,249,255,0.4);' + - 'user-select:none;-webkit-user-select:none;box-shadow:0 2px 12px rgba(0,0,0,0.4);'; - document.body.appendChild(hud); + // 原样式 + document.body.appendChild(hud) 已移除(那就是常驻左上角的「3DTank 控制台」小窗) var HudDrag = MakeDraggable(hud, null, null, 'hud'); // ===== 面板(可拖动,Alt+T 切换)===== @@ -6108,16 +6102,15 @@ }); } - // ===== 更新 HUD ===== + // ===== 更新 HUD(HUD 本体已移除,这里主要保留 TryAutoEnable 与循环)===== function UpdateHud() { requestAnimationFrame(UpdateHud); TryAutoEnable(); // gameMode 捕获后自动按保存状态开启工具 + if (!hud.parentNode) return; // HUD 未挂载(已移除)→ 不必拼状态文本/写 DOM var ght = window.__gameMode__; - var ghtStatus = ght ? '已捕获' : '未捕获'; - var ghtColor = ght ? '#7df9ff' : '#f5a623'; var lines = []; lines.push('3DTank 控制台 [拖动移动]'); - lines.push('GHT: ' + ghtStatus); + lines.push('GHT: ' + (ght ? '已捕获' : '未捕获')); var list = GetToolList(); list.forEach(function(t) { var status = t.obj ? t.obj.Status() : '未加载'; @@ -6125,7 +6118,7 @@ lines.push(dot + ' ' + t.label + ': ' + status); }); hud.textContent = lines.join('\n'); - hud.style.color = ghtColor; + hud.style.color = ght ? '#7df9ff' : '#f5a623'; } UpdateHud(); diff --git a/tools/hornet_panel.js b/tools/hornet_panel.js index 0f860a2..b3a5ae0 100644 --- a/tools/hornet_panel.js +++ b/tools/hornet_panel.js @@ -209,17 +209,11 @@ } } - // ===== HUD(左上角状态显示,可拖动)===== + // ===== HUD(左上角状态显示)—— 已按需求移除:**不挂载到页面**,等于不再显示。 + // 注意:保留 hud 对象与 UpdateHud 循环 —— 循环里还负责 TryAutoEnable()(按保存状态自动开启工具)。 var hud = document.createElement('div'); hud.id = '3dtank-hud'; - hud.style.cssText = - 'position:fixed;top:10px;left:10px;z-index:100000;pointer-events:auto;cursor:move;' + - 'font:11px Consolas,monospace;color:#7df9ff;background:rgba(5,10,18,0.55);' + - 'backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);' + - 'padding:8px 12px;border-radius:6px;border:1px solid rgba(125,249,255,0.25);' + - 'white-space:pre;line-height:1.6;text-shadow:0 0 3px rgba(125,249,255,0.4);' + - 'user-select:none;-webkit-user-select:none;box-shadow:0 2px 12px rgba(0,0,0,0.4);'; - document.body.appendChild(hud); + // 原样式 + document.body.appendChild(hud) 已移除(那就是常驻左上角的「3DTank 控制台」小窗) var HudDrag = MakeDraggable(hud, null, null, 'hud'); // ===== 面板(可拖动,Alt+T 切换)===== @@ -759,16 +753,15 @@ }); } - // ===== 更新 HUD ===== + // ===== 更新 HUD(HUD 本体已移除,这里主要保留 TryAutoEnable 与循环)===== function UpdateHud() { requestAnimationFrame(UpdateHud); TryAutoEnable(); // gameMode 捕获后自动按保存状态开启工具 + if (!hud.parentNode) return; // HUD 未挂载(已移除)→ 不必拼状态文本/写 DOM var ght = window.__gameMode__; - var ghtStatus = ght ? '已捕获' : '未捕获'; - var ghtColor = ght ? '#7df9ff' : '#f5a623'; var lines = []; lines.push('3DTank 控制台 [拖动移动]'); - lines.push('GHT: ' + ghtStatus); + lines.push('GHT: ' + (ght ? '已捕获' : '未捕获')); var list = GetToolList(); list.forEach(function(t) { var status = t.obj ? t.obj.Status() : '未加载'; @@ -776,7 +769,7 @@ lines.push(dot + ' ' + t.label + ': ' + status); }); hud.textContent = lines.join('\n'); - hud.style.color = ghtColor; + hud.style.color = ght ? '#7df9ff' : '#f5a623'; } UpdateHud();