feat(match): 同步比赛计时与装甲板扣血许可
构建客户端 / 检查(类型 + 单元测试) (push) Canceled after 0s
构建客户端 / Linux x64(deb + AppImage) (push) Canceled after 0s
构建客户端 / Windows x64(NSIS 安装包) (push) Canceled after 0s
构建客户端 / macOS 通用(.app + .dmg) (push) Canceled after 0s

- feat(client): 增加裁判比赛计时、技术暂停与选手端局域网同步
- feat(armor): 红蓝共用通用固件,按客户端选队并显示网络连接状态
- feat(armor): 仅在对局进行中允许扣血,其他阶段保留受击闪烁
- feat(client): 将计时置于血条中间并增加开赛前五秒全屏动画
- fix(client): 修复连续血条、对手镜像和图传断连灰度遮罩
- fix(client): 统一界面中文字体并整理各页面文案
- fix(maintenance): 备份迁移装甲板分区,恢复 SDK 构建与固件打包
- refactor(repo): 按 armor、vt 和 client 整理工程与脚本,移除旧参考实现
- test: 补充线路、受击许可、回环 UDP、维护和 HUD 验证
- docs: 同步构建、协议、比赛控制和硬件验证边界

验证:前端构建与 19 项相关测试通过;核心 91 项单元测试与 2 项回环 UDP 集成测试通过;装甲板规则 25 项、线路 26 项、Tauri 51 项测试通过;独立探测器 5 项与目录回归 4 项通过。完成 C3 两组阈值实际编译、导出与 ZIP 校验,检查 900×600 / 1280×720 页面、倒计时和随包中文字体。
未执行烧录、板上运行、跨电脑广播或硬件稳定性验证。
This commit is contained in:
sloray committed 2026-10-22 17:08:49 +08:00
1 parent 72901939c6
commit f7ca246b68
581 files changed
+6596 -7683

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
// Exercise the production StreamClient against native hardware video, while
// deliberately stalling only this auxiliary local consumer. Adds no UDP peer.
// Bitmap decoding is stubbed here; actual JPEG decoding is checked separately.
import {readFileSync,writeFileSync} from 'node:fs';
import assert from 'node:assert/strict';
import ts from 'typescript';
const [logPath,outPath]=process.argv.slice(2);
if(!logPath||!outPath)throw new Error('Use <private native debug log> <result JSON>');
const log=readFileSync(logPath,'utf8');
const url=[...log.matchAll(/ws:\/\/127\.0\.0\.1:\d+\/\?token=[A-Za-z0-9_-]+/g)].at(-1)?.[0];
if(!url)throw new Error('No local video URL in the private debug log');
const source=readFileSync(new URL('../src/lib/stream.ts',import.meta.url),'utf8');
const compiled=ts.transpileModule(source,{compilerOptions:{module:ts.ModuleKind.CommonJS,target:ts.ScriptTarget.ES2022}}).outputText;
const exports={};new Function('require','exports',compiled)(()=>({FRAME_HEADER_LEN:16}),exports);
globalThis.window={setTimeout,clearTimeout};
globalThis.createImageBitmap=async()=>({close(){}});
const rx=new exports.StreamClient({onMessage(){},onConnection(){}});
const delay=ms=>new Promise(resolve=>setTimeout(resolve,ms));
try {
rx.connect(url);
const deadline=performance.now()+10_000;
while(rx.counters.frames<10&&performance.now()<deadline)await delay(30);
assert.ok(rx.counters.frames>=10,'Real native JPEG video did not arrive');
const camera=[...rx.frames.keys()][0];
const before=rx.latest(camera)?.frameId;
const staleBefore=rx.counters.staleFrames;
const blockedAt=performance.now();
while(performance.now()-blockedAt<350) { /* synthetic consumer stall */ }
await delay(700);
const latest=rx.latest(camera);
assert.ok(rx.counters.staleFrames>staleBefore,'Stale native-timestamped frames were not rejected');
assert.ok(latest&&latest.frameId!==before,'The consumer did not recover to new video');
assert.ok(performance.now()-latest.receivedAt<150,'Recovered image is still stale locally');
const result={passed:true,stall_ms:350,stale_frames_rejected:rx.counters.staleFrames-staleBefore,
frame_before:before,frame_after:latest.frameId,frames_received:rx.counters.frames,
additional_udp_subscribers:0,jpeg_decoder_stubbed:true,
scope:'Production StreamClient over real native WebSocket; tests queued-frame age and recovery, not physical display latency'};
writeFileSync(outPath,JSON.stringify(result,null,2)+'\n');
console.log(JSON.stringify(result));
} finally {rx.close();}