This repository was archived by the owner on Jun 20, 2019. It is now read-only.
File tree 3 files changed +16
-3
lines changed
3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ type Translation
44
44
| WithdrawCashButton
45
45
| ReturnToGameButton
46
46
| SeePriceRangesButton
47
+ | RestartGameButton
47
48
48
49
49
50
translate : Language -> Translation -> String
@@ -208,6 +209,9 @@ translate language trans =
208
209
209
210
ReturnToGameButton ->
210
211
TranslationSet " Return to game" " Return to game"
212
+
213
+ RestartGameButton ->
214
+ TranslationSet " Play again?" " Play again?"
211
215
in
212
216
case language of
213
217
DrugWars ->
Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ type Msg
111
111
| BorrowMax
112
112
| SeePrices
113
113
| ReturnToGame
114
+ | RestartGame
114
115
115
116
116
117
update : Msg -> Model -> ( Model , Cmd Msg )
@@ -152,6 +153,9 @@ update msg model =
152
153
ReturnToGame ->
153
154
( { model | gameState = Running }, Cmd . none )
154
155
156
+ RestartGame ->
157
+ initialModelAndEffects
158
+
155
159
156
160
applyPricesAndEvents : Prices -> Event -> Model -> Model
157
161
applyPricesAndEvents prices event model =
@@ -439,10 +443,11 @@ displayLenderOptions location =
439
443
div [] []
440
444
441
445
442
- displayScore : Model -> Html a
446
+ displayScore : Model -> Html Msg
443
447
displayScore model =
444
- div []
445
- [ text <| " Your score: " ++ ( toString <| calculateScore model)
448
+ div [ class " score" ]
449
+ [ p [] [ text <| " Your score: " ++ ( toString <| calculateScore model) ]
450
+ , button [ onClick RestartGame ] [ text <| translate gameStyle RestartGameButton ]
446
451
]
447
452
448
453
Original file line number Diff line number Diff line change 75
75
max-width : 45em ;
76
76
margin : 0 auto ;
77
77
}
78
+
79
+ .score {
80
+ text-align : center ;
81
+ }
78
82
}
You can’t perform that action at this time.
0 commit comments