prompt for game year

This commit is contained in:
Jonathan Lamothe 2019-08-31 11:28:09 -04:00
parent f718757bea
commit 0798786d36
3 changed files with 10 additions and 0 deletions

View File

@ -43,6 +43,9 @@ handleEvent e = gets (view progMode) >>= \case
MainMenu -> menuHandler mainMenu e
NewSeason -> menuHandler newSeasonMenu e >> return True
NewGame gs
| null $ gs^.gameYear -> do
promptHandler gameYearPrompt e
return True
| null $ gs^.gameType -> do
menuHandler gameTypeMenu e
return True

View File

@ -26,6 +26,7 @@ module Mtlstats.Prompt (
strPrompt,
numPrompt,
-- * Individual prompts
gameYearPrompt,
otherTeamPrompt,
homeScorePrompt,
awayScorePrompt
@ -93,6 +94,11 @@ numPrompt pStr act = Prompt
, promptFunctionKey = const $ return ()
}
-- | Prompts for the game year
gameYearPrompt :: Prompt
gameYearPrompt = numPrompt "Game year: " $
modify . (progMode.gameStateL.gameYear ?~)
-- | Prompts for the other team name
otherTeamPrompt :: Prompt
otherTeamPrompt = strPrompt "Other team: " $

View File

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