feat(match): 同步比赛计时与装甲板扣血许可
- 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:
581 files changed
+6596
-7683
No files matched your search
@@ -0,0 +1,79 @@
|
||||
/** 用户端保留取景画面、血量和链路读数;调整入口统一放在 ESC 菜单。 */
|
||||
import { useState } from "react";
|
||||
import { IDENTITY_VIEW, VideoSurface, type ViewTransform } from "../components/VideoSurface";
|
||||
import { HealthBar, healthTag } from "../components/HealthBar";
|
||||
import { HitFlash } from "../components/HitFlash";
|
||||
import { MatchBanner } from "../components/MatchBanner";
|
||||
import { TeamMatchClock, TeamMatchCountdown } from "../components/MatchClock";
|
||||
import { firmwareLabel, teamName, idText } from "../lib/format";
|
||||
import { useAppStore } from "../lib/store";
|
||||
import { BUILD } from "../lib/version";
|
||||
import type { HudView, Snapshot } from "../lib/types";
|
||||
|
||||
interface Props {
|
||||
snapshot: Snapshot;
|
||||
hud: HudView;
|
||||
calibrating: boolean;
|
||||
onCalibrate: (dxFraction: number, dyFraction: number) => void;
|
||||
}
|
||||
|
||||
export function TeamPage({ snapshot, hud, calibrating, onCalibrate }: Props) {
|
||||
const [view, setView] = useState<ViewTransform>(IDENTITY_VIEW);
|
||||
const { lastHit, connected } = useAppStore();
|
||||
const camera = snapshot.config.cameraId;
|
||||
const stats = snapshot.stats.find(entry => entry.camera === camera);
|
||||
const boundCamera = snapshot.cameras.find(entry => entry.id === camera);
|
||||
const board = snapshot.armorBoards.find(entry => entry.id === snapshot.config.armorId);
|
||||
const mine = snapshot.health.find(entry => entry.team === snapshot.team) ?? null;
|
||||
const theirs = snapshot.health.find(entry => entry.team !== snapshot.team) ?? null;
|
||||
const myName = mine?.name ?? teamName(snapshot.team, snapshot.config.teamNames);
|
||||
const theirName = theirs?.name ?? teamName(snapshot.team === 0 ? 1 : 0, snapshot.config.teamNames);
|
||||
const cameraLive = connected && !!boundCamera?.online && !!stats?.online && boundCamera.compatible;
|
||||
const armorLive = connected && !!board?.online && board.team === snapshot.team;
|
||||
const cameraState = camera === null ? "未绑定" : !connected ? "服务断开" : boundCamera && !boundCamera.compatible ? "协议不匹配" : cameraLive ? (stats?.hasFrames ? "接收中" : "等待画面") : "离线";
|
||||
const armorState = snapshot.config.armorId === null ? "未绑定" : !connected ? "服务断开" : board?.team === 255 ? "等待队伍设置" : board && board.team !== snapshot.team ? "队伍不符" : armorLive ? "在线" : "离线";
|
||||
const hitIsMine = Boolean(lastHit && (mine?.board != null ? lastHit.board === mine.board : lastHit.team === snapshot.team));
|
||||
const pulse = hitIsMine && lastHit ? { seq: lastHit.seq, damage: lastHit.damage, at: lastHit.receivedAt } : null;
|
||||
// 两侧各自使用独立列;放大血条也不能跨过中线压住对方。
|
||||
const healthConfig = { ...hud.health, width: Math.min(1, hud.health.width * 2) };
|
||||
const hasVideo = cameraLive && !!stats?.hasFrames;
|
||||
const emptyText = camera === null ? "未绑定图传板 · 按 ESC 配置"
|
||||
: !connected ? "本机服务断开,正在重连"
|
||||
: !boundCamera ? "尚未发现绑定的图传板 · 按 ESC 检查设备"
|
||||
: !boundCamera.compatible ? "图传协议不匹配 · 按 ESC 检查固件"
|
||||
: !cameraLive ? "图传板离线,等待重新连接"
|
||||
: !stats?.hasFrames ? "已连接,等待画面" : "";
|
||||
|
||||
return <div className="op cockpit">
|
||||
<div className="op__stage">
|
||||
<VideoSurface camera={camera} label="" emptyText={emptyText} signalLost={!hasVideo}
|
||||
mirrored={snapshot.mirrored} crosshair={hasVideo ? hud.crosshair : null} grid={hasVideo ? hud.grid : null} view={view} onView={setView}
|
||||
calibrating={calibrating} onCalibrate={calibrating ? onCalibrate : undefined} hit={pulse} hitFeedback={hud.hitFeedback} showZoom={hud.showZoom} showResetControl={false}>
|
||||
<div className="cockpit__overlay">
|
||||
<div className="cockpit__health">
|
||||
{hud.health.visible && mine && <div className="cockpit__health-side"><HealthBar health={mine} config={healthConfig} align="left" tag={healthTag(mine, snapshot.team)} /></div>}
|
||||
<TeamMatchClock snapshot={snapshot} />
|
||||
{hud.health.visible && theirs && <div className="cockpit__health-side cockpit__health-side--right"><HealthBar health={theirs} config={healthConfig} align="right" tag={healthTag(theirs, snapshot.team)} /></div>}
|
||||
</div>
|
||||
<div className="cockpit__header">
|
||||
<div className="cockpit__identity"><span className="label">RMIC / OPERATOR</span><span title={myName}>{myName}</span>{snapshot.demo && <b>演示 · 合成数据</b>}</div>
|
||||
<div className="cockpit__links" aria-label="连接状态">
|
||||
<span className={cameraLive ? "is-live" : "is-offline"}><i />图传 <b>{cameraState}</b></span>
|
||||
<span className={armorLive ? "is-live" : "is-offline"}><i />装甲板 <b>{armorState}</b></span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="cockpit__frame" aria-hidden="true"><i /><i /><i /><i /></div>
|
||||
<div className="cockpit__telemetry">
|
||||
<div className="cockpit__feed"><span className="label">VIDEO SOURCE</span><strong className="num">{camera === null ? "NO BINDING" : boundCamera?.idText ?? idText(camera)}</strong><span>{cameraLive && stats?.hasFrames ? `${stats.width} × ${stats.height}${snapshot.mirrored ? " / 镜像" : ""}` : "等待图传连接"}</span></div>
|
||||
<div className="cockpit__fps"><span className="label">RECEIVE / FPS</span><strong className="num">{cameraLive && stats?.hasFrames ? stats.fps.toFixed(1) : "—"}</strong>{hud.showStats && snapshot.diagnostics && <span>丢包 {cameraLive && stats?.hasFrames ? `${stats.lossPercent.toFixed(1)}%` : "—"}</span>}</div>
|
||||
</div>
|
||||
<div className="cockpit__footer"><span><kbd>ESC</kbd> 菜单 / 设置</span><span className="num">{calibrating ? "瞄准校准中" : hud.showZoom ? `OPTICAL ×${view.zoom.toFixed(1)}` : ""}</span><span>{snapshot.config.armorId === null ? "ARMOR / —" : `ARMOR / ${board?.idText ?? idText(snapshot.config.armorId)}`}</span></div>
|
||||
</div>
|
||||
<MatchBanner outcome={mine?.outcome ?? null} mine={myName} theirs={theirName} detail={mine?.outcome === "defeat" && theirs?.hp != null ? `对手剩余 ${theirs.hp}` : mine?.outcome === "victory" && mine?.hp != null ? `剩余 ${mine.hp}` : undefined} />
|
||||
<HitFlash hit={lastHit} config={hud.hitFeedback} relevant={hitIsMine} />
|
||||
<TeamMatchCountdown snapshot={snapshot} />
|
||||
{boundCamera && !boundCamera.compatible && <div className="fwfault" role="alert"><span className="fwfault__tag label">协议不匹配</span><span className="fwfault__text">图传固件 {firmwareLabel(boundCamera)} · 协议 {boundCamera.protocol} / 客户端 {BUILD.protocol}。按 ESC 进入固件维护。</span></div>}
|
||||
</VideoSurface>
|
||||
</div>
|
||||
</div>;
|
||||
}
|
||||
Reference in new issue
Block a user