diff --git a/priv/src/Client.elm b/priv/src/Client.elm index 96a8a4b..fe53746 100644 --- a/priv/src/Client.elm +++ b/priv/src/Client.elm @@ -55,7 +55,7 @@ socketMsg : String -> Maybe Msg socketMsg message = let splitMsg = - case String.split ":" message of + case String.split ":" (Debug.log "message" message) of msgType :: rest -> Just ( msgType, String.join ":" rest ) diff --git a/priv/src/Client/Decode.elm b/priv/src/Client/Decode.elm index 26ce15d..3016c77 100644 --- a/priv/src/Client/Decode.elm +++ b/priv/src/Client/Decode.elm @@ -49,11 +49,12 @@ wind = player : Decoder Player player = - map4 Player + map5 Player (field "name" <| map (\s -> s == "Websocket") string) (field "name" string) (field "seat" wind) (field "hand" hand) + (field "discards" (list tile)) game : Decoder Game diff --git a/priv/src/Client/Player.elm b/priv/src/Client/Player.elm index 621ddd3..0d8c90f 100644 --- a/priv/src/Client/Player.elm +++ b/priv/src/Client/Player.elm @@ -1,6 +1,7 @@ module Client.Player exposing (..) import Client.Hand exposing (Hand) +import Tile exposing (Tile) import Html exposing (..) type Wind = East | South | West | North @@ -10,6 +11,7 @@ type alias Player = , name : String , seat : Wind , hand : Hand + , discards : List Tile } @@ -18,4 +20,9 @@ view player = fieldset [] [ legend [] [ text ("Player: " ++ player.name ++ "(" ++ (toString player.seat) ++ ")") ] , Client.Hand.view player.hand player.isMe + , viewDiscards player.discards ] + +viewDiscards : List Tile -> Html msg +viewDiscards tiles = + div [] <| List.map Tile.view tiles