prompt for game month

This commit is contained in:
Jonathan Lamothe 2019-08-31 12:27:34 -04:00
parent 79f8df50a0
commit bd0cffc56c
3 changed files with 25 additions and 0 deletions

View File

@ -46,6 +46,9 @@ handleEvent e = gets (view progMode) >>= \case
| null $ gs^.gameYear -> do
promptHandler gameYearPrompt e
return True
| null $ gs^.gameMonth -> do
menuHandler gameMonthMenu e
return True
| null $ gs^.gameType -> do
menuHandler gameTypeMenu e
return True

View File

@ -26,6 +26,7 @@ module Mtlstats.Menu (
-- * Menus
mainMenu,
newSeasonMenu,
gameMonthMenu,
gameTypeMenu
) where
@ -72,6 +73,26 @@ newSeasonMenu = Menu "*** SEASON TYPE ***" ()
modify startNewGame
]
-- | Requests the month in which the game took place
gameMonthMenu :: Menu ()
gameMonthMenu = Menu "Month:" () $ map
(\(ch, name, val) ->
MenuItem ch name $
modify $ progMode.gameStateL.gameMonth ?~ val)
[ ( 'A', "January", 1 )
, ( 'B', "February", 2 )
, ( 'C', "March", 3 )
, ( 'D', "April", 4 )
, ( 'E', "May", 5 )
, ( 'F', "June", 6 )
, ( 'G', "July", 7 )
, ( 'H', "August", 8 )
, ( 'I', "September", 9 )
, ( 'J', "October", 10 )
, ( 'K', "November", 11 )
, ( 'L', "December", 12 )
]
-- | The game type menu (home/away)
gameTypeMenu :: Menu ()
gameTypeMenu = Menu "*** GAME TYPE ***" ()

View File

@ -41,6 +41,7 @@ draw s = do
NewSeason -> drawMenu newSeasonMenu
NewGame gs
| null $ gs^.gameYear -> drawPrompt gameYearPrompt s
| null $ gs^.gameMonth -> drawMenu gameMonthMenu
| null $ gs^.gameType -> drawMenu gameTypeMenu
| null $ gs^.otherTeam -> drawPrompt otherTeamPrompt s
| null $ gs^.homeScore -> drawPrompt homeScorePrompt s