marcelmorgan / domino-ui / Game

This makes is possible to represent a domino game using elm

Definition


type Game

Represents a Game

Common Helpers

addChatMessage : Player.Message.Message -> Game -> Game

adds a new chat message to the player chat

clearChatDraft : Game -> Game

clear the draft being composed usually as a result of a message being sent

closeChat : Game -> Game

close previously opened chat

composeChat : String -> Game -> Game

Updates the draft of the chat being composed

decoder : Player Player.Name -> Browser.Dom.Viewport -> ConnectionStatus -> Json.Decode.Decoder Game

Decodes a game from JSON representation

decoder (Me "nexus") { width = 100, height = 200, ...} Online == <Decoder Game>

encodePlay : Domino.Play.Play -> Game -> Json.Encode.Value

Encode a play with the game ID

encodePlay play game == <encoded-play>

errorToString : Error -> String

Returns the string representation of the game error

executeEvent : Event -> Game -> Result Error Game

Execute the event staged

getChatDraft : Game -> Maybe String

Returns the current chat draft being typed

getId : Game -> Id.GameId

Returns the game id

getId game == 3

getTimesoutAt : Game -> Maybe Basics.Int

Returns the timeout for the current game

hasChat : Game -> Basics.Bool

Does this game have chat feature?

isResumable : Game -> Basics.Bool

Can this game be resumed? Useful in situations where the game has been dormant and the first player opens the game

isSetCompleted : Game -> Basics.Bool

Is this game set completed?

isUpdating : Game -> Basics.Bool

So we know if the game is currently updating. This is useful if we want to know if we can apply updates just received

moveSelectedBack : Game -> Game

Push selected back in the hand

moveSelectedBack game == game

moveSelectedBy : ( Basics.Float, Basics.Float ) -> Game -> Game

Move the selected domino by the delta provided

moveSelectedBy ( 3, 4 ) game == game

nextRoundStartedTimeout : Game -> Maybe Basics.Int

Returns the timeout if a next round is just started

nextRoundStartedTimeout game == Just 25

openChat : Game -> Game

Opens the game chat

roundNextEvent : Game -> Maybe Event

Returns the next event for the current round

roundNextEvent game == Just event

selectDomino : Domino -> List End -> Game -> Result Error ( Game, NonEmptyList Domino.Highlighter.Highlighter )

Select a domino for play

setConnectionStatus : ConnectionStatus -> Game -> Game

Sets the connection status of the user so the user can be alerted

setNextGame : Game -> Game -> Game

Sets next game update usually as a result of a new game update receieved

setViewport : Maybe Browser.Dom.Viewport -> Game -> Game

Sets the viewport based on browser changes

slug : Game -> String

Returns the game slug useful for building a url

slug game == "3"

stageEvent : Event -> Game -> Game

Stage the event

switchToNextGame : Game -> Game

Switch to the next game

switchToNextRoundGame : Game -> Game

Switch to the next round

updateDecoder : Game -> Json.Decode.Decoder Game

Decodes an update of an existing game from one that was already decoded

view : Game -> Html.Styled.Html (Player.Msg Domino)

Produced the HTML representation of the game

view game == "<game-html>"