refactored new season menu
This commit is contained in:
parent
7cffac245c
commit
943efe0599
|
@ -39,15 +39,8 @@ handleEvent e = do
|
|||
m <- gets $ view progMode
|
||||
case m of
|
||||
MainMenu -> menuHandler mainMenu e
|
||||
NewSeason -> newSeason e >> return True
|
||||
NewSeason -> menuHandler newSeasonMenu e >> return True
|
||||
NewGame -> newGame e >> return True
|
||||
|
||||
newSeason :: C.Event -> StateT ProgState C.Curses ()
|
||||
newSeason (C.EventCharacter c) = case c of
|
||||
'1' -> modify $ resetYtd . startNewGame
|
||||
'2' -> modify startNewGame
|
||||
_ -> return ()
|
||||
newSeason _ = return ()
|
||||
|
||||
newGame :: C.Event -> StateT ProgState C.Curses ()
|
||||
newGame = undefined
|
||||
|
|
|
@ -24,7 +24,8 @@ module Mtlstats.Menu (
|
|||
drawMenu,
|
||||
menuHandler,
|
||||
-- * Menus
|
||||
mainMenu
|
||||
mainMenu,
|
||||
newSeasonMenu
|
||||
) where
|
||||
|
||||
import Control.Monad.Trans.State (StateT, modify)
|
||||
|
@ -56,3 +57,11 @@ mainMenu = Menu "*** MAIN MENU ***" True
|
|||
, MenuItem '3' "Exit" $
|
||||
return False
|
||||
]
|
||||
|
||||
newSeasonMenu :: Menu ()
|
||||
newSeasonMenu = Menu "*** SEASON TYPE ***" ()
|
||||
[ MenuItem '1' "Regular Season" $
|
||||
modify $ resetYtd . startNewGame
|
||||
, MenuItem '2' "Playoffs" $
|
||||
modify startNewGame
|
||||
]
|
||||
|
|
|
@ -35,16 +35,9 @@ draw s = do
|
|||
C.clear
|
||||
case s ^. progMode of
|
||||
MainMenu -> drawMenu mainMenu
|
||||
NewSeason -> newSeason
|
||||
NewSeason -> drawMenu newSeasonMenu
|
||||
NewGame -> newGame
|
||||
C.render
|
||||
|
||||
newSeason :: C.Update ()
|
||||
newSeason = C.drawString $ unlines
|
||||
[ "*** SEASON TYPE ***"
|
||||
, "1) Regular Season"
|
||||
, "2) Playoffs"
|
||||
]
|
||||
|
||||
newGame :: C.Update ()
|
||||
newGame = return ()
|
||||
|
|
Loading…
Reference in New Issue
Block a user