framework for recording assists
This commit is contained in:
parent
8c8a2d52a6
commit
ffdb8e1e8c
@ -53,7 +53,7 @@ dispatch s = case s^.progMode of
|
|||||||
| null $ gs^.awayScore -> awayScoreC
|
| null $ gs^.awayScore -> awayScoreC
|
||||||
| null $ gs^.overtimeFlag -> overtimeFlagC
|
| null $ gs^.overtimeFlag -> overtimeFlagC
|
||||||
| not $ gs^.dataVerified -> verifyDataC
|
| not $ gs^.dataVerified -> verifyDataC
|
||||||
| fromJust (unaccountedPoints gs) -> recordGoalC
|
| fromJust (unaccountedPoints gs) -> goalInput gs
|
||||||
| otherwise -> reportC
|
| otherwise -> reportC
|
||||||
CreatePlayer cps
|
CreatePlayer cps
|
||||||
| null $ cps^.cpsNumber -> getPlayerNumC
|
| null $ cps^.cpsNumber -> getPlayerNumC
|
||||||
@ -182,6 +182,11 @@ verifyDataC = Controller
|
|||||||
return True
|
return True
|
||||||
}
|
}
|
||||||
|
|
||||||
|
goalInput :: GameState -> Controller
|
||||||
|
goalInput gs
|
||||||
|
| null (gs^.goalBy) = recordGoalC
|
||||||
|
| otherwise = recordAssistC
|
||||||
|
|
||||||
recordGoalC :: Controller
|
recordGoalC :: Controller
|
||||||
recordGoalC = Controller
|
recordGoalC = Controller
|
||||||
{ drawController = \s -> let
|
{ drawController = \s -> let
|
||||||
@ -195,6 +200,9 @@ recordGoalC = Controller
|
|||||||
return True
|
return True
|
||||||
}
|
}
|
||||||
|
|
||||||
|
recordAssistC :: Controller
|
||||||
|
recordAssistC = undefined
|
||||||
|
|
||||||
reportC :: Controller
|
reportC :: Controller
|
||||||
reportC = Controller
|
reportC = Controller
|
||||||
{ drawController = \s -> do
|
{ drawController = \s -> do
|
||||||
|
@ -205,13 +205,14 @@ recordGoalPrompt
|
|||||||
-- ^ The goal number
|
-- ^ The goal number
|
||||||
-> Prompt
|
-> Prompt
|
||||||
recordGoalPrompt game goal = selectPlayerPrompt
|
recordGoalPrompt game goal = selectPlayerPrompt
|
||||||
("*** GAME " ++ padNum 2 game ++ " ***\n" ++
|
( "*** GAME " ++ padNum 2 game ++ " ***\n" ++
|
||||||
"Who scored goal number " ++ show goal ++ "? ") $
|
"Who scored goal number " ++ show goal ++ "? "
|
||||||
\case
|
) $ \case
|
||||||
Nothing -> return ()
|
Nothing -> return ()
|
||||||
Just n -> modify
|
Just n -> nth n <$> gets (view $ database.dbPlayers)
|
||||||
$ awardGoal n
|
>>= maybe
|
||||||
. (progMode.gameStateL.pointsAccounted %~ succ)
|
(return ())
|
||||||
|
(\p -> modify $ progMode.gameStateL.goalBy .~ p^.pName)
|
||||||
|
|
||||||
drawSimplePrompt :: String -> ProgState -> C.Update ()
|
drawSimplePrompt :: String -> ProgState -> C.Update ()
|
||||||
drawSimplePrompt pStr s = C.drawString $ pStr ++ s^.inputBuffer
|
drawSimplePrompt pStr s = C.drawString $ pStr ++ s^.inputBuffer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user