summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-09-18 18:15:59 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-09-18 18:15:59 +0200
commit0b9096ed0c66db403c244a4720bac60326a40394 (patch)
tree233d01b0b04463c3c8db7e20f3c3152f73427a34 /client/elm/battlemap/src/Battlemap/Html.elm
parentc9786fd27954c79faf901963003a8b7b3131ca4c (diff)
Character-focused navigators.
Diffstat (limited to 'client/elm/battlemap/src/Battlemap/Html.elm')
-rw-r--r--client/elm/battlemap/src/Battlemap/Html.elm69
1 files changed, 47 insertions, 22 deletions
diff --git a/client/elm/battlemap/src/Battlemap/Html.elm b/client/elm/battlemap/src/Battlemap/Html.elm
index 9f519d1..dc90ed4 100644
--- a/client/elm/battlemap/src/Battlemap/Html.elm
+++ b/client/elm/battlemap/src/Battlemap/Html.elm
@@ -1,32 +1,57 @@
module Battlemap.Html exposing (view)
import Html exposing (Html, text, table, tr, td)
+import Html.Events exposing (onClick)
+
-- import List as Lt exposing (map)
import Array as Ay exposing (foldr)
-import Update exposing (Msg)
+import Update exposing (Msg(..))
import Model exposing (Model)
import Battlemap exposing (Battlemap, random)
import Battlemap.Tile exposing (Tile)
-import Battlemap.Direction exposing (..)
+import Battlemap.Direction exposing (Direction(..))
view_battlemap_cell : Tile -> (Html Msg)
view_battlemap_cell t =
- (td
- []
- [
- (text
- (case t.nav_level of
- Right -> "R"
- Left -> "L"
- Up -> "U"
- Down -> "D"
- None -> (toString t.floor_level)
- )
+ case t.char_level of
+ Nothing ->
+ (td
+ []
+ [
+ (text "[_]"),
+ (text
+ (
+ (case t.nav_level of
+ Right -> "R"
+ Left -> "L"
+ Up -> "U"
+ Down -> "D"
+ None -> (toString t.floor_level)
+ )
+ )
+ )
+ ]
+ )
+ (Just char_id) ->
+ (td
+ [ (onClick (SelectCharacter char_id)) ]
+ [
+ (text ("[" ++ char_id ++ "]")),
+ (text
+ (
+ (case t.nav_level of
+ Right -> "R"
+ Left -> "L"
+ Up -> "U"
+ Down -> "D"
+ None -> (toString t.floor_level)
+ )
+ )
+ )
+ ]
)
- ]
- )
type alias GridBuilder =
{
@@ -37,21 +62,21 @@ type alias GridBuilder =
}
foldr_to_html : Tile -> GridBuilder -> GridBuilder
-foldr_to_html t bg =
- if (bg.row_size == bg.bmap.width)
+foldr_to_html t gb =
+ if (gb.row_size == gb.bmap.width)
then
- {bg |
+ {gb |
row = [(view_battlemap_cell t)],
row_size = 1,
columns =
(
- (tr [] bg.row) :: bg.columns
+ (tr [] gb.row) :: gb.columns
)
}
else
- {bg |
- row = ((view_battlemap_cell t) :: bg.row),
- row_size = (bg.row_size + 1)
+ {gb |
+ row = ((view_battlemap_cell t) :: gb.row),
+ row_size = (gb.row_size + 1)
}
grid_builder_to_html : GridBuilder -> (List (Html Msg))