summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop/M6Presentation.fs
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-22 00:35:03 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-22 00:35:03 +0800
commit1cef3b1544ff8574c7b56bc1a84e3be0846a9b22 (patch)
tree5aa705bf3e9cfe82e5e3637cdc699bc52f93c559 /src/LivingVillage.Desktop/M6Presentation.fs
parent1f1c502ba750c4c55ac2aca28eacafcd0c3ae932 (diff)
parent81a84f9f86d59387a349caa339148c7a7a6d1e72 (diff)
downloadliving-village-1cef3b1544ff8574c7b56bc1a84e3be0846a9b22.tar.gz
merge: P16 启动画面/开始界面/HUD 精美化(独立复验全绿 Desktop 106/Kernel 89)
Diffstat (limited to 'src/LivingVillage.Desktop/M6Presentation.fs')
-rw-r--r--src/LivingVillage.Desktop/M6Presentation.fs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop/M6Presentation.fs b/src/LivingVillage.Desktop/M6Presentation.fs
index ea8fd2f..65300f0 100644
--- a/src/LivingVillage.Desktop/M6Presentation.fs
+++ b/src/LivingVillage.Desktop/M6Presentation.fs
@@ -63,3 +63,25 @@ module M6Presentation =
| OneX -> "1倍速"
| TwoX -> "2倍速"
| FiveX -> "5倍速"
+
+ /// 倍速标签(语义别名,HUD 用)。
+ let speedLabel (control: SimulationControl) : string = clockLabel control
+
+ let private hourOf (tick: int64) : int =
+ int ((tick / (Sim.ticksPerDay / 24L)) % 24L)
+
+ /// 24 小时制的模拟时钟(HH:MM),由 tick 纯函数导出。
+ let clockTimeLabel (tick: int64) : string =
+ let hourTicks = Sim.ticksPerDay / 24L
+ let hour = hourOf tick
+ let minute = int ((tick % hourTicks) * 60L / hourTicks)
+ sprintf "%02d:%02d" hour minute
+
+ /// 时段标签:清晨/白天/黄昏/夜晚,与实际 tick 一致(纯函数)。
+ let timePeriodLabel (tick: int64) : string =
+ let hour = hourOf tick
+ if hour < 5 then "夜晚"
+ elif hour < 8 then "清晨"
+ elif hour < 17 then "白天"
+ elif hour < 20 then "黄昏"
+ else "夜晚"