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,78 @@
|
||||
/** 连续血量条:长度对应 0–100 血,右侧镜像后从画面中心向外缩短。未接入时保留空条与说明。 */
|
||||
|
||||
import { teamColor } from "../lib/format";
|
||||
import type { HealthConfig, TeamHealthDto } from "../lib/types";
|
||||
|
||||
interface Props {
|
||||
health: TeamHealthDto;
|
||||
config: HealthConfig;
|
||||
/** 挂在画面哪一角。`right` 会把条整个镜像过来(含缺血的退向)。 */
|
||||
align: "left" | "right";
|
||||
/** 这一格是谁:用户端用「我方 / 对手」把两条同色的血区分开。 */
|
||||
tag?: string;
|
||||
/** 休眠态:只留数字,标签与提示退到背景里。 */
|
||||
asleep?: boolean;
|
||||
}
|
||||
|
||||
export function HealthBar({ health, config, align, tag, asleep = false }: Props) {
|
||||
// 脉动交给 CSS,减少动态效果时仍保留低血颜色,停止闪动。
|
||||
const pulsing = config.pulse && health.available && health.critical;
|
||||
|
||||
const color = health.critical ? "var(--error)" : teamColor(health.team);
|
||||
const raw = health.available ? Math.max(0, Math.min(100, health.hp ?? 0)) : 0;
|
||||
|
||||
const showThreshold = config.lowThreshold > 0 && config.lowThreshold < 100;
|
||||
|
||||
// 宽度按配置收窄。它挂在画面角上,太宽会盖住画面本身。
|
||||
const width = `${Math.round(config.width * 100)}%`;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`hp hp--${align}${asleep ? " hp--asleep" : ""}${
|
||||
pulsing ? " hp--pulsing" : ""
|
||||
}${health.critical ? " hp--critical" : ""}`}
|
||||
style={{ width }}
|
||||
title={health.available ? undefined : health.placeholder}
|
||||
>
|
||||
<div className="hp__head">
|
||||
{tag && <span className="hp__tag">{tag}</span>}
|
||||
{config.showTeamName && (
|
||||
<span className="hp__name" style={{ color }} title={health.name}>
|
||||
{health.name}
|
||||
</span>
|
||||
)}
|
||||
|
||||
{health.available ? (
|
||||
config.showNumbers && (
|
||||
<span className="hp__value num" style={{ color }}>
|
||||
{raw}
|
||||
</span>
|
||||
)
|
||||
) : (
|
||||
<span className="hp__missing">装甲板未接入</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="hp__track-wrap">
|
||||
<div className="hp__track" aria-hidden="true">
|
||||
<div className="hp__meter">
|
||||
<span className="hp__fill" style={{ width: `${raw}%`, backgroundColor: color }}>
|
||||
{health.available && raw > 0 && <span key={raw} className="hp__impact" />}
|
||||
</span>
|
||||
{/* 刻度与填充共用坐标;镜像整条时会一起翻到右侧。 */}
|
||||
{showThreshold && <span className="hp__threshold" style={{ left: `${config.lowThreshold}%` }} />}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 这一格是谁。
|
||||
*
|
||||
* 用户端两条血分别属于两边,而形状是对称的——没有这个标签,"左边这条是我的"要靠位置猜。
|
||||
*/
|
||||
export function healthTag(health: TeamHealthDto, myTeam: number): string {
|
||||
return health.team === myTeam ? "我方" : "对手";
|
||||
}
|
||||
Reference in new issue
Block a user