summaryrefslogtreecommitdiff
blob: 2ea5972294749b8672943af4cb963010fe77644a (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
module View exposing (view)

import Dict

import Html
import Html.Events

import Battlemap.Direction
import Battlemap.Html

import Update
import Model


-- VIEW

view : Model.Type -> (Html.Html Update.Type)
view model =
   (Html.div
      []
      [
         (Html.button
            [
               (Html.Events.onClick
                  (Update.DirectionRequest Battlemap.Direction.Left)
               )
            ]
            [ (Html.text "Left") ]
         ),
         (Html.button
            [
               (Html.Events.onClick
                  (Update.DirectionRequest Battlemap.Direction.Down)
               )
            ]
            [ (Html.text "Down") ]
         ),
         (Html.button
            [
               (Html.Events.onClick
                  (Update.DirectionRequest Battlemap.Direction.Up)
               )
            ]
            [ (Html.text "Up") ]
         ),
         (Html.button
            [
               (Html.Events.onClick
                  (Update.DirectionRequest Battlemap.Direction.Right)
               )
            ]
            [ (Html.text "Right") ]
         ),
         (Html.button
            [ (Html.Events.onClick Update.EndTurn) ]
            [ (Html.text "Apply") ]
         ),
         (Html.div
            []
            [(Battlemap.Html.view model)]
         ),
         (Html.div
            []
            [
               (Html.text
                  (case (model.selection, model.navigator) of
                     (Nothing, _) -> ""
                     (_, Nothing) -> ""
                     ((Just char_id), (Just nav)) ->
                        case (Dict.get char_id model.characters) of
                           Nothing -> ""
                           (Just char) ->
                              (
                                 "Controlling "
                                 ++ char.name
                                 ++ ": "
                                 ++ (toString nav.remaining_points)
                                 ++ "/"
                                 ++ (toString char.movement_points)
                                 ++ " movement points remaining."
                              )
                  )
               )
            ]
         )
      ]
   )