From 6c634cd3667355232cacfbc3a2ebfdeef0a893c4 Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Tue, 29 Oct 2019 02:51:20 -0400 Subject: [PATCH] implemented Mtlstats.Control.GoalieInput.selectGoalieC --- src/Mtlstats/Control/GoalieInput.hs | 14 ++++++++++---- src/Mtlstats/Prompt.hs | 7 ++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Mtlstats/Control/GoalieInput.hs b/src/Mtlstats/Control/GoalieInput.hs index 195f806..12b6d69 100644 --- a/src/Mtlstats/Control/GoalieInput.hs +++ b/src/Mtlstats/Control/GoalieInput.hs @@ -23,17 +23,23 @@ module Mtlstats.Control.GoalieInput (goalieInput) where import Lens.Micro ((^.)) +import Mtlstats.Prompt import Mtlstats.Types -- | The dispatcher for handling goalie input goalieInput :: GameState -> Controller goalieInput gs - | null $ gs^.gameSelectedGoalie = selectGoalieC - | null $ gs^.goalieMinsPlayed = minsPlayedC - | otherwise = goalsAllowedC + | null $ gs^.gameSelectedGoalie = selectGoalieC + | null $ gs^.goalieMinsPlayed = minsPlayedC + | otherwise = goalsAllowedC selectGoalieC :: Controller -selectGoalieC = undefined +selectGoalieC = Controller + { drawController = drawPrompt selectGameGoaliePrompt + , handleController = \e -> do + promptHandler selectGameGoaliePrompt e + return True + } minsPlayedC :: Controller minsPlayedC = undefined diff --git a/src/Mtlstats/Prompt.hs b/src/Mtlstats/Prompt.hs index 5375193..c16d799 100644 --- a/src/Mtlstats/Prompt.hs +++ b/src/Mtlstats/Prompt.hs @@ -42,7 +42,8 @@ module Mtlstats.Prompt ( pMinPlayerPrompt, assignPMinsPrompt, goalieNumPrompt, - goalieNamePrompt + goalieNamePrompt, + selectGameGoaliePrompt ) where import Control.Monad (when) @@ -259,5 +260,9 @@ goalieNamePrompt :: Prompt goalieNamePrompt = strPrompt "Goalie name: " $ modify . (progMode.createGoalieStateL.cgsName .~) +-- | Prompts for a goalie who played in the game +selectGameGoaliePrompt :: Prompt +selectGameGoaliePrompt = undefined + drawSimplePrompt :: String -> ProgState -> C.Update () drawSimplePrompt pStr s = C.drawString $ pStr ++ s^.inputBuffer