mirror of
https://github.com/correl/riichi.git
synced 2024-11-23 19:19:55 +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 =
|
socketMsg message =
|
||||||
let
|
let
|
||||||
splitMsg =
|
splitMsg =
|
||||||
case String.split ":" message of
|
case String.split ":" (Debug.log "message" message) of
|
||||||
msgType :: rest ->
|
msgType :: rest ->
|
||||||
Just ( msgType, String.join ":" rest )
|
Just ( msgType, String.join ":" rest )
|
||||||
|
|
||||||
|
|
|
@ -49,11 +49,12 @@ wind =
|
||||||
|
|
||||||
player : Decoder Player
|
player : Decoder Player
|
||||||
player =
|
player =
|
||||||
map4 Player
|
map5 Player
|
||||||
(field "name" <| map (\s -> s == "Websocket") string)
|
(field "name" <| map (\s -> s == "Websocket") string)
|
||||||
(field "name" string)
|
(field "name" string)
|
||||||
(field "seat" wind)
|
(field "seat" wind)
|
||||||
(field "hand" hand)
|
(field "hand" hand)
|
||||||
|
(field "discards" (list tile))
|
||||||
|
|
||||||
|
|
||||||
game : Decoder Game
|
game : Decoder Game
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
module Client.Player exposing (..)
|
module Client.Player exposing (..)
|
||||||
|
|
||||||
import Client.Hand exposing (Hand)
|
import Client.Hand exposing (Hand)
|
||||||
|
import Tile exposing (Tile)
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
|
|
||||||
type Wind = East | South | West | North
|
type Wind = East | South | West | North
|
||||||
|
@ -10,6 +11,7 @@ type alias Player =
|
||||||
, name : String
|
, name : String
|
||||||
, seat : Wind
|
, seat : Wind
|
||||||
, hand : Hand
|
, hand : Hand
|
||||||
|
, discards : List Tile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,4 +20,9 @@ view player =
|
||||||
fieldset []
|
fieldset []
|
||||||
[ legend [] [ text ("Player: " ++ player.name ++ "(" ++ (toString player.seat) ++ ")") ]
|
[ legend [] [ text ("Player: " ++ player.name ++ "(" ++ (toString player.seat) ++ ")") ]
|
||||||
, Client.Hand.view player.hand player.isMe
|
, 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