Show discards

This commit is contained in:
Correl Roush 2017-11-21 19:51:54 -05:00
parent d29dc79583
commit 076586eb1b
3 changed files with 10 additions and 2 deletions

View file

@ -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 )

View file

@ -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

View file

@ -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