From 33e57128d48a012533c42635f52037fcdedd4c56 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Tue, 26 Sep 2017 19:13:04 +0200 Subject: Range indicators are now clickable. --- client/elm/battlemap/src/View/Status.elm | 48 ++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 18 deletions(-) (limited to 'client/elm/battlemap/src/View/Status.elm') 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." ) ) -- cgit v1.2.3-70-g09d2