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 MainMenu -> menuHandler mainMenu e
NewSeason -> menuHandler newSeasonMenu e >> return True NewSeason -> menuHandler newSeasonMenu e >> return True
NewGame gs NewGame gs
| null $ gs^.gameYear -> do
promptHandler gameYearPrompt e
return True
| null $ gs^.gameType -> do | null $ gs^.gameType -> do
menuHandler gameTypeMenu e menuHandler gameTypeMenu e
return True return True

View File

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

View File

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