From 529868b1945423bcc2d65f8e75cced1eca923caf Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Thu, 15 Oct 2026 15:47:52 +0800 Subject: [PATCH] =?UTF-8?q?feat(wireframe):=203D=20=E9=80=8F=E8=A7=86?= =?UTF-8?q?=E9=87=8C=E7=BB=99=E4=BA=BA=E6=9C=BA=E5=9D=A6=E5=85=8B=E6=A0=87?= =?UTF-8?q?=E3=80=8C=E4=BA=BA=E6=9C=BA=E3=80=8D=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - hornet_3d_wireframe:坦克绘制后在其上方投影并写「人机」(先描黑边再填黄字,任何背景下可读) - 复用 lib.ScanBots / IsBot,节流约每 0.3 秒扫描一次;雷达的方块标记保留 --- .../play/static/js/unpacked/hornet_bundle.js | 29 ++++++++++++++++- 3dtank_bundle.js | 29 ++++++++++++++++- tools/hornet_3d_wireframe.js | 31 +++++++++++++++++-- 3 files changed, 85 insertions(+), 4 deletions(-) diff --git a/3dtank.com/play/static/js/unpacked/hornet_bundle.js b/3dtank.com/play/static/js/unpacked/hornet_bundle.js index 38a2f4d..bea0907 100644 --- a/3dtank.com/play/static/js/unpacked/hornet_bundle.js +++ b/3dtank.com/play/static/js/unpacked/hornet_bundle.js @@ -1624,6 +1624,9 @@ return lib.GetCameraInfo(gm); } var Project3D = lib.Project3D; + // 人机标记:同队内装备分数相同且 < 8000(lib.ScanBots 定期扫描 → IsBot 查询) + var ScanBots = lib.ScanBots, IsBot = lib.IsBot; + var LastBotScanAt = 0; // 人机扫描节流(约每 0.3 秒一次) // ===== 热点优化:相机基每帧只算一次(避免逐顶点重复三角函数 + 对象分配)===== var Cam = { @@ -2418,7 +2421,13 @@ var tankList = gm.q100_1.r11l(); var count = tankList.e1(); - var drawnCount = 0; + var drawnCount = 0, botDrawn = 0; + + // 人机扫描(装备分数不会每帧变,节流到约每 0.3 秒一次) + if (ScanBots && (Date.now() - LastBotScanAt > 300)) { + LastBotScanAt = Date.now(); + ScanBots(); + } for (var i = 0; i < count; i++) { var tank = tankList.g1(i); @@ -2517,6 +2526,24 @@ DrawTankMarker(ctx, pos, camInfo, screenW, screenH, color); } + // 人机标记:坦克上方写「人机」(同队装备分数相同且 < 8000) + if (typeof IsBot === 'function' && IsBot(tank)) { + var botPt = Project3D({ x: pos.x, y: pos.y, z: pos.z + 1300 }, + camInfo.pos, camInfo.yaw, camInfo.pitch, camInfo.fov, screenW, screenH); + if (botPt) { + ctx.save(); + ctx.font = 'bold 13px Consolas,monospace'; + ctx.textAlign = 'center'; + ctx.lineWidth = 3; + ctx.strokeStyle = 'rgba(0,0,0,0.85)'; + ctx.strokeText('人机', botPt.x, botPt.y); // 先描黑边,保证任何背景下都看得清 + ctx.fillStyle = '#ffd24a'; + ctx.fillText('人机', botPt.x, botPt.y); + ctx.restore(); + botDrawn++; + } + } + drawnCount++; } diff --git a/3dtank_bundle.js b/3dtank_bundle.js index 38a2f4d..bea0907 100644 --- a/3dtank_bundle.js +++ b/3dtank_bundle.js @@ -1624,6 +1624,9 @@ return lib.GetCameraInfo(gm); } var Project3D = lib.Project3D; + // 人机标记:同队内装备分数相同且 < 8000(lib.ScanBots 定期扫描 → IsBot 查询) + var ScanBots = lib.ScanBots, IsBot = lib.IsBot; + var LastBotScanAt = 0; // 人机扫描节流(约每 0.3 秒一次) // ===== 热点优化:相机基每帧只算一次(避免逐顶点重复三角函数 + 对象分配)===== var Cam = { @@ -2418,7 +2421,13 @@ var tankList = gm.q100_1.r11l(); var count = tankList.e1(); - var drawnCount = 0; + var drawnCount = 0, botDrawn = 0; + + // 人机扫描(装备分数不会每帧变,节流到约每 0.3 秒一次) + if (ScanBots && (Date.now() - LastBotScanAt > 300)) { + LastBotScanAt = Date.now(); + ScanBots(); + } for (var i = 0; i < count; i++) { var tank = tankList.g1(i); @@ -2517,6 +2526,24 @@ DrawTankMarker(ctx, pos, camInfo, screenW, screenH, color); } + // 人机标记:坦克上方写「人机」(同队装备分数相同且 < 8000) + if (typeof IsBot === 'function' && IsBot(tank)) { + var botPt = Project3D({ x: pos.x, y: pos.y, z: pos.z + 1300 }, + camInfo.pos, camInfo.yaw, camInfo.pitch, camInfo.fov, screenW, screenH); + if (botPt) { + ctx.save(); + ctx.font = 'bold 13px Consolas,monospace'; + ctx.textAlign = 'center'; + ctx.lineWidth = 3; + ctx.strokeStyle = 'rgba(0,0,0,0.85)'; + ctx.strokeText('人机', botPt.x, botPt.y); // 先描黑边,保证任何背景下都看得清 + ctx.fillStyle = '#ffd24a'; + ctx.fillText('人机', botPt.x, botPt.y); + ctx.restore(); + botDrawn++; + } + } + drawnCount++; } diff --git a/tools/hornet_3d_wireframe.js b/tools/hornet_3d_wireframe.js index 6d43b5c..ae368e6 100644 --- a/tools/hornet_3d_wireframe.js +++ b/tools/hornet_3d_wireframe.js @@ -106,7 +106,10 @@ } return lib.GetCameraInfo(gm); } - var Project3D = lib.Project3D; + var Project3D = lib.Project3D; + // 人机标记:同队内装备分数相同且 < 8000(lib.ScanBots 定期扫描 → IsBot 查询) + var ScanBots = lib.ScanBots, IsBot = lib.IsBot; + var LastBotScanAt = 0; // 人机扫描节流(约每 0.3 秒一次) // ===== 热点优化:相机基每帧只算一次(避免逐顶点重复三角函数 + 对象分配)===== var Cam = { @@ -901,7 +904,13 @@ var tankList = gm.q100_1.r11l(); var count = tankList.e1(); - var drawnCount = 0; + var drawnCount = 0, botDrawn = 0; + + // 人机扫描(装备分数不会每帧变,节流到约每 0.3 秒一次) + if (ScanBots && (Date.now() - LastBotScanAt > 300)) { + LastBotScanAt = Date.now(); + ScanBots(); + } for (var i = 0; i < count; i++) { var tank = tankList.g1(i); @@ -1000,6 +1009,24 @@ DrawTankMarker(ctx, pos, camInfo, screenW, screenH, color); } + // 人机标记:坦克上方写「人机」(同队装备分数相同且 < 8000) + if (typeof IsBot === 'function' && IsBot(tank)) { + var botPt = Project3D({ x: pos.x, y: pos.y, z: pos.z + 1300 }, + camInfo.pos, camInfo.yaw, camInfo.pitch, camInfo.fov, screenW, screenH); + if (botPt) { + ctx.save(); + ctx.font = 'bold 13px Consolas,monospace'; + ctx.textAlign = 'center'; + ctx.lineWidth = 3; + ctx.strokeStyle = 'rgba(0,0,0,0.85)'; + ctx.strokeText('人机', botPt.x, botPt.y); // 先描黑边,保证任何背景下都看得清 + ctx.fillStyle = '#ffd24a'; + ctx.fillText('人机', botPt.x, botPt.y); + ctx.restore(); + botDrawn++; + } + } + drawnCount++; }