summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'client/elm/battlemap/src/View')
-rw-r--r--client/elm/battlemap/src/View/Controls.elm12
-rw-r--r--client/elm/battlemap/src/View/Status.elm48
2 files changed, 36 insertions, 24 deletions
diff --git a/client/elm/battlemap/src/View/Controls.elm b/client/elm/battlemap/src/View/Controls.elm
index 203fcdb..be698bf 100644
--- a/client/elm/battlemap/src/View/Controls.elm
+++ b/client/elm/battlemap/src/View/Controls.elm
@@ -5,27 +5,27 @@ import Html.Events
import Battlemap.Direction
-import Update
+import Event
-direction_button : Battlemap.Direction.Type -> String -> (Html.Html Update.Type)
+direction_button : Battlemap.Direction.Type -> String -> (Html.Html Event.Type)
direction_button dir label =
(Html.button
[
(Html.Events.onClick
- (Update.DirectionRequest dir)
+ (Event.DirectionRequest dir)
)
]
[ (Html.text label) ]
)
-end_turn_button : (Html.Html Update.Type)
+end_turn_button : (Html.Html Event.Type)
end_turn_button =
(Html.button
- [ (Html.Events.onClick Update.EndTurn) ]
+ [ (Html.Events.onClick Event.EndTurn) ]
[ (Html.text "End Turn") ]
)
-view : (List (Html.Html Update.Type))
+view : (List (Html.Html Event.Type))
view =
[
(direction_button Battlemap.Direction.Left "Left"),
diff --git a/client/elm/battlemap/src/View/Status.elm b/client/elm/battlemap/src/View/Status.elm
index 3a06572..a7beb28 100644
--- a/client/elm/battlemap/src/View/Status.elm
+++ b/client/elm/battlemap/src/View/Status.elm
@@ -4,27 +4,39 @@ import Dict
import Html
-import Update
+import Error
+import Event
import Model
-view : Model.Type -> (Html.Html Update.Type)
+moving_character_text : Model.Type -> String
+moving_character_text model =
+ case model.selection of
+ Nothing -> "Error: no model.selection."
+ (Just selection) ->
+ case (Dict.get selection.character model.characters) of
+ Nothing -> "Error: Unknown character selected."
+ (Just char) ->
+ (
+ "Controlling "
+ ++ char.name
+ ++ ": "
+ ++ (toString selection.navigator.remaining_points)
+ ++ "/"
+ ++ (toString char.movement_points)
+ ++ " movement points remaining."
+ )
+
+view : Model.Type -> (Html.Html Event.Type)
view model =
(Html.text
- (case (model.state, model.navigator) of
- (_, Nothing) -> ""
- ((Model.MovingCharacter 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."
- )
- (_, _) -> ""
+ (case model.state of
+ Model.Default -> "Click on a character to control it."
+ Model.MovingCharacterWithButtons -> (moving_character_text model)
+ Model.MovingCharacterWithClick -> (moving_character_text model)
+ Model.FocusingTile -> "Error: Unimplemented."
+ (Model.Error Error.Programming) ->
+ "Error of programming, please report."
+ (Model.Error Error.IllegalAction) ->
+ "This cannot be done while in this state."
)
)