feedback5 WAC: players rebind the in-match shortcuts in 设置 → 快捷键 (community request 「快捷键可不可以自己设置」, the owner's decision of 2026-10-07)

- The settings (sp.pref.settings) hold a key map, action → KeyboardEvent.code, for refresh / freeze / level-up /
  retreat / sell / ready (the ready key also pauses a solo battle); the defaults are the 0.1.4 keys R F D Q X Space,
  so nothing changes for a player who never opens the section. sanitizeSettings keeps each saved key that may be a
  shortcut and gives any other its default; not a map, or two actions on one key, gives the defaults.
- One lookup, actionForKey (the character typed first, then the physical key: the 0.1.4 code-or-key match, identical
  for the defaults), serves shortcutFor(e, keys) in game.js and the facing wheel; the modifier, text-field, repeat and
  overlay guards are unchanged. The shop bar, ready / pause and underframe key hints read the map.
- 设置 → 快捷键 (the one SettingsModal, in a match and on the title screen): each action with its key; click or Enter
  waits, the next key binds; Esc cancels (the dialog stays open), Tab leaves; Ctrl / Alt / ⌘ combinations and the
  interface keys (Esc, Tab, Enter, arrows, F1–F12) are refused; a key in use is swapped and the line under the list
  names both; 恢复默认. Esc stays fixed. Touch-only devices: a keyboard note and a folded list; one column under 768 px.
- Tests: test/ui/feedback5-hotkeys.test.js (map, sanitising, conflicts, lookup, capture, handlers and hints with a
  rebound key), test/ui/gameLogic.test.js (sanitizeSettings now returns keys), test/ui/hotkeys.e2e.test.js (SP_E2E=1:
  撤退 rebound to W with the keyboard only in the mock match; phone width).

Golden unchanged (client UI only).
This commit is contained in:
sganggs committed 2026-10-07 01:56:19 +08:00
1 parent 30d9a41c51
commit f2bec76176
14 files changed
+772 -61

No files matched your search

+28 -12
View File
@@ -138,7 +138,7 @@
"显示伤害数字": "Damage Numbers",
"画面质量": "Graphics Quality",
"触屏操作:点击单位选中(撤退 / 出售)· 长按单位或卡牌查看详情 · 拖动部署后滑动选择朝向": "Touch controls: tap a unit to select it (Retreat / Sell) · long-press a unit or card for details · after dragging to deploy, swipe to choose a direction",
"快捷键:": "Hotkeys: ",
"快捷键": "Hotkeys",
"发生未知错误": "An unknown error occurred",
"标准模拟": "Standard Simulation",
"险境模拟": "Perilous Simulation",
@@ -610,8 +610,8 @@
"休整期可以查看即将迎击的敌方单位": "Upcoming enemies can be viewed during the Rest Phase",
"已流失": "Lost",
"暂停": "Pause",
"继续作战(Space)": "Resume Battle (Space)",
"暂停作战(Space)": "Pause Battle (Space)",
"继续作战({key})": "Resume Battle ({key})",
"暂停作战({key})": "Pause Battle ({key})",
"离开 / 暂离": "Leave / Step Away",
"部署费用(再部署消耗)": "DP Cost (spent on redeploy)",
"攻击力": "ATK",
@@ -660,7 +660,7 @@
"已购买": "Purchased",
"已招募": "Recruited",
"再次点击确认升级({price} 资金)": "Tap again to confirm upgrade ({price} Funds)",
"升级调度中心({price} 资金) · D": "Upgrade Dispatch Center ({price} Funds) · D",
"升级调度中心({price} 资金) · {key}": "Upgrade Dispatch Center ({price} Funds) · {key}",
"已满级": "Max Level",
"确认升级": "Confirm Upgrade",
"稍后选择(回合结束后消失)": "Pick later (expires at the end of the round)",
@@ -670,10 +670,10 @@
"剩余可放置角色:": "Deployable units left:",
"目前资金": "Current Funds",
"收起": "Collapse",
"解冻商店 · F": "Unfreeze Shop · F",
"冻结商店(下回合保留) · F": "Freeze Shop (kept next round) · F",
"解冻商店 · {key}": "Unfreeze Shop · {key}",
"冻结商店(下回合保留) · {key}": "Freeze Shop (kept next round) · {key}",
"解冻": "Unfreeze",
"刷新商店 · R": "Refresh Shop · R",
"刷新商店 · {key}": "Refresh Shop · {key}",
"免费 ×{free}": "Free ×{free}",
"查看 {name} 的战场": "View {name}'s Battlefield",
"查看自己的阵地": "View your Field",
@@ -765,9 +765,25 @@
"toggle::关闭": "Off",
"撤退选中干员": "Retreat selected Operator",
"出售选中干员": "Sell selected Operator",
"关闭弹窗": "Close window",
"取消 / 关闭": "Cancel / Close",
"语言": "Language",
"右键查看详情": "Right-click for details",
"刷新商店": "Refresh Shop",
"冻结 / 解冻商店": "Freeze / Unfreeze Shop",
"升级调度中心": "Upgrade Dispatch Center",
"准备就绪 / 暂停(独立模拟)": "Ready / Pause (Solo)",
"不可更改": "Fixed",
"按下新按键…": "Press a key…",
"更改「{action}」的快捷键(当前:{key})": "Change the hotkey for {action} (now {key})",
"请按下「{action}」的新按键(Esc 取消)": "Press the new key for {action} (Esc to cancel)",
"「{action}」已改为 {key}": "{action} is now {key}",
"「{action}」已改为 {key};「{other}」原来用 {key},已换成 {old}": "{action} is now {key}; {other} had {key} and now uses {old}",
"{key} 不能设为快捷键:Esc、Tab、Enter、方向键和功能键留给界面使用": "{key} cannot be a hotkey: Esc, Tab, Enter, the arrow keys and the function keys belong to the interface",
"快捷键只能是单个按键,不能搭配 Ctrl、Alt 或 ⌘": "A hotkey is a single key, without Ctrl, Alt or ⌘",
"已取消,「{action}」仍是 {key}": "Cancelled: {action} stays {key}",
"已恢复默认快捷键": "Default hotkeys restored",
"快捷键需要实体键盘;触屏设备连接键盘后可用": "Hotkeys need a physical keyboard; connect one to use them on a touch device",
"查看 / 更改快捷键": "Show / change hotkeys",
"观战中无法进行该操作": "Spectators cannot do that",
"标准": "Standard",
"险境": "Perilous",
@@ -1001,10 +1017,10 @@
"目标生命值 {lp},联防中,结算时扣除至多 {pending} 点": "LP {lp}, Unite in progress: settlement costs up to {pending} LP",
"目标生命值 {lp},结算时扣除 {pending} 点": "LP {lp}: settlement costs {pending} LP",
"{name} 操作": "{name} actions",
"撤退至整备区(Q)": "Retreat to Bench (Q)",
"撤退[Q]": "Retreat [Q]",
"出售(+{sell} 资金,X)": "Sell (+{sell} Funds, X)",
"出售[X]": "Sell [X]",
"撤退至整备区({key})": "Retreat to Bench ({key})",
"撤退[{key}]": "Retreat [{key}]",
"出售(+{sell} 资金,{key})": "Sell (+{sell} Funds, {key})",
"出售[{key}]": "Sell [{key}]",
"临时整备区 {n} 件道具待处理": "Temporary Bench: {n} {count|item|items} pending",
"{name}:部分盟约所含干员阵容不完整({bannedN} 名干员无法出现)": "{name}: some of the Alliance's Operators cannot appear ({bannedN} {bannedN|Operator|Operators} banned)",
"{name}:部分盟约所含干员阵容不完整": "{name}: some of the Alliance's Operators cannot appear",