Using the new «public» Game type in Messages, will need to re-import everything that was done in the server's Game module before
This commit is contained in:
parent
607b253f3b
commit
2b196c0075
1 changed files with 10 additions and 2 deletions
|
@ -7,6 +7,7 @@ module Hanafuda.Message (
|
|||
T(..)
|
||||
, FromClient(..)
|
||||
, PlayerStatus(..)
|
||||
, PublicGame
|
||||
, Room
|
||||
) where
|
||||
|
||||
|
@ -23,7 +24,7 @@ import qualified Data.Text as Text (pack)
|
|||
import GHC.Generics (Generic)
|
||||
import qualified Hanafuda (Card(..))
|
||||
import Hanafuda.Key (Key(..), getKey)
|
||||
import Hanafuda.KoiKoi (PlayerKey)
|
||||
import Hanafuda.KoiKoi (PlayerKey, GameBlueprint(..))
|
||||
import qualified Hanafuda.KoiKoi as KoiKoi (Action(..), Game(..), Move(..), Source(..))
|
||||
|
||||
deriving instance Generic PlayerKey
|
||||
|
@ -84,11 +85,18 @@ instance ToJSON KoiKoi.Source
|
|||
deriving instance Generic KoiKoi.Action
|
||||
instance ToJSON KoiKoi.Action
|
||||
|
||||
type PublicGame = GameBlueprint Int
|
||||
|
||||
deriving instance Generic PublicGame
|
||||
instance FromJSON PublicGame
|
||||
instance ToJSON PublicGame where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
|
||||
data T =
|
||||
Relay {from :: PlayerKey, message :: FromClient}
|
||||
| Welcome {room :: Room, key :: PlayerKey}
|
||||
| Update {alone :: [PlayerKey], paired :: [PlayerKey]}
|
||||
| Game {game :: Value, logs :: [KoiKoi.Action]}
|
||||
| Game {game :: PublicGame, logs :: [KoiKoi.Action]}
|
||||
| Pong
|
||||
| Error {error :: String}
|
||||
deriving (Generic)
|
||||
|
|
Loading…
Reference in a new issue