Skip to content

Commit

Permalink
Add a button to advance the phase
Browse files Browse the repository at this point in the history
  • Loading branch information
mwunsch committed Nov 9, 2016
1 parent 2370ad0 commit 6d24d36
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion src/Main.elm
Expand Up @@ -5,7 +5,7 @@ import Array
import Gang exposing (Gang)
import Html exposing (Html)
import Html.App as App
import Html.Events exposing (on)
import Html.Events exposing (on, onClick)
import Json.Decode as Json exposing ((:=))
import Keyboard
import List exposing (map)
Expand Down Expand Up @@ -83,6 +83,7 @@ type Msg
| Click Mouse.Position
| Command Action
| Complete Action
| Advance
| Hover Mouse.Position
| KeyPress Keyboard.KeyCode
| Resize Int
Expand Down Expand Up @@ -195,6 +196,14 @@ update msg game =
, Cmd.none
)

Advance ->
( { game
| turn = Turn.advance game.turn
, player = Player.deselectAll game.player
}
, Cmd.none
)

Hover { x, y } ->
game.player
|> (\player -> { player | movementIntention = positionFromMouseCoords ( x, y ) game })
Expand Down Expand Up @@ -356,6 +365,28 @@ view game =
]
(textNode msg)

phaseAdvancement =
let
msg =
case game.contextMessage of
Just _ ->
textNode ""

Nothing ->
textNode ""
in
text'
[ y "-2.5"
, x "65%"
, fill "red"
, fontSize "2"
, fontFamily "monospace"
, textAnchor "middle"
, onClick Advance
, Svg.Attributes.cursor "pointer"
]
msg

selectedFighterProfile =
Player.getSelectedGangMember game.player
|> Maybe.map Model.viewProfile
Expand Down Expand Up @@ -408,6 +439,7 @@ view game =
]
[ definitions
, contextMessage
, phaseAdvancement
, selectedFighterProfile
, controls
, gameplay
Expand Down

0 comments on commit 6d24d36

Please sign in to comment.