From faa214bf6da814b477c2ae1193cf0ff95e0c359b Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Wed, 30 Oct 2019 00:29:33 -0400 Subject: [PATCH] implemented selectGameGoaliePrompt --- src/Mtlstats/Prompt.hs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Mtlstats/Prompt.hs b/src/Mtlstats/Prompt.hs index c16d799..9b84651 100644 --- a/src/Mtlstats/Prompt.hs +++ b/src/Mtlstats/Prompt.hs @@ -37,6 +37,7 @@ module Mtlstats.Prompt ( playerNamePrompt, playerPosPrompt, selectPlayerPrompt, + selectGoaliePrompt, recordGoalPrompt, recordAssistPrompt, pMinPlayerPrompt, @@ -204,6 +205,16 @@ selectPlayerPrompt pStr callback = Prompt _ -> return () } +-- | Selects a goalie (creating one if necessary) +selectGoaliePrompt + :: String + -- ^ The prompt string + -> (Maybe Int -> Action ()) + -- ^ The callback to run (takes the index number of the goalie as + -- input) + -> Prompt +selectGoaliePrompt = undefined + -- | Prompts for the player who scored the goal recordGoalPrompt :: Int @@ -262,7 +273,10 @@ goalieNamePrompt = strPrompt "Goalie name: " $ -- | Prompts for a goalie who played in the game selectGameGoaliePrompt :: Prompt -selectGameGoaliePrompt = undefined +selectGameGoaliePrompt = selectGoaliePrompt "Select goalie: " $ + \case + Nothing -> modify $ progMode.gameStateL.goaliesRecorded .~ True + Just n -> modify $ progMode.gameStateL.gameSelectedGoalie ?~ n drawSimplePrompt :: String -> ProgState -> C.Update () drawSimplePrompt pStr s = C.drawString $ pStr ++ s^.inputBuffer