fix(client): 修复双实例镜像同步并调整底部工具布局
This commit is contained in:
36 files changed
+274
-88
No files matched your search
@@ -30,6 +30,7 @@ pub mod armor;
|
||||
pub mod armor_reset;
|
||||
pub mod config;
|
||||
pub mod camera_mirror;
|
||||
pub mod mirror_transport;
|
||||
pub mod match_clock;
|
||||
pub mod operator;
|
||||
pub mod password;
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
//! 镜像使用独立的组播监听。同机多实例均可收到消息,不争用装甲板单播回执端口。
|
||||
use std::net::{Ipv4Addr, SocketAddrV4, UdpSocket};
|
||||
use std::time::Duration;
|
||||
pub const GROUP: Ipv4Addr = Ipv4Addr::new(239, 255, 56, 2);
|
||||
pub const PORT: u16 = 5602;
|
||||
pub fn bind() -> std::io::Result<UdpSocket> {
|
||||
let socket = socket2::Socket::new(
|
||||
socket2::Domain::IPV4,
|
||||
socket2::Type::DGRAM,
|
||||
Some(socket2::Protocol::UDP),
|
||||
)?;
|
||||
socket.set_reuse_address(true)?;
|
||||
socket.bind(&SocketAddrV4::new(Ipv4Addr::UNSPECIFIED, PORT).into())?;
|
||||
let socket: UdpSocket = socket.into();
|
||||
socket.join_multicast_v4(&GROUP, &Ipv4Addr::UNSPECIFIED)?;
|
||||
socket.set_multicast_loop_v4(true)?;
|
||||
socket.set_multicast_ttl_v4(1)?;
|
||||
socket.set_read_timeout(Some(Duration::from_millis(200)))?;
|
||||
socket.set_write_timeout(Some(Duration::from_millis(10)))?;
|
||||
Ok(socket)
|
||||
}
|
||||
pub fn spawn(
|
||||
socket: UdpSocket,
|
||||
sink: impl Fn(protocol::CameraMirror) + Send + 'static,
|
||||
) -> std::io::Result<()> {
|
||||
std::thread::Builder::new()
|
||||
.name("mirror-reader".into())
|
||||
.spawn(move || {
|
||||
let mut bytes = [0u8; 128];
|
||||
loop {
|
||||
match socket.recv_from(&mut bytes) {
|
||||
Ok((len, _)) => {
|
||||
if let Some(packet) = protocol::CameraMirror::decode(&bytes[..len]) {
|
||||
sink(packet);
|
||||
}
|
||||
}
|
||||
Err(e)
|
||||
if matches!(
|
||||
e.kind(),
|
||||
std::io::ErrorKind::TimedOut | std::io::ErrorKind::WouldBlock
|
||||
) => {}
|
||||
Err(_) => std::thread::sleep(Duration::from_millis(200)),
|
||||
}
|
||||
}
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
+2
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "rmic-2026",
|
||||
"private": true,
|
||||
"version": "0.6.0",
|
||||
"version": "0.6.1",
|
||||
"type": "module",
|
||||
"description": "RMIC::2026 —— ESP32 图传与装甲板系统的桌面端:用户端(装甲条 + 瞄准器)与裁判端(双路 + 装甲板 + 录制)",
|
||||
"scripts": {
|
||||
@@ -17,6 +17,7 @@
|
||||
"test:stream": "node --test scripts/test-stream.mjs",
|
||||
"test:latency": "node --test scripts/test-latency-marker.mjs",
|
||||
"test:match": "node --test scripts/test-match-clock.mjs",
|
||||
"test:mirror-instances": "node scripts/test-mirror-instances.mjs",
|
||||
"test:input": "node --test scripts/test-operator-input.mjs",
|
||||
"test:video": "node --test scripts/test-video-transform.mjs scripts/test-operator-hud.mjs",
|
||||
"test:maintenance": "node --test scripts/test-maintenance.mjs"
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import {spawn} from 'node:child_process';
|
||||
import assert from 'node:assert/strict';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import net from 'node:net';
|
||||
const repo=fileURLToPath(new URL('../../',import.meta.url));
|
||||
const folder=path.join(repo,'target',`mirror-instances-${Date.now()}-${process.pid}`);
|
||||
const exe=process.argv[2] ? path.resolve(process.argv[2]) : path.join(repo,'client/src-tauri/target/x86_64-pc-windows-msvc/debug/cam-desktop.exe');
|
||||
await fs.access(exe);await fs.mkdir(folder,{recursive:true});
|
||||
await fs.writeFile(path.join(folder,'team.toml'),'role = "team"\nroleChosen = false\ncameraId = "0x0DE00001"\nmirror = true\nmirrorVertical = false\n');
|
||||
await fs.writeFile(path.join(folder,'referee.toml'),'role = "referee"\nroleChosen = false\nmirror = true\nmirrorVertical = false\n[referee]\nmanualSlots = true\nslotA = "0x0DE00001"\nslotB = "0x0DE00002"\n');
|
||||
const freePort=()=>new Promise((resolve,reject)=>{const s=net.createServer();s.on('error',reject);s.listen(0,'127.0.0.1',()=>{const port=s.address().port;s.close(()=>resolve(port));});});
|
||||
const ports={team:await freePort(),referee:await freePort()};
|
||||
const pids={};
|
||||
const clients={};const results=[];const pause=ms=>new Promise(r=>setTimeout(r,ms));
|
||||
async function connect(name){
|
||||
const port=ports[name];
|
||||
for(let attempt=0;attempt<80;attempt++)try{
|
||||
const tabs=await(await fetch(`http://127.0.0.1:${port}/json`)).json();
|
||||
const tab=tabs.find(t=>t.type==='page'&&!t.url.startsWith('devtools:'));
|
||||
if(!tab)throw Error('page loading');
|
||||
const ws=new WebSocket(tab.webSocketDebuggerUrl);await new Promise(r=>ws.addEventListener('open',r,{once:true}));
|
||||
let seq=0;const pending=new Map();ws.onmessage=e=>{const m=JSON.parse(e.data);if(m.id){pending.get(m.id)?.(m);pending.delete(m.id);}};
|
||||
const run=expression=>new Promise((resolve,reject)=>{const id=++seq;pending.set(id,m=>{if(m.error||m.result?.exceptionDetails)reject(Error(JSON.stringify(m)));else resolve(m.result.result.value);});ws.send(JSON.stringify({id,method:'Runtime.evaluate',params:{expression,awaitPromise:true,returnByValue:true}}));});
|
||||
clients[name]={ws,run,invoke:(command,args={})=>run(`window.__TAURI_INTERNALS__.invoke(${JSON.stringify(command)},${JSON.stringify(args)})`)};
|
||||
await clients[name].invoke('get_snapshot');return;
|
||||
}catch(e){if(attempt===79)throw e;await pause(250);}
|
||||
}
|
||||
const snap=name=>clients[name].invoke('get_snapshot');
|
||||
const set=(name,camera,mirror,mirrorVertical)=>clients[name].invoke('set_camera_mirror',{camera,mirror,mirrorVertical});
|
||||
const A=0x0de00001,B=0x0de00002;
|
||||
async function waitFor(check,label){for(let n=0;n<60;n++){if(await check()){results.push(label);return;}await pause(100);}throw Error(`Timeout: ${label}`);}
|
||||
async function agree(camera,mirror,vertical){const[a,b]=await Promise.all([snap('team'),snap('referee')]);const x=a.cameraMirrors[camera],y=b.cameraMirrors[camera];return !!x&&!!y&&x.revision===y.revision&&x.origin===y.origin&&x.mirror===y.mirror&&x.mirrorVertical===y.mirrorVertical&&(mirror===undefined||x.mirror===mirror)&&(vertical===undefined||x.mirrorVertical===vertical);}
|
||||
async function stop(name){clients[name]?.ws.close();try{process.kill(pids[name]);}catch{}await pause(800);}
|
||||
async function restart(name){
|
||||
const env={...process.env,WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS:`--remote-debugging-port=${ports[name]}`,WEBVIEW2_USER_DATA_FOLDER:path.join(folder,name+'-webview')};
|
||||
const child=spawn(exe,['--config',path.join(folder,name+'.toml')],{env,windowsHide:true,stdio:'ignore'});pids[name]=child.pid;
|
||||
await fs.writeFile(path.join(folder,'pids.json'),JSON.stringify(pids));await connect(name);
|
||||
}
|
||||
try{
|
||||
await Promise.all([restart('team'),restart('referee')]);
|
||||
for(const name of ['team','referee'])assert.equal((await snap(name)).config.roleChosen,false,'isolated fixtures must never broadcast official match states');
|
||||
assert.equal((await snap('referee')).slots.cameraA,A);assert.equal((await snap('referee')).slots.cameraB,B);
|
||||
await set('team',A,false,true);await waitFor(()=>agree(A,false,true),'player A → referee A');
|
||||
await set('referee',B,false,false);await pause(500);
|
||||
assert.equal((await snap('team')).cameraMirrors[B],undefined);assert.equal((await snap('referee')).cameraMirrors[A].mirrorVertical,true);results.push('B independent of A, player ignores unbound B');
|
||||
await set('referee',A,true,false);await waitFor(()=>agree(A,true,false),'referee A → player A');
|
||||
for(let n=0;n<12;n++){
|
||||
await Promise.all([set('team',A,false,!!(n%2)),set('referee',A,true,!(n%2))]);
|
||||
await waitFor(()=>agree(A),`concurrent edit ${n+1} converges`);
|
||||
}
|
||||
await stop('team');await set('referee',A,false,true);await restart('team');
|
||||
await waitFor(()=>agree(A,false,true),'player restart catches newer referee revision');
|
||||
await stop('referee');await set('team',A,true,false);await restart('referee');
|
||||
await waitFor(()=>agree(A,true,false),'referee restart catches newer player revision');
|
||||
assert.equal((await snap('referee')).cameraMirrors[B].mirror,false);results.push('B persists through referee restart');
|
||||
await stop('team');let config=await fs.readFile(path.join(folder,'team.toml'),'utf8');config=config.replace('cameraId = "0x0DE00001"','cameraId = "0x0DE00002"');await fs.writeFile(path.join(folder,'team.toml'),config);await restart('team');
|
||||
assert.equal((await snap('team')).config.cameraId,B);
|
||||
await set('team',B,true,true);await waitFor(()=>agree(B,true,true),'player rebound to B → referee B');
|
||||
assert.equal((await snap('referee')).cameraMirrors[A].mirror,true);assert.equal((await snap('referee')).cameraMirrors[A].mirrorVertical,false);
|
||||
await set('referee',B,false,true);await waitFor(()=>agree(B,false,true),'referee B → rebound player B');
|
||||
await stop('team');await stop('referee');await Promise.all([restart('team'),restart('referee')]);
|
||||
await waitFor(()=>agree(B,false,true),'both processes restart with consistent persisted state');
|
||||
const final={team:await snap('team'),referee:await snap('referee')};
|
||||
await fs.writeFile(path.join(folder,'report.json'),JSON.stringify({actualNativeProcesses:true,syntheticCameraIds:true,officialClockDisabled:true,results,finalMirrors:{team:final.team.cameraMirrors,referee:final.referee.cameraMirrors}},null,2));
|
||||
console.log(JSON.stringify({passed:results.length,report:path.join(folder,'report.json'),results},null,2));
|
||||
}finally{for(const name of ['team','referee'])await stop(name);}
|
||||
@@ -62,6 +62,7 @@ pub struct AppState {
|
||||
match_changed: tokio::sync::Notify,
|
||||
mirror_inbox: Mutex<cam_core::camera_mirror::CameraMirrors>,
|
||||
mirror_origin: u64,
|
||||
mirror_socket: Option<std::net::UdpSocket>,
|
||||
operator: Mutex<OperatorState>,
|
||||
operator_socket: Option<std::net::UdpSocket>,
|
||||
operator_focused: AtomicBool,
|
||||
@@ -119,6 +120,8 @@ impl AppState {
|
||||
Some(_) => return Err("只能修改已绑定或当前槽位的图传板".into()),
|
||||
None => targets,
|
||||
};
|
||||
// 先观察已收到但尚未应用的远端修订,避免紧接收到包后的本地点击被旧包覆盖。
|
||||
self.tick_mirrors();
|
||||
let mut config = self.config.lock().expect("config poisoned");
|
||||
let revision = config
|
||||
.camera_mirrors
|
||||
@@ -198,6 +201,19 @@ impl AppState {
|
||||
.collect();
|
||||
drop(config);
|
||||
if !self.demo {
|
||||
if let Some(socket) = &self.mirror_socket {
|
||||
for packet in &packets {
|
||||
if let Some(bytes) = packet.encode() {
|
||||
let _ = socket.send_to(
|
||||
&bytes,
|
||||
(
|
||||
cam_core::mirror_transport::GROUP,
|
||||
cam_core::mirror_transport::PORT,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(socket) = &self.match_socket {
|
||||
for packet in packets {
|
||||
if let Some(bytes) = packet.encode() {
|
||||
@@ -555,6 +571,13 @@ impl AppState {
|
||||
match_changed: tokio::sync::Notify::new(),
|
||||
mirror_inbox: Mutex::new(Default::default()),
|
||||
mirror_origin: session.max(1),
|
||||
mirror_socket: match cam_core::mirror_transport::bind() {
|
||||
Ok(socket) => Some(socket),
|
||||
Err(error) => {
|
||||
log::warn!("镜像组播不可用,保留 UDP 5601 广播同步:{error}");
|
||||
None
|
||||
}
|
||||
},
|
||||
operator: Mutex::new(OperatorState::new(session)),
|
||||
operator_socket,
|
||||
operator_focused: AtomicBool::new(true),
|
||||
@@ -585,6 +608,23 @@ impl AppState {
|
||||
///
|
||||
/// 必须在 `Arc<AppState>` 建好之后调用(sink 里要持有 state 的通道)。
|
||||
pub fn install_sinks(self: &Arc<Self>) {
|
||||
if !self.demo {
|
||||
if let Some(socket) = self.mirror_socket.as_ref().and_then(|s| s.try_clone().ok()) {
|
||||
let weak = Arc::downgrade(self);
|
||||
if let Err(error) = cam_core::mirror_transport::spawn(socket, move |packet| {
|
||||
if let Some(state) = weak.upgrade() {
|
||||
if state.mirror_targets().contains(&packet.camera_id) {
|
||||
cam_core::camera_mirror::merge(
|
||||
&mut state.mirror_inbox.lock().expect("mirror inbox poisoned"),
|
||||
packet,
|
||||
);
|
||||
}
|
||||
}
|
||||
}) {
|
||||
log::warn!("无法启动镜像组播接收:{error}");
|
||||
}
|
||||
}
|
||||
}
|
||||
let weak = Arc::downgrade(self);
|
||||
self.armor.set_mirror_sink(Arc::new(move |packet| {
|
||||
if let Some(state) = weak.upgrade() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "RMIC-2026",
|
||||
"version": "0.6.0",
|
||||
"version": "0.6.1",
|
||||
"identifier": "com.simbarobotics.rmic2026",
|
||||
"build": {
|
||||
"beforeDevCommand": "pnpm dev",
|
||||
|
||||
+2
-2
@@ -124,7 +124,7 @@ export default function App() {
|
||||
}, []);
|
||||
|
||||
const milestones = [
|
||||
{ key: "fonts", label: "加载字体", code: "HARMONYOS · JETBRAINS", done: fontsReady },
|
||||
{ key: "fonts", label: "加载字体", code: "HARMONYOS / JETBRAINS", done: fontsReady },
|
||||
{ key: "channel", label: "连接本机服务", code: "LOCAL IPC", done: url !== null },
|
||||
{ key: "snapshot", label: "读取运行状态", code: "SNAPSHOT 200ms", done: snapshot !== null },
|
||||
];
|
||||
@@ -375,7 +375,7 @@ export default function App() {
|
||||
if (!snapshot) {
|
||||
return (
|
||||
<div className="splash">
|
||||
<span className="splash__mark label">RMIC · 2026</span>
|
||||
<span className="splash__mark label">RMIC / 2026</span>
|
||||
<h1 className="splash__title">正在读取运行状态</h1>
|
||||
<p className="splash__text">
|
||||
{connected ? "已连接,等待状态数据…" : "正在连接本机服务…"}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Source: https://github.com/google/material-design-icons/tree/master/symbols/web
|
||||
// License and attribution ship in client/public/licenses/material-symbols/.
|
||||
export const materialPaths = {
|
||||
mirrorHorizontal: ["M450-840h60v720h-60v-720ZM100-240v-480l280 240L100-240Zm80-170 77-70-77-70v140Zm680 170L580-480l280-240v480Zm-80-170v-140l-77 70 77 70Z"],
|
||||
mirrorVertical: ["M120-510h720v60H120v-60Zm120-350 240 280 240-280H240Zm170 80h140l-70 77-70-77ZM240-100l240-280 240 280H240Zm170-80h140l-70-77-70 77Z"],
|
||||
close: ["M480-424 284-228q-11 11-28 11t-28-11q-11-11-11-28t11-28l196-196-196-196q-11-11-11-28t11-28q11-11 28-11t28 11l196 196 196-196q11-11 28-11t28 11q11 11 11 28t-11 28L536-480l196 196q11 11 11 28t-11 28q-11 11-28 11t-28-11L480-424Z"],
|
||||
back: ["m313-440 196 196q12 12 11.5 28T508-188q-12 11-28 11.5T452-188L188-452q-6-6-8.5-13t-2.5-15q0-8 2.5-15t8.5-13l264-264q11-11 27.5-11t28.5 11q12 12 12 28.5T508-715L313-520h447q17 0 28.5 11.5T800-480q0 17-11.5 28.5T760-440H313Z"],
|
||||
next: ["M647-440H200q-17 0-28.5-11.5T160-480q0-17 11.5-28.5T200-520h447L451-716q-12-12-11.5-28t12.5-28q12-11 28-11.5t28 11.5l264 264q6 6 8.5 13t2.5 15q0 8-2.5 15t-8.5 13L508-188q-11 11-27.5 11T452-188q-12-12-12-28.5t12-28.5l195-195Z"],
|
||||
|
||||
@@ -83,9 +83,9 @@ export function ArmorTable({ boards, slots, names, focusTeam = null }: Props) {
|
||||
{shown.map((board) => {
|
||||
const assigned =
|
||||
slots.armorA === board.id
|
||||
? `左 · ${teamName(0, names)}`
|
||||
? `左 / ${teamName(0, names)}`
|
||||
: slots.armorB === board.id
|
||||
? `右 · ${teamName(1, names)}`
|
||||
? `右 / ${teamName(1, names)}`
|
||||
: "未分配";
|
||||
const tone = silenceTone(board.online, board.silenceMs);
|
||||
|
||||
@@ -184,7 +184,7 @@ export function StatsLine({
|
||||
<span className={`dot ${stats.online ? "dot--live" : "dot--dead"}`} />
|
||||
<span className="statsline__status">{stats.status}</span>
|
||||
<span className="statsline__sep" aria-hidden="true" />
|
||||
<span className="statsline__nums num">{parts.join(" · ")}</span>
|
||||
<span className="statsline__nums num">{parts.join(" / ")}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -34,7 +34,7 @@ export function Boot({ milestones, progress, fatal, leaving = false, onRetry, on
|
||||
|
||||
<div className="boot__frame">
|
||||
<div className="boot__eyebrow label">
|
||||
<span>{preview ? "合成预览 · 启动动画" : "SIMBA ROBOTICS"}</span>
|
||||
<span>{preview ? "合成预览 / 启动动画" : "SIMBA ROBOTICS"}</span>
|
||||
<span className="num">{VERSION_LABEL}</span>
|
||||
{onCancel && <button type="button" className="boot__close" onClick={onCancel} title="退出启动" aria-label="退出启动"><Icon name="close" /></button>}
|
||||
</div>
|
||||
@@ -80,7 +80,7 @@ export function Boot({ milestones, progress, fatal, leaving = false, onRetry, on
|
||||
</div>
|
||||
<div className="boot__meta">
|
||||
<span className="label">
|
||||
{progress >= 1 ? "加载完成 · 正在进入" : "正在加载"}
|
||||
{progress >= 1 ? "加载完成 / 正在进入" : "正在加载"}
|
||||
</span>
|
||||
<span className="num boot__pct">
|
||||
{Math.round(Math.max(0, Math.min(1, progress)) * 100)}
|
||||
|
||||
@@ -12,7 +12,7 @@ export function BootPreview({ failed }: { failed: boolean }) {
|
||||
return <Boot
|
||||
preview
|
||||
milestones={[
|
||||
{ key: "fonts", label: "加载字体", code: "HARMONYOS · JETBRAINS", done: completed >= 1 },
|
||||
{ key: "fonts", label: "加载字体", code: "HARMONYOS / JETBRAINS", done: completed >= 1 },
|
||||
{ key: "channel", label: "连接本机服务", code: "LOCAL IPC", done: completed >= 2 },
|
||||
{ key: "snapshot", label: "读取运行状态", code: "SNAPSHOT 200ms", done: completed >= 3 },
|
||||
]}
|
||||
|
||||
@@ -50,6 +50,6 @@ export function DeviceDiagram({ kind, identified, portAvailable, active, failed,
|
||||
<g className="device-diagram__computer"><rect x="28" y="142" width="82" height="58" rx="4" /><path d="M69 201v14m-24 0h48m-44-45 10 8-10 8m18 0h19" /><circle className="device-diagram__led" cx="98" cy="153" r="3" /></g>
|
||||
<path className={`device-diagram__cable${portAvailable ? " is-present" : ""}`} d={`M112 171h38q20 0 20 20v97q0 20 20 20h${usbX - 208}q18 0 18-18v-4`} />
|
||||
{kind === "armor" ? <ArmorBoard /> : kind === "camera" ? <CameraBoard /> : <g className="device-diagram__board"><rect className="device-diagram__pcb" x="290" y="112" width="130" height="166" rx="8" /><text x="355" y="186" textAnchor="middle">USB</text><text className="device-diagram__sublabel" x="355" y="207" textAnchor="middle">选择维护对象</text><rect className="device-diagram__usb is-connected" x="339" y="267" width="32" height="20" rx="4" /></g>}
|
||||
<text className="device-diagram__caption" x="69" y="245" textAnchor="middle">CLIENT / USB</text><text className="device-diagram__caption" x="355" y="340" textAnchor="middle">{kind === "armor" ? "装甲板 · ESP32-C3" : kind === "camera" ? "图传板 · 右侧 USB 接入" : chip || "选择维护对象"}</text>
|
||||
<text className="device-diagram__caption" x="69" y="245" textAnchor="middle">CLIENT / USB</text><text className="device-diagram__caption" x="355" y="340" textAnchor="middle">{kind === "armor" ? "装甲板 / ESP32-C3" : kind === "camera" ? "图传板 / 右侧 USB 接入" : chip || "选择维护对象"}</text>
|
||||
</svg>;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ export function RolePicker({ onOpenMaintenance }: { onOpenMaintenance?: () => vo
|
||||
<span className="gate__brand">
|
||||
RMIC<span className="gate__slash">::</span>2026
|
||||
</span>
|
||||
<span className="gate__phase label">FIRST RUN · 选择运行模式</span>
|
||||
<span className="gate__phase label">FIRST RUN / 选择运行模式</span>
|
||||
</header>
|
||||
|
||||
<div className="gate__lede">
|
||||
@@ -174,7 +174,7 @@ export function SetupPassword({ onOpenMaintenance }: { onOpenMaintenance?: () =>
|
||||
<span className="gate__brand">
|
||||
RMIC<span className="gate__slash">::</span>2026
|
||||
</span>
|
||||
<span className="gate__phase label">OPERATOR · 现场密码</span>
|
||||
<span className="gate__phase label">OPERATOR / 现场密码</span>
|
||||
</header>
|
||||
|
||||
<div className="gate__lede">
|
||||
|
||||
@@ -39,9 +39,9 @@ const WORD: Record<MatchOutcome, string> = {
|
||||
};
|
||||
|
||||
const CODE: Record<MatchOutcome, string> = {
|
||||
victory: "MATCH · WIN",
|
||||
defeat: "MATCH · LOSS",
|
||||
draw: "MATCH · DRAW",
|
||||
victory: "MATCH / WIN",
|
||||
defeat: "MATCH / LOSS",
|
||||
draw: "MATCH / DRAW",
|
||||
};
|
||||
|
||||
export function MatchBanner({ outcome, mine, theirs, detail }: Props) {
|
||||
|
||||
@@ -17,11 +17,11 @@ function useClock(view: MatchClockView) {
|
||||
function Readout({ clock, names }: { clock: MatchClockView; names: string[] }) {
|
||||
const paused = clock.phase === "paused";
|
||||
const expired = paused && clock.pauseKind === "player" && clock.pauseRemainingMs === 0;
|
||||
const label = !paused ? MATCH_PHASE[clock.phase] : clock.pauseKind === "player" ? `选手技术暂停 · ${names[clock.applicant ?? 0]}` : "官方技术暂停";
|
||||
const label = !paused ? MATCH_PHASE[clock.phase] : clock.pauseKind === "player" ? `选手技术暂停 / ${names[clock.applicant ?? 0]}` : "官方技术暂停";
|
||||
return <div className={`match-readout${paused ? " is-paused" : ""}${!clock.connected ? " is-stale" : ""}`}>
|
||||
<div className="match-readout__phase"><i />{label}</div>
|
||||
<div className="match-readout__digits num">{paused ? matchTime(clock.pauseRemainingMs ?? clock.pauseElapsedMs, clock.pauseKind === "official") : clock.phase === "idle" ? "—:—" : matchTime(clock.remainingMs)}</div>
|
||||
<div className="match-readout__detail">{!clock.connected ? clock.source ? "计时同步中断 · 已冻结" : "等待裁判计时同步" : expired ? "暂停时间已到 · 等待裁判恢复" : paused ? `${clock.pauseKind === "official" ? "暂停已用时" : "暂停剩余"} · 暂停前剩余 ${matchTime(clock.remainingMs)}` : clock.phase === "running" || clock.phase === "finished" ? `对局已用时 ${matchTime(clock.elapsedMs, true)}` : clock.phase === "ready" ? "等待裁判确认开赛" : clock.phase === "countdown" ? "倒计时结束后开始对局" : "准备 3 分钟 / 对局 3 分钟"}</div>
|
||||
<div className="match-readout__detail">{!clock.connected ? clock.source ? "计时同步中断 / 已冻结" : "等待裁判计时同步" : expired ? "暂停时间已到 / 等待裁判恢复" : paused ? `${clock.pauseKind === "official" ? "暂停已用时" : "暂停剩余"} / 暂停前剩余 ${matchTime(clock.remainingMs)}` : clock.phase === "running" || clock.phase === "finished" ? `对局已用时 ${matchTime(clock.elapsedMs, true)}` : clock.phase === "ready" ? "等待裁判确认开赛" : clock.phase === "countdown" ? "倒计时结束后开始对局" : "准备 3 分钟 / 对局 3 分钟"}</div>
|
||||
{paused && <p className="match-readout__reason" title={clock.reason}>{clock.reason}</p>}
|
||||
</div>;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ export function RefereeMatchControl({ snapshot, onError }: { snapshot: Snapshot;
|
||||
const openPause = (kind: "player" | "official") => { setReason(""); setApproved(false); setDialog(kind); };
|
||||
const reasonValid = reason.trim().length > 0 && new TextEncoder().encode(reason.trim()).length <= 192 && !/[\u0000-\u001f\u007f]/.test(reason);
|
||||
return <section className="match-control" aria-label="裁判比赛计时控制">
|
||||
<div className="match-control__identity"><span className="label">MATCH CONTROL</span><span>{snapshot.demo ? "本机演示 · 合成计时" : "裁判计时 / 局域网同步"}</span>{!snapshot.demo && <small className={snapshot.matchClock.syncError ? "is-error" : ""}>{snapshot.matchClock.syncError ?? "仅对局进行中扣血;准备与暂停时只闪灯"}</small>}</div>
|
||||
<div className="match-control__identity"><span className="label">MATCH CONTROL</span><span>{snapshot.demo ? "本机演示 / 合成计时" : "裁判计时 / 局域网同步"}</span>{!snapshot.demo && <small className={snapshot.matchClock.syncError ? "is-error" : ""}>{snapshot.matchClock.syncError ?? "仅对局进行中扣血;准备与暂停时只闪灯"}</small>}</div>
|
||||
<Readout clock={clock} names={snapshot.config.teamNames} />
|
||||
<div className="match-control__actions">
|
||||
{canReset ? <>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import type { Snapshot } from "../lib/types";
|
||||
import { operatorGate, type useOperatorControl } from "../lib/use-operator-control";
|
||||
import { Icon } from "./Icon";
|
||||
import { Slider } from "./controls";
|
||||
import { OperatorMapping } from "./OperatorMapping";
|
||||
|
||||
@@ -20,14 +21,14 @@ export function OperatorControls({ control, snapshot, connected, blocked }: {
|
||||
return <>
|
||||
<section ref={root} className="operator-controls" aria-label="机器人操作" onPointerDown={event => event.stopPropagation()} onWheel={event => event.stopPropagation()} onDoubleClick={event => event.stopPropagation()} onKeyDown={event => { if (open && event.key === "Escape") {event.stopPropagation();setOpen(false);} }}>
|
||||
<button className="btn operator-controls__toggle" role="switch" aria-checked={control.activeMode !== null} aria-expanded={open} aria-controls="operator-submenu" disabled={blocked || control.pending} onClick={() => control.activeMode ? control.stop() : setOpen(!open)}>
|
||||
<i className={control.activeMode ? "is-on" : ""} />{control.activeMode === "debug" ? "调试发送" : control.activeMode ? "操控发送" : "操控"}<span>{control.activeMode ? "ESC" : open ? "−" : "+"}</span>
|
||||
<Icon name="gamepad" />{control.activeMode === "debug" ? "调试发送" : control.activeMode ? "操控发送" : "操控"}{control.activeMode ? <kbd>ESC</kbd> : <Icon name="chevron" className={open ? "is-open" : ""} />}
|
||||
</button>
|
||||
{open && <div className="operator-controls__menu" id="operator-submenu">
|
||||
<div className="operator-controls__actions">
|
||||
<button className="btn" disabled={!!matchReason} title={matchReason ?? "WASD / 鼠标 / 左键"} onClick={() => {setOpen(false);control.start("match");}}>比赛操作</button>
|
||||
<button className="btn" disabled={!!debugReason} title={debugReason ?? "未开赛时发送调试输入"} onClick={() => {setOpen(false);control.start("debug");}}>赛前调试</button>
|
||||
<button className="btn" disabled={!!matchReason} title={matchReason ?? "WASD / 鼠标 / 左键"} onClick={() => {setOpen(false);control.start("match");}}><Icon name="play" />比赛操作</button>
|
||||
<button className="btn" disabled={!!debugReason} title={debugReason ?? "未开赛时发送调试输入"} onClick={() => {setOpen(false);control.start("debug");}}><Icon name="build" />赛前调试</button>
|
||||
</div>
|
||||
<label className="operator-controls__sensitivity"><span>鼠标灵敏度 · 本次</span><Slider min={0.25} max={4} step={0.25} value={control.sensitivity} onChange={control.setSensitivity} format={value => `×${value.toFixed(2)}`} /></label>
|
||||
<label className="operator-controls__sensitivity"><span>鼠标灵敏度(本次)</span><Slider min={0.25} max={4} step={0.25} value={control.sensitivity} onChange={control.setSensitivity} format={value => `×${value.toFixed(2)}`} /></label>
|
||||
{matchReason && debugReason && <small>{debugReason}</small>}
|
||||
{snapshot.demo && <small>合成预览</small>}
|
||||
{control.error && <small role="alert">{control.error}</small>}
|
||||
|
||||
@@ -16,6 +16,6 @@ export function OperatorMapping({ source, synthetic }: { source: RefObject<Opera
|
||||
<span>{input}</span><span>{id} / {label}</span><strong className="num">{value > 0 ? "+" : ""}{value}</strong>
|
||||
<div className="operator-mapping__track"><i style={{left: `${50 + Math.min(0, value / 20)}%`, width: `${Math.abs(value) / 20}%`} as CSSProperties} /><b /></div>
|
||||
</div>)}</div>
|
||||
<footer><span className={axes.fire ? "is-firing" : ""}>LMB → FIRE <b>{Number(axes.fire)}</b></span><span>±1000 · 速度比例</span><span>ESC 退出</span></footer>
|
||||
<footer><span className={axes.fire ? "is-firing" : ""}>LMB → FIRE <b>{Number(axes.fire)}</b></span><span>±1000 速度比例</span><span>ESC 退出</span></footer>
|
||||
</div>;
|
||||
}
|
||||
@@ -27,7 +27,7 @@ export function OperatorMenu({ snapshot, fullscreen, onClose, onSettings, onMain
|
||||
<div className="operator-menu__identity"><span className="label">RMIC :: 2026 / OPERATOR</span><h1>操作菜单<span>MENU</span></h1><p>打开菜单后,图传和受击上报仍会继续。</p>{snapshot.demo && <span className="tag tag--warn">预览 / 合成数据</span>}</div>
|
||||
<nav className="operator-menu__actions" aria-label="操作菜单">
|
||||
<button data-initial-focus onClick={close}><span><Icon name="play" />继续操作</span><kbd>ESC</kbd></button>
|
||||
<button onClick={onSettings}><span><Icon name="settings" />画面与设备设置</span><small>准星 · 图传绑定 · 装甲板</small></button>
|
||||
<button onClick={onSettings}><span><Icon name="settings" />画面与设备设置</span><small>准星 / 图传绑定 / 装甲板</small></button>
|
||||
<button onClick={onMaintenance}><span><Icon name="firmware" />固件维护</span><small>编译与 USB 烧录</small></button>
|
||||
<button onClick={() => { setError(""); setReconnect(true); }}><span><Icon name="reconnect" />重新接收裁判计时</span><small>{snapshot.matchClock.source ?? "等待裁判广播"}</small></button>
|
||||
<button onClick={onFullscreen}><span><Icon name={fullscreen ? "fullscreenExit" : "fullscreen"} />{fullscreen ? "退出全屏" : "全屏显示"}</span><kbd>F11</kbd></button>
|
||||
|
||||
@@ -101,11 +101,11 @@ export function SettingsPanel({ snapshot, hud, onHud, calibrating, onCalibrating
|
||||
|
||||
const cameraOptions = useMemo(() => snapshot.cameras.map(camera => ({
|
||||
value: camera.id, label: camera.idText,
|
||||
hint: `${camera.addr} · ${camera.online ? "在线" : "离线"} · 固件 ${firmwareLabel(camera)}${camera.compatible ? "" : ` · 协议 ${camera.protocol} 不匹配`}`,
|
||||
hint: `${camera.addr} / ${camera.online ? "在线" : "离线"} / 固件 ${firmwareLabel(camera)}${camera.compatible ? "" : ` / 协议 ${camera.protocol} 不匹配`}`,
|
||||
})), [snapshot.cameras]);
|
||||
const armorOptions = useMemo(() => snapshot.armorBoards.map(board => ({
|
||||
value: board.id, label: board.idText,
|
||||
hint: `${board.addr} · ${teamName(board.team, config.teamNames)} · ${board.hp} 血 · ${board.online ? "在线" : "离线"}`,
|
||||
hint: `${board.addr} / ${teamName(board.team, config.teamNames)} / ${board.hp} 血 / ${board.online ? "在线" : "离线"}`,
|
||||
})), [snapshot.armorBoards, config.teamNames]);
|
||||
|
||||
const categories = useMemo<Category[]>(() => [
|
||||
@@ -154,7 +154,7 @@ export function SettingsPanel({ snapshot, hud, onHud, calibrating, onCalibrating
|
||||
const camera = snapshot.cameras.find(item => item.id === config.cameraId);
|
||||
const cameraStats = snapshot.stats.find(item => item.camera === config.cameraId);
|
||||
const board = snapshot.armorBoards.find(item => item.id === config.armorId);
|
||||
const cameraState = !connected ? "本地通道断开" : config.cameraId === null ? "未绑定" : !camera?.online ? "离线" : !camera.compatible ? "协议不匹配" : cameraStats?.online && cameraStats.hasFrames ? "正在接收" : "已发现 · 等待画面";
|
||||
const cameraState = !connected ? "本地通道断开" : config.cameraId === null ? "未绑定" : !camera?.online ? "离线" : !camera.compatible ? "协议不匹配" : cameraStats?.online && cameraStats.hasFrames ? "正在接收" : "已发现 / 等待画面";
|
||||
const armorState = !connected ? "本地通道断开" : config.armorId === null ? "未绑定" : !board?.online ? "离线" : board.team === 255 ? "等待队伍设置" : board.team !== config.team ? "队伍不匹配" : "在线";
|
||||
const mirrorControls = <>
|
||||
<Switch checked={config.mirror} label="左右镜像画面" onChange={mirror => void run(() => api.setMirror(mirror))} />
|
||||
@@ -234,10 +234,10 @@ export function SettingsPanel({ snapshot, hud, onHud, calibrating, onCalibrating
|
||||
case "slots": return <>
|
||||
{mirrorControls}
|
||||
<div className="settings__span"><Switch checked={snapshot.slots.manual} label="手动指定槽位" onChange={manual => void run(() => api.setRefereeSlots({ ...snapshot.slots, manual }))} /></div>
|
||||
<Field label={`左格 · ${teamName(0, config.teamNames)} 图传`}><Select value={snapshot.slots.cameraA} options={cameraOptions} disabled={!snapshot.slots.manual} onChange={cameraA => void run(() => api.setRefereeSlots({ ...snapshot.slots, cameraA, manual: true }))} /></Field>
|
||||
<Field label={`右格 · ${teamName(1, config.teamNames)} 图传`}><Select value={snapshot.slots.cameraB} options={cameraOptions} disabled={!snapshot.slots.manual} onChange={cameraB => void run(() => api.setRefereeSlots({ ...snapshot.slots, cameraB, manual: true }))} /></Field>
|
||||
<Field label={`左格 · ${teamName(0, config.teamNames)} 装甲板`}><Select value={snapshot.slots.armorA} options={armorOptions} disabled={!snapshot.slots.manual} onChange={armorA => void run(() => api.setRefereeSlots({ ...snapshot.slots, armorA, manual: true }))} /></Field>
|
||||
<Field label={`右格 · ${teamName(1, config.teamNames)} 装甲板`}><Select value={snapshot.slots.armorB} options={armorOptions} disabled={!snapshot.slots.manual} onChange={armorB => void run(() => api.setRefereeSlots({ ...snapshot.slots, armorB, manual: true }))} /></Field>
|
||||
<Field label={`左格 / ${teamName(0, config.teamNames)} 图传`}><Select value={snapshot.slots.cameraA} options={cameraOptions} disabled={!snapshot.slots.manual} onChange={cameraA => void run(() => api.setRefereeSlots({ ...snapshot.slots, cameraA, manual: true }))} /></Field>
|
||||
<Field label={`右格 / ${teamName(1, config.teamNames)} 图传`}><Select value={snapshot.slots.cameraB} options={cameraOptions} disabled={!snapshot.slots.manual} onChange={cameraB => void run(() => api.setRefereeSlots({ ...snapshot.slots, cameraB, manual: true }))} /></Field>
|
||||
<Field label={`左格 / ${teamName(0, config.teamNames)} 装甲板`}><Select value={snapshot.slots.armorA} options={armorOptions} disabled={!snapshot.slots.manual} onChange={armorA => void run(() => api.setRefereeSlots({ ...snapshot.slots, armorA, manual: true }))} /></Field>
|
||||
<Field label={`右格 / ${teamName(1, config.teamNames)} 装甲板`}><Select value={snapshot.slots.armorB} options={armorOptions} disabled={!snapshot.slots.manual} onChange={armorB => void run(() => api.setRefereeSlots({ ...snapshot.slots, armorB, manual: true }))} /></Field>
|
||||
</>;
|
||||
case "media": return <>
|
||||
<div className="settings__span"><Field label="输出目录"><input className="input" type="text" defaultValue={config.recordingDir} onBlur={event => {
|
||||
@@ -298,7 +298,7 @@ export function SettingsPanel({ snapshot, hud, onHud, calibrating, onCalibrating
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer className="settings__foot"><span>{pending ? "等待保存…" : "修改自动保存"}<span className="settings__save-note"> · 停止拖动滑杆 350 ms 后自动保存</span></span><span className="num">{VERSION_LABEL} · 线路协议 {BUILD.protocol}</span></footer>
|
||||
<footer className="settings__foot"><span>{pending ? "等待保存…" : "修改自动保存"}<span className="settings__save-note"> / 停止拖动滑杆 350 ms 后自动保存</span></span><span className="num">{VERSION_LABEL} / 线路协议 {BUILD.protocol}</span></footer>
|
||||
</aside>;
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ function Preview({ hud, team, mirrored, mirroredVertical }: { hud: HudView; team
|
||||
<div className="preview">
|
||||
<div className="preview__head">
|
||||
<span className="label">HUD PREVIEW</span>
|
||||
<span className="preview__note">合成画面 · 非设备图传</span>
|
||||
<span className="preview__note">合成画面 / 非设备图传</span>
|
||||
</div>
|
||||
|
||||
<div className="preview__frame corners">
|
||||
|
||||
@@ -49,7 +49,7 @@ export function TopBar({
|
||||
<div className="topbar__cluster">
|
||||
{/* 队标只以"字标"的形态出现在顶栏:它的笔画在 17px 上只剩 1px,缩到这么小
|
||||
会糊成一团反而更难看。完整的队标留给启动页(在那里它有 30px)。 */}
|
||||
<span className="topbar__brand" title="RMIC::2026 · Simba Robotics">
|
||||
<span className="topbar__brand" title="RMIC::2026 / Simba Robotics">
|
||||
<span className="topbar__wordmark">
|
||||
RMIC<span className="topbar__slash">::</span>2026
|
||||
</span>
|
||||
@@ -71,7 +71,7 @@ export function TopBar({
|
||||
)
|
||||
}
|
||||
>
|
||||
<Icon name="info" />演示 · 合成数据
|
||||
<Icon name="info" />演示 / 合成数据
|
||||
</button>
|
||||
)}
|
||||
|
||||
@@ -80,7 +80,7 @@ export function TopBar({
|
||||
{!connected && (
|
||||
<span className="tag tag--warn">
|
||||
<span className="dot dot--warn" />
|
||||
通道断开 · 重连中
|
||||
通道断开 / 重连中
|
||||
</span>
|
||||
)}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ interface Props {
|
||||
children?: ReactNode;
|
||||
/** Only used by the opt-in screen/camera calibration page. */
|
||||
onFramePainted?: (canvas: HTMLCanvasElement, frame: FrameInfo, drawMs: number) => void;
|
||||
/** 左上角的代号(`CAM · A`、队名)。缺省时不画。 */
|
||||
/** 左上角的代号(`CAM / A`、队名)。缺省时不画。 */
|
||||
label?: string;
|
||||
/** 这一路被"选中"了(裁判端的 scope)。视觉上给一圈亮框。 */
|
||||
focused?: boolean;
|
||||
@@ -351,7 +351,7 @@ export function VideoSurface({
|
||||
{calibrating && (
|
||||
<div className="vsurface__calibrating">
|
||||
<span className="dot dot--live" />
|
||||
校准中 · 拖动画面调整瞄准点
|
||||
校准中 / 拖动画面调整瞄准点
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ export async function previewInvoke<T>(command: string, args?: Record<string, un
|
||||
let previewCapture = 0;
|
||||
let previewCaptureAt = 0;
|
||||
let previewInputSequence = 0;
|
||||
let previewOperator: OperatorControlView = { active: false, captureId: null, mode: null, reason: "预览 · 未发送真实操作" };
|
||||
let previewOperator: OperatorControlView = { active: false, captureId: null, mode: null, reason: "预览 / 未发送真实操作" };
|
||||
|
||||
function handle(command: string, args: Record<string, unknown>): unknown {
|
||||
switch (command) {
|
||||
@@ -179,7 +179,7 @@ function handle(command: string, args: Record<string, unknown>): unknown {
|
||||
const mode = args.mode === "debug" ? "debug" : "match";
|
||||
previewInputSequence = 0;
|
||||
previewCaptureAt = performance.now();
|
||||
previewOperator = { active: true, captureId: ++previewCapture, mode, reason: "预览 · 合成输入,不发送到装甲板" };
|
||||
previewOperator = { active: true, captureId: ++previewCapture, mode, reason: "预览 / 合成输入,不发送到装甲板" };
|
||||
return previewCapture;
|
||||
}
|
||||
case "operator_input": {
|
||||
@@ -634,7 +634,7 @@ function draw(canvas: HTMLCanvasElement, team: number, frameId: number) {
|
||||
|
||||
ctx.font = "600 20px ui-monospace, monospace";
|
||||
ctx.fillStyle = "#e8e8ec";
|
||||
ctx.fillText(team === 0 ? "PREVIEW · TEAM 1" : "PREVIEW · TEAM 2", 14, height - 40);
|
||||
ctx.fillText(team === 0 ? "PREVIEW / TEAM 1" : "PREVIEW / TEAM 2", 14, height - 40);
|
||||
ctx.font = "500 16px ui-monospace, monospace";
|
||||
ctx.fillStyle = "#8a8a95";
|
||||
ctx.fillText(`frame ${frameId}`, 14, height - 16);
|
||||
|
||||
@@ -75,7 +75,7 @@ export function teamColor(team: number): string {
|
||||
return team === 0 ? "var(--team-0)" : "var(--team-1)";
|
||||
}
|
||||
/**
|
||||
* 固件版本的一行标签:`v0.2.0 · 34`。
|
||||
* 固件版本的一行标签:`v0.2.0 / 34`。
|
||||
*
|
||||
* 板子太老、没带版本字段时返回"版本未知"——不要拼出一个 `v0.0.0`,那是假信息。
|
||||
*/
|
||||
@@ -87,6 +87,6 @@ export function firmwareLabel(camera: {
|
||||
return camera.firmwareBuild > 0 ? `构建 ${camera.firmwareBuild}` : "版本未知";
|
||||
}
|
||||
return camera.firmwareBuild > 0
|
||||
? `v${camera.firmwareVersion} · ${camera.firmwareBuild}`
|
||||
? `v${camera.firmwareVersion} / ${camera.firmwareBuild}`
|
||||
: `v${camera.firmwareVersion}`;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { MatchClockView, MatchPhase } from "./types";
|
||||
|
||||
export const MATCH_PHASE: Record<MatchPhase, string> = {
|
||||
idle: "等待准备", preparation: "赛前准备", ready: "准备结束 · 等待裁判", countdown: "开赛倒计时",
|
||||
idle: "等待准备", preparation: "赛前准备", ready: "准备结束 / 等待裁判", countdown: "开赛倒计时",
|
||||
running: "对局进行中", paused: "技术暂停", finished: "本局计时结束",
|
||||
};
|
||||
export function matchTime(ms: number, countingUp = false): string {
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
*/
|
||||
|
||||
export const BUILD = {
|
||||
version: "0.6.0",
|
||||
version: "0.6.1",
|
||||
major: 0,
|
||||
minor: 6,
|
||||
patch: 0,
|
||||
patch: 1,
|
||||
/** git 提交数,单调递增。 */
|
||||
build: 47,
|
||||
build: 48,
|
||||
/** 线路协议版本。与固件自报的那个数直接比对。 */
|
||||
protocol: 1,
|
||||
/** 生成时的提交日期(`YYYY-MM-DD`)。 */
|
||||
|
||||
@@ -94,8 +94,8 @@ export function LatencyPage() {
|
||||
<div style={{position:'relative',minHeight:0}}><VideoSurface camera={camera} emptyText="等待真实摄像头" mirrored={false}
|
||||
crosshair={null} grid={null} view={IDENTITY_VIEW} onView={()=>{}} hitFeedback={feedback} showZoom={false} onFramePainted={painted}/></div>
|
||||
</div>
|
||||
<p>{connected?'已连接':'连接中'} · {status}</p>
|
||||
<p style={{fontSize:22}}>样本 {summary.samples} · P50 {summary.p50.toFixed(1)} ms · P95 {summary.p95.toFixed(1)} ms</p>
|
||||
<p>{connected?'已连接':'连接中'} / {status}</p>
|
||||
<p style={{fontSize:22}}>样本 {summary.samples} / P50 {summary.p50.toFixed(1)} ms / P95 {summary.p95.toFixed(1)} ms</p>
|
||||
<p>每 50 ms 更新标记,记录首次可解码回显,包含相机取样等待、曝光、采集、传输和绘制;混合曝光帧不计入。相邻 rAF 夹定绘制时间,刷新间隔约 {summary.refresh.toFixed(1)} ms;面板像素响应需高速相机复核。</p>
|
||||
</main>;
|
||||
}
|
||||
@@ -92,7 +92,7 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
|
||||
setDevice(snapshot);
|
||||
setViewStep("bundle");
|
||||
appendLog(
|
||||
`设备:${snapshot.chip} ${snapshot.mac ?? "MAC 未知"} · ${snapshot.flashSizeText} · ` +
|
||||
`设备:${snapshot.chip} ${snapshot.mac ?? "MAC 未知"} / ${snapshot.flashSizeText} / ` +
|
||||
`${snapshot.app ? `App ${snapshot.app.version}` : "未识别 App"}`,
|
||||
);
|
||||
} catch (err) {
|
||||
@@ -357,7 +357,7 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
|
||||
<header className="mnt-head">
|
||||
<div><span className="label mnt-kicker">RMIC / DEVICE SERVICE</span><h1>固件维护</h1></div>
|
||||
<div className="mnt-head__actions">
|
||||
{preview && <span className="tag tag--warn">预览 · 合成数据 / 无 USB 操作</span>}
|
||||
{preview && <span className="tag tag--warn">预览 / 合成数据 / 无 USB 操作</span>}
|
||||
<Button icon={fullscreen ? "fullscreenExit" : "fullscreen"} variant="ghost" onClick={onToggleFullscreen}>{fullscreen ? "退出全屏" : "全屏"}</Button>
|
||||
<Button icon="back" variant="ghost" disabled={anyBusy} onClick={onClose}>返回 <kbd>ESC</kbd></Button>
|
||||
</div>
|
||||
@@ -365,12 +365,12 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
|
||||
|
||||
<div className="mnt-workspace">
|
||||
<section className="mnt-visual" aria-label="设备与任务状态">
|
||||
<div className="mnt-visual__head"><span className="label">USB / {firmwareKind === "armor" ? "ARMOR" : firmwareKind === "camera" ? "VIDEO" : "DEVICE"}</span><span className={`mnt-link${device ? " is-live" : ""}`}><i />{device ? "已读取" : portAvailable ? "端口可用 · 待读取" : "未发现目标串口"}</span></div>
|
||||
<div className="mnt-visual__head"><span className="label">USB / {firmwareKind === "armor" ? "ARMOR" : firmwareKind === "camera" ? "VIDEO" : "DEVICE"}</span><span className={`mnt-link${device ? " is-live" : ""}`}><i />{device ? "已读取" : portAvailable ? "端口可用 / 待读取" : "未发现目标串口"}</span></div>
|
||||
<DeviceDiagram kind={firmwareKind} identified={!!device} portAvailable={portAvailable} active={anyBusy} failed={!!error || !!report && !report.ok} complete={!!report?.ok} ratio={ratio} chip={device?.chip ?? (firmwareKind === "armor" ? "ESP32-C3" : firmwareKind === "camera" ? "ESP32-S3" : "MCU")} />
|
||||
<div key={visualState} className="mnt-visual__status" role="status">
|
||||
<span className="label">{report ? "RESULT" : busy ? "CURRENT PHASE" : "DEVICE STATUS"}</span>
|
||||
<h2>{busy ? BUSY_TEXT[busy] : report ? report.ok ? "写入与回读完成" : "烧录未完成" : device ? "设备已识别" : "等待读取设备"}{busy && ratio !== null && <span className="num"> {Math.round(ratio * 100)}%</span>}</h2>
|
||||
<p>{anyBusy ? progress?.message ?? (busy === "build" ? "构建日志可在诊断中查看" : "请保持 USB 连接") : report ? "上次操作结果 · 仍需检查板上运行情况" : device ? `${device.chip.toUpperCase()} · ${device.flashSizeText}` : portAvailable ? `${port} · 点击读取设备` : "连接 USB 后刷新串口"}</p>
|
||||
<p>{anyBusy ? progress?.message ?? (busy === "build" ? "构建日志可在诊断中查看" : "请保持 USB 连接") : report ? "上次操作结果 / 仍需检查板上运行情况" : device ? `${device.chip.toUpperCase()} / ${device.flashSizeText}` : portAvailable ? `${port} / 点击读取设备` : "连接 USB 后刷新串口"}</p>
|
||||
</div>
|
||||
<dl className="mnt-identity"><div><dt>串口</dt><dd>{port || "—"}</dd></div><div><dt>MAC</dt><dd>{device?.mac ?? report?.mac ?? "—"}</dd></div><div><dt>队伍设置</dt><dd>{firmwareKind === "armor" ? bundle?.armorTeam != null ? `旧版 / ${expectedTeam === "" ? "待核对" : expectedTeam === "0" ? "红" : "蓝"}` : "客户端选择" : "—"}</dd></div></dl>
|
||||
</section>
|
||||
@@ -389,7 +389,7 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
|
||||
</div>
|
||||
<div className={`mnt-connection-fields${firmwareKind === "armor" && bundle?.armorTeam != null ? " has-team" : ""}`}>
|
||||
{firmwareKind === "armor" && bundle?.armorTeam != null && <label className="mnt-field"><span>旧版固件目标队伍</span><select className="select" value={expectedTeam} disabled={anyBusy} onChange={event => { setExpectedTeam(event.target.value); setPlan(null); }}><option value="">选择这块板的队伍</option><option value="0">队伍一(红,0)</option><option value="1">队伍二(蓝,1)</option></select></label>}
|
||||
<label className="mnt-field"><span>USB 串口</span><div className="mnt-row"><select className="select" value={port} disabled={anyBusy} onChange={event => { setPort(event.target.value); setDevice(null); setPlan(null); setReport(null); setProgress(null); }}>{ports.length === 0 && <option value="">未发现串口</option>}{ports.map(entry => <option key={entry.portName} value={entry.portName}>{entry.portName} · {entry.label}</option>)}</select><Button icon="refresh" disabled={anyBusy} onClick={() => void refreshPorts(false)}>刷新</Button></div></label>
|
||||
<label className="mnt-field"><span>USB 串口</span><div className="mnt-row"><select className="select" value={port} disabled={anyBusy} onChange={event => { setPort(event.target.value); setDevice(null); setPlan(null); setReport(null); setProgress(null); }}>{ports.length === 0 && <option value="">未发现串口</option>}{ports.map(entry => <option key={entry.portName} value={entry.portName}>{entry.portName} / {entry.label}</option>)}</select><Button icon="refresh" disabled={anyBusy} onClick={() => void refreshPorts(false)}>刷新</Button></div></label>
|
||||
</div>
|
||||
<p className="mnt-hint">请只连接要维护的主板。{firmwareKind === "camera" && "图传板接入右侧 USB 口。"}读取设备信息时,主板会复位。</p>
|
||||
<div className="mnt-task__actions"><Button icon="usb" variant="primary" disabled={anyBusy || !port || !firmwareKind} onClick={() => void probePort(port)}>读取设备并继续</Button><Button icon="firmware" variant="ghost" disabled={anyBusy || !firmwareKind} onClick={() => setViewStep("bundle")}>准备固件包</Button></div>
|
||||
@@ -398,7 +398,7 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
|
||||
|
||||
{viewStep === "bundle" && <>
|
||||
<div className="mnt-task__title"><span className="label">02 / FIRMWARE</span><h2>选择对应固件</h2></div>
|
||||
<div className="mnt-package"><span className="mnt-package__symbol"><Icon name="firmware" /></span><strong>{bundle ? `${bundle.name} ${bundle.version}` : "选择固件 ZIP"}</strong><span>{bundle ? `${bundle.chip.toUpperCase()} · ${formatBytes(bundle.appSize)}` : firmwareKind === "armor" ? "ESP32-C3 / 装甲板固件" : "ESP32-S3 / 图传固件"}</span>{bundle?.firmwareKind === "armor" && <b>{bundle.armorTeam == null ? "通用固件 / 客户端选择队伍" : `旧版固定队伍${bundle.armorTeam === 0 ? "一(红)" : "二(蓝)"}`} · 阈值 {bundle.armorThreshold}</b>}<Button icon="file" disabled={anyBusy} onClick={() => void chooseBundle("zip")}>{bundle ? "更换 ZIP" : "选择 ZIP"}</Button></div>
|
||||
<div className="mnt-package"><span className="mnt-package__symbol"><Icon name="firmware" /></span><strong>{bundle ? `${bundle.name} ${bundle.version}` : "选择固件 ZIP"}</strong><span>{bundle ? `${bundle.chip.toUpperCase()} / ${formatBytes(bundle.appSize)}` : firmwareKind === "armor" ? "ESP32-C3 / 装甲板固件" : "ESP32-S3 / 图传固件"}</span>{bundle?.firmwareKind === "armor" && <b>{bundle.armorTeam == null ? "通用固件 / 客户端选择队伍" : `旧版固定队伍${bundle.armorTeam === 0 ? "一(红)" : "二(蓝)"}`} / 阈值 {bundle.armorThreshold}</b>}<Button icon="file" disabled={anyBusy} onClick={() => void chooseBundle("zip")}>{bundle ? "更换 ZIP" : "选择 ZIP"}</Button></div>
|
||||
{bundle?.firmwareKind === "armor" && bundle.armorTeam != null && <label className="mnt-field"><span>旧版包:核对实物队伍</span><select className="select" value={expectedTeam} disabled={anyBusy} onChange={event => { setExpectedTeam(event.target.value); setPlan(null); }}><option value="">请选择</option><option value="0">队伍一(红)</option><option value="1">队伍二(蓝)</option></select></label>}
|
||||
<div className="mnt-row mnt-secondary">{firmwareKind === "armor" && <Button icon="build" variant="ghost" disabled={anyBusy} onClick={() => setModal("build")}>从源码编译</Button>}<Button icon="folder" variant="ghost" disabled={anyBusy} onClick={() => void chooseBundle("dir")}>选择目录包</Button></div>
|
||||
{mismatch && <p className="mnt-note warn" role="alert">{mismatch}</p>}
|
||||
@@ -412,7 +412,7 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
|
||||
<div className="mnt-confirmation"><strong className="num">{plan.device.port} / {plan.device.chip.toUpperCase()}</strong><span className="num">MAC {plan.device.mac}</span><span>{plan.bundle.name} {plan.bundle.version}</span></div>
|
||||
<div className="mnt-running"><span className="label">CURRENT PHASE</span><h3>{progress?.phase ?? "准备设备"}</h3><p>{progress?.message ?? "正在核对设备与准备备份"}</p><span className="mnt-hint">左侧显示当前进度,操作结束后会显示结果。</span></div>
|
||||
</> : plan ? <>
|
||||
<div className="mnt-confirmation"><strong className="num">{plan.device.port} / {plan.device.chip.toUpperCase()}</strong><span className="num">MAC {plan.device.mac ?? "未知"}</span><span>{plan.bundle.name} {plan.bundle.version}</span>{plan.mode === "armor-install" && <b>{plan.bundle.armorTeam == null ? "通用固件 / 客户端选择队伍" : `旧版固定队伍${plan.bundle.armorTeam === 0 ? "一(红)" : "二(蓝)"}`} · 阈值 {plan.bundle.armorThreshold}</b>}</div>
|
||||
<div className="mnt-confirmation"><strong className="num">{plan.device.port} / {plan.device.chip.toUpperCase()}</strong><span className="num">MAC {plan.device.mac ?? "未知"}</span><span>{plan.bundle.name} {plan.bundle.version}</span>{plan.mode === "armor-install" && <b>{plan.bundle.armorTeam == null ? "通用固件 / 客户端选择队伍" : `旧版固定队伍${plan.bundle.armorTeam === 0 ? "一(红)" : "二(蓝)"}`} / 阈值 {plan.bundle.armorThreshold}</b>}</div>
|
||||
<ul className="mnt-warnings">
|
||||
{plan.mode !== "armor-install" && <>
|
||||
<li>App 写入 {formatOffset(plan.targetOffset)}({formatBytes(plan.appSize)}),整段回读通过后才切换分区表。旧 App 保留在 {formatOffset(plan.currentFactoryOffset)}。</li>
|
||||
@@ -439,11 +439,11 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<footer className="mnt-foot"><span>{busy ? `正在${BUSY_TEXT[busy]} · 请勿拔线` : "USB 固件维护 / ESP32-S3 · ESP32-C3"}</span><div>{(busy === "flash" || busy === "build") && <Button icon="stop" variant="danger" onClick={() => void cancelFlash()}>请求取消</Button>}<Button icon="log" variant="ghost" onClick={() => setModal("details")}>诊断 / 日志 {logs.length > 0 ? `(${logs.length})` : ""}</Button></div></footer>
|
||||
<footer className="mnt-foot"><span>{busy ? `正在${BUSY_TEXT[busy]} / 请勿拔线` : "USB 固件维护 / ESP32-S3 / ESP32-C3"}</span><div>{(busy === "flash" || busy === "build") && <Button icon="stop" variant="danger" onClick={() => void cancelFlash()}>请求取消</Button>}<Button icon="log" variant="ghost" onClick={() => setModal("details")}>诊断 / 日志 {logs.length > 0 ? `(${logs.length})` : ""}</Button></div></footer>
|
||||
|
||||
{modal === "restore" && restoreRequest && <Dialog title={restoreRequest.kind === "armor" ? "恢复完整备份" : "恢复旧分区表"} className="mnt-restore-dialog" onClose={() => { setModal(null); setRestoreRequest(null); }} closeDisabled={anyBusy}>
|
||||
{close => <div className="mnt-restore">
|
||||
<div className="mnt-confirmation"><strong>{restoreRequest.port} · {restoreRequest.kind === "armor" ? "ESP32-C3 装甲板" : "ESP32-S3 图传板"}</strong><span className="num">{restoreRequest.backupDir}</span></div>
|
||||
<div className="mnt-confirmation"><strong>{restoreRequest.port} / {restoreRequest.kind === "armor" ? "ESP32-C3 装甲板" : "ESP32-S3 图传板"}</strong><span className="num">{restoreRequest.backupDir}</span></div>
|
||||
<p>{restoreRequest.kind === "armor" ? "将恢复完整 4 MB Flash,覆盖当前固件和设置。恢复期间不支持取消。" : "将把旧分区表写回 0x8000,设备会复位到旧 App。"}执行前会核对备份与设备身份,请保持供电和 USB 连接。</p>
|
||||
<div className="mnt-task__actions"><Button icon="back" variant="ghost" onClick={close}>返回检查</Button><Button icon="reset" variant="danger" disabled={anyBusy} onClick={() => void restoreTable()}>确认恢复</Button></div>
|
||||
</div>}
|
||||
|
||||
@@ -240,7 +240,7 @@ export function RefereePage({ snapshot, hud, onOpenSettings, onError, onInfo }:
|
||||
<div className={`ref__feed${dimmed ? " is-dimmed" : ""}`}>
|
||||
<VideoSurface
|
||||
camera={pane.camera}
|
||||
label={`${pane.key.toUpperCase()} · ${label}`}
|
||||
label={`${pane.key.toUpperCase()} / ${label}`}
|
||||
emptyText={
|
||||
pane.stats?.hasFrames
|
||||
? ""
|
||||
@@ -265,13 +265,6 @@ export function RefereePage({ snapshot, hud, onOpenSettings, onError, onInfo }:
|
||||
focused={focused}
|
||||
onSelect={() => setScope((current) => (current === pane.key ? "all" : pane.key))}
|
||||
>
|
||||
{pane.camera !== null && <div className="ref__mirror-controls" onPointerDown={event => event.stopPropagation()}>
|
||||
{[false, true].map(vertical => {
|
||||
const value = snapshot.cameraMirrors[String(pane.camera)] ?? { mirror: snapshot.mirrored, mirrorVertical: snapshot.mirroredVertical };
|
||||
const checked = vertical ? value.mirrorVertical : value.mirror;
|
||||
return <button className="btn btn--sm" key={String(vertical)} aria-pressed={checked} title="同步到绑定此图传板的选手端" onClick={() => void api.setCameraMirror(pane.camera!, vertical ? value.mirror : !checked, vertical ? !checked : value.mirrorVertical).catch(onError)}>{vertical ? "上下镜像" : "左右镜像"}{checked ? " · 开" : " · 关"}</button>;
|
||||
})}
|
||||
</div>}
|
||||
{hud.health.visible && pane.health && (
|
||||
<div className={`ref__bar ref__bar--${pane.align}`}>
|
||||
<HealthBar health={pane.health} config={hud.health} align={pane.align} />
|
||||
@@ -298,6 +291,13 @@ export function RefereePage({ snapshot, hud, onOpenSettings, onError, onInfo }:
|
||||
name={pane.health?.name ?? label}
|
||||
onSave={(value) => saveName(pane.team, value)}
|
||||
/>
|
||||
{pane.camera !== null && <div className="ref__mirror-controls" onPointerDown={event => event.stopPropagation()}>
|
||||
{[false, true].map(vertical => {
|
||||
const value = snapshot.cameraMirrors[String(pane.camera)] ?? { mirror: snapshot.mirrored, mirrorVertical: snapshot.mirroredVertical };
|
||||
const checked = vertical ? value.mirrorVertical : value.mirror;
|
||||
return <button className="btn btn--sm" key={String(vertical)} aria-pressed={checked} title="同步到绑定此图传板的选手端" onClick={() => void api.setCameraMirror(pane.camera!, vertical ? value.mirror : !checked, vertical ? !checked : value.mirrorVertical).catch(onError)}><Icon name={vertical ? "mirrorVertical" : "mirrorHorizontal"} />{vertical ? "上下镜像" : "左右镜像"}<span className="ref__mirror-state">{checked ? "开" : "关"}</span></button>;
|
||||
})}
|
||||
</div>}
|
||||
<StatsLine stats={pane.stats} diagnostics={snapshot.diagnostics} />
|
||||
{pane.cameraInfo && (
|
||||
<span
|
||||
@@ -453,7 +453,7 @@ export function RefereePage({ snapshot, hud, onOpenSettings, onError, onInfo }:
|
||||
left={
|
||||
<span className="statusbar__state">
|
||||
<span className={`dot ${snapshot.clients > 0 ? "dot--live" : "dot--warn"}`} />
|
||||
同时查看两路画面 · 滚轮缩放鼠标所在的画面
|
||||
同时查看两路画面 / 滚轮缩放鼠标所在的画面
|
||||
</span>
|
||||
}
|
||||
center={
|
||||
@@ -486,7 +486,7 @@ export function RefereePage({ snapshot, hud, onOpenSettings, onError, onInfo }:
|
||||
}
|
||||
right={
|
||||
<span className="statusbar__hint">
|
||||
{scope === "all" ? "按 1 / 2 查看单路" : `正在看 ${scope === "a" ? "左路" : "右路"} · 按 0 显示全部`}
|
||||
{scope === "all" ? "按 1 / 2 查看单路" : `正在看 ${scope === "a" ? "左路" : "右路"} / 按 0 显示全部`}
|
||||
</span>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -41,10 +41,10 @@ export function TeamPage({ snapshot, hud, calibrating, controlsBlocked, onCalibr
|
||||
// 两侧各自使用独立列;放大血条也不能跨过中线压住对方。
|
||||
const healthConfig = { ...hud.health, width: Math.min(1, hud.health.width * 2) };
|
||||
const hasVideo = cameraLive && !!stats?.hasFrames;
|
||||
const emptyText = camera === null ? "未绑定图传板 · 按 ESC 配置"
|
||||
const emptyText = camera === null ? "未绑定图传板 / 按 ESC 配置"
|
||||
: !connected ? "本机服务断开,正在重连"
|
||||
: !boundCamera ? "尚未发现绑定的图传板 · 按 ESC 检查设备"
|
||||
: !boundCamera.compatible ? "图传协议不匹配 · 按 ESC 检查固件"
|
||||
: !boundCamera ? "尚未发现绑定的图传板 / 按 ESC 检查设备"
|
||||
: !boundCamera.compatible ? "图传协议不匹配 / 按 ESC 检查固件"
|
||||
: !cameraLive ? "图传板离线,等待重新连接"
|
||||
: !stats?.hasFrames ? "已连接,等待画面" : "";
|
||||
|
||||
@@ -60,7 +60,7 @@ export function TeamPage({ snapshot, hud, calibrating, controlsBlocked, onCalibr
|
||||
{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__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>
|
||||
@@ -71,13 +71,12 @@ export function TeamPage({ snapshot, hud, calibrating, controlsBlocked, onCalibr
|
||||
<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 ? " / 左右镜像" : ""}${snapshot.mirroredVertical ? " / 上下镜像" : ""}` : "等待图传连接"}</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 className="cockpit__footer"><div className="cockpit__actions"><OperatorControls control={control} snapshot={snapshot} connected={connected} blocked={controlsBlocked || calibrating} /><span><kbd>ESC</kbd> 菜单 / 设置</span></div><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} />
|
||||
<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>}
|
||||
{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>;
|
||||
|
||||
@@ -108,7 +108,9 @@
|
||||
.app--team .calibrate-bar { top: 140px; max-width: calc(100% - 120px); }
|
||||
|
||||
/* 操控入口只占左下角一行,参数在二级菜单中展开。 */
|
||||
.operator-controls { position: absolute; z-index: 16; left: 28px; bottom: 48px; color: var(--ink); }
|
||||
.operator-controls { position: relative; z-index: 16; color: var(--ink); pointer-events: auto; flex: none; }
|
||||
.cockpit__actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; min-width: 0; }
|
||||
.cockpit__actions > span { white-space: nowrap; }
|
||||
.operator-controls__toggle { gap: 10px; min-width: 116px; background: var(--panel); }
|
||||
.operator-controls__toggle > i { width: 6px; height: 6px; background: var(--ink-3); }
|
||||
.operator-controls__toggle > i.is-on { background: var(--hud); }
|
||||
@@ -134,7 +136,13 @@
|
||||
.operator-mapping__track > b { position: absolute; left: 50%; top: -2px; height: 7px; width: 1px; background: #74af8b66; }
|
||||
.operator-mapping footer { border-top: 1px solid #74af8b33; margin-top: 16px; padding-top: 10px; color: var(--hud-dim); }
|
||||
.operator-mapping .is-firing { color: var(--hud); }
|
||||
.ref__mirror-controls { position: absolute; z-index: 8; bottom: 42px; right: 12px; display: flex; gap: 6px; }
|
||||
.ref__mirror-controls { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap; }
|
||||
.ref__mirror-controls .icon { width: 17px; height: 17px; }
|
||||
.ref__mirror-state { color: var(--ink-3); margin-left: 3px; }
|
||||
.operator-controls__toggle > .icon:last-child { width: 16px; height: 16px; margin-left: auto; transform: rotate(-90deg); transition: transform var(--dur-short3) var(--m3-standard); }
|
||||
.operator-controls__toggle > .icon.is-open { transform: rotate(90deg); }
|
||||
.ref__mirror-controls .btn { background: var(--panel); font-size: 10px; }
|
||||
@media (max-height: 650px) { .operator-controls { bottom: 38px; } .operator-mapping { padding: 10px 18px; } }
|
||||
@media (max-height: 650px) { .operator-mapping { padding: 10px 18px; } }
|
||||
@media (prefers-reduced-motion: reduce) { .operator-controls__menu, .operator-mapping { animation: none; } .operator-mapping__track > i { transition: none; } }
|
||||
|
||||
@media (prefers-reduced-motion: reduce) { .operator-controls__toggle > .icon:last-child { transition: none; } }
|
||||
@@ -1064,3 +1064,6 @@
|
||||
animation-delay: 0ms;
|
||||
}
|
||||
}
|
||||
|
||||
/* 每路镜像工具占用页脚布局空间,不覆盖图传。窄窗允许整组换行。 */
|
||||
.ref__foot { height: auto; min-height: 44px; flex-wrap: wrap; row-gap: 8px; padding-block: 6px; }
|
||||
Reference in new issue
Block a user