prompt for player name
This commit is contained in:
parent
754b3dd25c
commit
57ac90038a
|
@ -55,6 +55,7 @@ dispatch s = case s^.progMode of
|
|||
| otherwise -> reportC
|
||||
CreatePlayer cps
|
||||
| null $ cps^.cpsNumber -> getPlayerNumC
|
||||
| null $ cps^.cpsName -> getPlayerNameC
|
||||
| otherwise -> undefined
|
||||
|
||||
mainMenuC :: Controller
|
||||
|
@ -205,3 +206,11 @@ getPlayerNumC = Controller
|
|||
promptHandler playerNumPrompt e
|
||||
return True
|
||||
}
|
||||
|
||||
getPlayerNameC :: Controller
|
||||
getPlayerNameC = Controller
|
||||
{ drawController = drawPrompt playerNamePrompt
|
||||
, handleController = \e -> do
|
||||
promptHandler playerNamePrompt e
|
||||
return True
|
||||
}
|
||||
|
|
|
@ -31,7 +31,8 @@ module Mtlstats.Prompt (
|
|||
otherTeamPrompt,
|
||||
homeScorePrompt,
|
||||
awayScorePrompt,
|
||||
playerNumPrompt
|
||||
playerNumPrompt,
|
||||
playerNamePrompt,
|
||||
) where
|
||||
|
||||
import Control.Monad (when)
|
||||
|
@ -126,5 +127,10 @@ playerNumPrompt :: Prompt
|
|||
playerNumPrompt = numPrompt "Player number: " $
|
||||
modify . (progMode.createPlayerStateL.cpsNumber ?~)
|
||||
|
||||
-- | Prompts for a new player's name
|
||||
playerNamePrompt :: Prompt
|
||||
playerNamePrompt = strPrompt "Player name: " $
|
||||
modify . (progMode.createPlayerStateL.cpsName .~)
|
||||
|
||||
drawSimplePrompt :: String -> ProgState -> C.Update ()
|
||||
drawSimplePrompt pStr s = C.drawString $ pStr ++ s^.inputBuffer
|
||||
|
|
Loading…
Reference in New Issue
Block a user