summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop/M6Presentation.fs
blob: 8e13183a041c63d923134035d5f98fe2e3f63190 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
namespace LivingVillage.Desktop

open Microsoft.Xna.Framework
open LivingVillage.Kernel
open LivingVillage.Kernel.Sim

type M6DayNight =
    | Day
    | Night

type M6RenderProfile =
    { Mode: M6DayNight
      Background: Color
      WorldTint: Color }

module M6Presentation =

    let dayNightLabel mode : string =
        match mode with
        | Day -> "白天"
        | Night -> "夜晚"

    let profileAtTick (tick: int64) : M6RenderProfile =
        if Sim.isNightTick tick then
            { Mode = Night
              Background = Color(18, 25, 55)
              WorldTint = Color(118, 136, 184) }
        else
            { Mode = Day
              Background = Color(100, 160, 210)
              WorldTint = Color(255, 248, 224) }

    let clockLabel (control: SimulationControl) : string =
        if control.Paused then
            "暂停"
        else
            match control.Speed with
            | OneX -> "1倍速"
            | TwoX -> "2倍速"
            | FiveX -> "5倍速"