desktop: 修两处小问题(预览模式的命中节奏、设置面板里漏出来的 **)

- 浏览器预览的掉血脚本写成"打空就重置,然后按 to >= from 判断"——两块板子都打空之后
  每一次都是重置,命中再也不出现,盯着界面等闪红会等到超时。现在打空那一拍只重置、
  其余每一拍都出命中。
- 设置面板里"偏移存的是**画面比例**"直接写进了 JSX,`**` 原样显示出来了。JSX 不渲染
  Markdown,改成 <span class="em">。

顺带把界面截图落到 desktop/screenshots/(不进仓库):这个环境里 Page.captureScreenshot
不可用(空白页也超时),改用 Page.printToPDF + sips 转 PNG;打印路径不渲染 box-shadow
的模糊半径(会变成实心块),所以 .dev/shoot.js 在拍之前把它去掉。
This commit is contained in:
2026-10-14 19:37:59 +08:00
parent 4f7a142a39
commit 7fdebe3ec7
4 changed files with 24 additions and 10 deletions
+12 -6
View File
@@ -376,19 +376,25 @@ export function startPreview(client: StreamClient, emit: (msg: WireMsg) => void)
}, 50);
// 掉血:每 3 秒一次,轮流打两块板子,顺便把命中反馈也验证了。
//
// 打空的那一拍只做重置、不出命中("已击毁"的状态要真的能看到),其余每一拍都出一次
// 命中。早先的写法是 `to = from === 0 ? 100 : ...` 然后按 `to >= from` 判断——那样一旦
// 两块都打空,之后每次都是重置,命中就再也不会出现,盯着界面等闪红会等到超时。
let tick = 0;
const hitTimer = window.setInterval(() => {
tick += 1;
const team = tick % 2;
const damage = 3 + ((tick * 7) % 20);
if (state.hp[team] === 0) {
state.hp[team] = 100;
return;
}
const from = state.hp[team];
const to = from === 0 ? 100 : Math.max(0, from - damage);
// 打空之后重置成满血:界面上"已击毁"的状态要真的能看到。
const damage = 3 + ((tick * 7) % 20);
const to = Math.max(0, from - damage);
state.hp[team] = to;
if (to >= from) return;
emit({
t: "hit",
board: team === 0 ? ARMOR_A : ARMOR_B,