prompt for player's position
This commit is contained in:
parent
57ac90038a
commit
0ee0451496
|
@ -56,6 +56,7 @@ dispatch s = case s^.progMode of
|
|||
CreatePlayer cps
|
||||
| null $ cps^.cpsNumber -> getPlayerNumC
|
||||
| null $ cps^.cpsName -> getPlayerNameC
|
||||
| null $ cps^.cpsPosition -> getPlayerPosC
|
||||
| otherwise -> undefined
|
||||
|
||||
mainMenuC :: Controller
|
||||
|
@ -214,3 +215,11 @@ getPlayerNameC = Controller
|
|||
promptHandler playerNamePrompt e
|
||||
return True
|
||||
}
|
||||
|
||||
getPlayerPosC :: Controller
|
||||
getPlayerPosC = Controller
|
||||
{ drawController = drawPrompt playerPosPrompt
|
||||
, handleController = \e -> do
|
||||
promptHandler playerPosPrompt e
|
||||
return True
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ module Mtlstats.Prompt (
|
|||
awayScorePrompt,
|
||||
playerNumPrompt,
|
||||
playerNamePrompt,
|
||||
playerPosPrompt
|
||||
) where
|
||||
|
||||
import Control.Monad (when)
|
||||
|
@ -132,5 +133,10 @@ playerNamePrompt :: Prompt
|
|||
playerNamePrompt = strPrompt "Player name: " $
|
||||
modify . (progMode.createPlayerStateL.cpsName .~)
|
||||
|
||||
-- | Prompts for a new player's position
|
||||
playerPosPrompt :: Prompt
|
||||
playerPosPrompt = strPrompt "Player position: " $
|
||||
modify . (progMode.createPlayerStateL.cpsPosition .~)
|
||||
|
||||
drawSimplePrompt :: String -> ProgState -> C.Update ()
|
||||
drawSimplePrompt pStr s = C.drawString $ pStr ++ s^.inputBuffer
|
||||
|
|
Loading…
Reference in New Issue
Block a user