mirror of
https://github.com/correl/riichi.git
synced 2024-11-27 11:09:56 +00:00
Show discards
This commit is contained in:
parent
d29dc79583
commit
076586eb1b
3 changed files with 10 additions and 2 deletions
|
@ -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 )
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue