feat(control): 添加选手 FPS 键鼠操作与 C3 用户 UART 输出
构建客户端 / 检查(类型 + 单元测试) (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

This commit is contained in:
sloray committed 2026-10-31 18:34:30 +08:00
1 parent aea1cf60ae
commit 38410bacd4
43 files changed
+2389 -77

No files matched your search

+8 -3
View File
@@ -9,17 +9,21 @@ import { firmwareLabel, teamName, idText } from "../lib/format";
import { useAppStore } from "../lib/store";
import { BUILD } from "../lib/version";
import type { HudView, Snapshot } from "../lib/types";
import { useOperatorControl } from "../lib/use-operator-control";
import { OperatorControls } from "../components/OperatorControls";
interface Props {
snapshot: Snapshot;
hud: HudView;
calibrating: boolean;
controlsBlocked: boolean;
onCalibrate: (dxFraction: number, dyFraction: number) => void;
}
export function TeamPage({ snapshot, hud, calibrating, onCalibrate }: Props) {
export function TeamPage({ snapshot, hud, calibrating, controlsBlocked, onCalibrate }: Props) {
const [view, setView] = useState<ViewTransform>(IDENTITY_VIEW);
const { lastHit, connected } = useAppStore();
const control = useOperatorControl({ snapshot, connected, blocked: controlsBlocked || calibrating });
const camera = snapshot.config.cameraId;
const stats = snapshot.stats.find(entry => entry.camera === camera);
const boundCamera = snapshot.cameras.find(entry => entry.id === camera);
@@ -45,10 +49,10 @@ export function TeamPage({ snapshot, hud, calibrating, onCalibrate }: Props) {
: !stats?.hasFrames ? "已连接,等待画面" : "";
return <div className="op cockpit">
<div className="op__stage">
<div className="op__stage" ref={control.target}>
<VideoSurface camera={camera} label="" emptyText={emptyText} signalLost={!hasVideo}
mirrored={snapshot.mirrored} mirroredVertical={snapshot.mirroredVertical} 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}>
calibrating={calibrating} inputCaptured={control.activeMode !== null || control.pending} 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>}
@@ -72,6 +76,7 @@ export function TeamPage({ snapshot, hud, calibrating, onCalibrate }: Props) {
<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} />
<OperatorControls control={control} snapshot={snapshot} connected={connected} blocked={controlsBlocked || calibrating} />
{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>