diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-21 11:48:37 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-21 11:48:37 +0800 |
| commit | ac4fd29899e2fed8cb53d771325994ed481eae6b (patch) | |
| tree | c0efc4a77fd909eb77936f3fd5412cad5418aefd /src/LivingVillage.Desktop/Game.fs | |
| parent | b13b28521f4b286d9a750848c7940546cf50adf3 (diff) | |
| download | living-village-ac4fd29899e2fed8cb53d771325994ed481eae6b.tar.gz | |
feat(desktop): P 键暂停帮助页
P 键改为打开暂停帮助页(完整键位说明),打开时暂停模拟并保留原控制状态,返回游戏时精确恢复(速度/暂停原状);常驻 HUD 不放全键位清单。MenuState 新增 enterPauseHelp/exitPauseHelp 纯函数与回归测试。
Diffstat (limited to 'src/LivingVillage.Desktop/Game.fs')
| -rw-r--r-- | src/LivingVillage.Desktop/Game.fs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/LivingVillage.Desktop/Game.fs b/src/LivingVillage.Desktop/Game.fs index 785a6aa..9e229aa 100644 --- a/src/LivingVillage.Desktop/Game.fs +++ b/src/LivingVillage.Desktop/Game.fs @@ -145,6 +145,7 @@ type LivingVillageGame() as this = let mutable hudClock = 0L let mutable hudStatus = "" let mutable hudStatusAt = 0L + let mutable pauseHelpControl: SimulationControl option = None do graphics.PreferredBackBufferWidth <- 1280 @@ -280,9 +281,12 @@ type LivingVillageGame() as this = let lPressed = pressed Keys.L let escapePressed = pressed Keys.Escape if pressed Keys.P then - simulationControl <- SimulationControl.togglePause simulationControl - menu <- MenuState.setSettings simulationControl menu - printfn $"simulation={M6Presentation.clockLabel simulationControl}" + if m5View.Panel = WorldPanel then + let helpState, pausedControl = MenuState.enterPauseHelp simulationControl menu + menu <- helpState + pauseHelpControl <- Some simulationControl + simulationControl <- pausedControl + printfn $"help=pause-open simulation={M6Presentation.clockLabel simulationControl}" if pressed Keys.F1 then simulationControl <- SimulationControl.setSpeed OneX simulationControl legacyStepsPerFrame <- None @@ -443,6 +447,13 @@ type LivingVillageGame() as this = this.UpdatePlaying gameTime kb pressed pressedAny else this.UpdateMenu pressed + match pauseHelpControl with + | Some original when menu.Page = Playing -> + let _, restoredControl = MenuState.exitPauseHelp original menu + simulationControl <- restoredControl + pauseHelpControl <- None + printfn $"help=pause-close simulation={M6Presentation.clockLabel simulationControl}" + | _ -> () hudClock <- hudClock + 1L if m5View.Status <> hudStatus then hudStatus <- m5View.Status |
