diff options
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 "夜晚" |
