diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-22 00:10:18 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-22 00:10:18 +0800 |
| commit | f79839a4bb57b977b7208e5f826a8b0989cbc33e (patch) | |
| tree | cf0c105b114102bfbb73b3c8d400e83614b861be /src/LivingVillage.Desktop/M6Presentation.fs | |
| parent | d85cce460fd7fbb8854fb11ba547be1baf576de7 (diff) | |
| download | living-village-f79839a4bb57b977b7208e5f826a8b0989cbc33e.tar.gz | |
feat(desktop): P16 HUD 顶部窄信息条(时段/时间/倍速/体力/钱币)+ 冬夜冷色 + 面板/提示渐变重绘
Diffstat (limited to 'src/LivingVillage.Desktop/M6Presentation.fs')
| -rw-r--r-- | src/LivingVillage.Desktop/M6Presentation.fs | 22 |
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 "夜晚" |
