feat(client): 锁定终局结果并接入 Windows 签名构建
构建客户端 / 检查(类型 + 单元测试) (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

- fix(match): 首次归零结束对局并撤销双方扣血许可,裁判结果同步后不再改判

- fix(hud): 蓝方低血量始终保留队伍颜色

- build(windows): 校验代码签名身份和时间戳,明确标注未签名测试包

- docs(version): 说明发布标签基线与语义版本迭代
This commit is contained in:
sloray committed 2026-10-31 10:18:09 +08:00
1 parent 338efa5c2e
commit dac763eb3e
26 files changed
+823 -229

No files matched your search

+22 -2
View File
@@ -120,6 +120,7 @@ interface PreviewState {
recordings: { camera: number; frames: number; startedMs: number }[];
hp: [number, number];
matchControlled: boolean;
finalOutcomes: ["victory" | "defeat" | "draw" | null, "victory" | "defeat" | "draw" | null] | null;
}
const state: PreviewState = {
@@ -138,8 +139,22 @@ const state: PreviewState = {
recordings: [],
hp: [100, 100],
matchControlled: new URLSearchParams(location.search).has("match"),
finalOutcomes: null,
};
if (new URLSearchParams(location.search).get("match") === "finished") state.hp = [0, 76];
if (new URLSearchParams(location.search).get("match") === "finished") {
state.hp = [0, 76]; state.finalOutcomes = ["defeat", "victory"];
}
if (new URLSearchParams(location.search).get("health") === "blue-low") {
state.hp = [73, 10]; state.matchControlled = true;
}
function finishPreviewKnockout() {
const clock = previewMatch();
if (state.finalOutcomes || !state.matchControlled || (clock.phase !== "running" && !(clock.phase === "paused" && clock.resumePhase === "running")) || !state.hp.includes(0)) return;
state.finalOutcomes = state.hp[0] === 0 && state.hp[1] === 0 ? ["draw", "draw"]
: state.hp[0] === 0 ? ["defeat", "victory"] : ["victory", "defeat"];
previewMatchAction({ type: "end" });
}
// ---------------------------------------------------------------------------
// 假的命令实现
@@ -156,9 +171,10 @@ function handle(command: string, args: Record<string, unknown>): unknown {
case "match_action": {
if (state.role !== "referee") throw new Error("只有裁判端可以控制比赛计时");
const action = args.action as MatchAction;
if (action.type === "prepare" && state.finalOutcomes) throw new Error("请先重置本局");
previewMatchAction(action);
state.matchControlled = true;
if (action.type === "reset") state.hp = [100, 100];
if (action.type === "reset") { state.hp = [100, 100]; state.finalOutcomes = null; }
return;
}
case "release_match_source": return;
@@ -304,6 +320,7 @@ function hex(id: number): string {
}
function snapshot(): Snapshot {
finishPreviewKnockout();
const cameraOffline = videoOffline();
const cameras = [
{ id: CAMERA_A, team: 0 },
@@ -356,6 +373,8 @@ function snapshot(): Snapshot {
// 与后端 `cam_core::snapshot::resolve_outcomes` 同一套规则,包括那条不对称:
// 输只看自己,赢要看对手归零**且**自己还活着。
const outcomeFor = (team: number) => {
if (state.finalOutcomes) return state.finalOutcomes[team];
if (state.matchControlled && previewMatch().phase === "finished") return null;
const mine = state.hp[team];
const theirs = state.hp[team === 0 ? 1 : 0];
@@ -480,6 +499,7 @@ export function startPreview(client: StreamClient, emit: (msg: WireMsg) => void)
const damage = 3 + ((tick * 7) % 20);
const to = Math.max(0, from - damage);
state.hp[team] = to;
finishPreviewKnockout();
emit({
t: "hit",