summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop/MenuState.fs
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-21 11:48:37 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-21 11:48:37 +0800
commitac4fd29899e2fed8cb53d771325994ed481eae6b (patch)
treec0efc4a77fd909eb77936f3fd5412cad5418aefd /src/LivingVillage.Desktop/MenuState.fs
parentb13b28521f4b286d9a750848c7940546cf50adf3 (diff)
downloadliving-village-ac4fd29899e2fed8cb53d771325994ed481eae6b.tar.gz
feat(desktop): P 键暂停帮助页
P 键改为打开暂停帮助页(完整键位说明),打开时暂停模拟并保留原控制状态,返回游戏时精确恢复(速度/暂停原状);常驻 HUD 不放全键位清单。MenuState 新增 enterPauseHelp/exitPauseHelp 纯函数与回归测试。
Diffstat (limited to 'src/LivingVillage.Desktop/MenuState.fs')
-rw-r--r--src/LivingVillage.Desktop/MenuState.fs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop/MenuState.fs b/src/LivingVillage.Desktop/MenuState.fs
index 452d233..2848e22 100644
--- a/src/LivingVillage.Desktop/MenuState.fs
+++ b/src/LivingVillage.Desktop/MenuState.fs
@@ -153,6 +153,11 @@ module MenuState =
let openControls (state: MenuState) : MenuState =
{ state with Page = Controls; Selected = 0; ReturnPage = state.Page; Error = None }
+ /// P key: open the full key list as a pause-help page. The simulation is paused while
+ /// the page is open; the caller keeps the previous control and restores it on exit.
+ let enterPauseHelp (control: SimulationControl) (state: MenuState) : MenuState * SimulationControl =
+ openControls state, { control with Paused = true }
+
let showLoadError (message: string) (state: MenuState) : MenuState =
{ state with Page = LoadError; Selected = 0; ReturnPage = MainMenu; Error = Some message }
@@ -161,6 +166,11 @@ module MenuState =
| Playing -> { state with Page = Playing; Selected = 0; Error = None }
| _ -> openMain state
+ /// Leaving the pause-help page returns to the page it was opened from and restores
+ /// the exact simulation control the player had before.
+ let exitPauseHelp (original: SimulationControl) (state: MenuState) : MenuState * SimulationControl =
+ returnFromSubpage state, original
+
let private confirmMain (state: MenuState) : MenuState * MenuCommand =
match selectedItem state with
| ContinueItem -> enterGame state, ContinueGame