Fix position of continue option on pause menu
This commit is contained in:
+4
-3
@@ -51,12 +51,13 @@ splashMenuOptions =
|
|||||||
| otherwise = MODString str
|
| otherwise = MODString str
|
||||||
|
|
||||||
pauseMenu :: Universe -> ScreenLayer
|
pauseMenu :: Universe -> ScreenLayer
|
||||||
pauseMenu = initializeOptionMenu "PAUSED" pauseMenuOptions (Just "CONTINUE") unpause
|
pauseMenu = initializeOptionMenu' "PAUSED" pauseMenuOptions pmo
|
||||||
|
where
|
||||||
|
pmo = TopMenuOption $ Toggle unpause (const (MODString "CONTINUE"))
|
||||||
|
|
||||||
pauseMenuOptions :: [MenuOption]
|
pauseMenuOptions :: [MenuOption]
|
||||||
pauseMenuOptions =
|
pauseMenuOptions =
|
||||||
[ Toggle popScreen (opText "CONTINUE")
|
[ Toggle (startNewGameInSlot 0) (opText "NEW GAME")
|
||||||
, Toggle (startNewGameInSlot 0) (opText "NEW GAME")
|
|
||||||
, Toggle reloadLevelStart (opText "RESTART")
|
, Toggle reloadLevelStart (opText "RESTART")
|
||||||
, Toggle (pushScreen $ seedStartMenu "START FROM SEED") (opText "NEW FROM SEED")
|
, Toggle (pushScreen $ seedStartMenu "START FROM SEED") (opText "NEW FROM SEED")
|
||||||
, Toggle (pushScreen optionMenu) (opText "OPTIONS")
|
, Toggle (pushScreen optionMenu) (opText "OPTIONS")
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ optionListDisplayParams = ListDisplayParams
|
|||||||
, _ldpCursorType = BorderCursor (Set.fromList [North,South,West])
|
, _ldpCursorType = BorderCursor (Set.fromList [North,South,West])
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeOptionMenu :: String -> [MenuOption] -> Maybe String -> (Universe -> Universe) -> Universe -> ScreenLayer
|
initializeOptionMenu' :: String -> [MenuOption] -> PositionedMenuOption -> Universe -> ScreenLayer
|
||||||
initializeOptionMenu title ops defstr eff u =
|
initializeOptionMenu' title ops pmo u =
|
||||||
OptionScreen
|
OptionScreen
|
||||||
{ _scTitle = title
|
{ _scTitle = title
|
||||||
, _scOptions = ops
|
, _scOptions = ops
|
||||||
@@ -34,6 +34,9 @@ initializeOptionMenu title ops defstr eff u =
|
|||||||
, _scAvailableLines = getAvailableListLines optionListDisplayParams (u ^. uvConfig)
|
, _scAvailableLines = getAvailableListLines optionListDisplayParams (u ^. uvConfig)
|
||||||
, _scListDisplayParams = optionListDisplayParams
|
, _scListDisplayParams = optionListDisplayParams
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initializeOptionMenu :: String -> [MenuOption] -> Maybe String -> (Universe -> Universe) -> Universe -> ScreenLayer
|
||||||
|
initializeOptionMenu title ops defstr eff = initializeOptionMenu' title ops pmo
|
||||||
where
|
where
|
||||||
pmo = case defstr of
|
pmo = case defstr of
|
||||||
Nothing -> NoPositionedMenuOption
|
Nothing -> NoPositionedMenuOption
|
||||||
@@ -60,7 +63,7 @@ makeOptionsSelectionList maxlines mselpos u mos pmo = SelectionList
|
|||||||
optionsToSelections :: Int -> Universe -> [MenuOption] -> PositionedMenuOption -> [SelectionItem (Universe -> Universe)]
|
optionsToSelections :: Int -> Universe -> [MenuOption] -> PositionedMenuOption -> [SelectionItem (Universe -> Universe)]
|
||||||
optionsToSelections maxlines u allops pmo = sits
|
optionsToSelections maxlines u allops pmo = sits
|
||||||
where
|
where
|
||||||
offset = u ^?! uvScreenLayers . _head . scOffset
|
offset = fromMaybe 0 $ u ^? uvScreenLayers . _head . scOffset
|
||||||
ops | maxlines >= length allops = allops
|
ops | maxlines >= length allops = allops
|
||||||
| otherwise = take (maxlines - 2) (drop offset allops ++ repeat dummyMenuOption) ++ [cycleOptionsOption]
|
| otherwise = take (maxlines - 2) (drop offset allops ++ repeat dummyMenuOption) ++ [cycleOptionsOption]
|
||||||
maxOptionLength = 3 + maximum (0 : map (optionValueOffset u) ops)
|
maxOptionLength = 3 + maximum (0 : map (optionValueOffset u) ops)
|
||||||
@@ -70,8 +73,8 @@ optionsToSelections maxlines u allops pmo = sits
|
|||||||
BottomMenuOption mo -> map (menuOptionToSelectionItem u maxOptionLength) (ops ++ [mo])
|
BottomMenuOption mo -> map (menuOptionToSelectionItem u maxOptionLength) (ops ++ [mo])
|
||||||
cycleOptionsOption = Toggle cycleOptions (const (MODString ("MORE OPTIONS " ++ show n ++ "/" ++ show m)))
|
cycleOptionsOption = Toggle cycleOptions (const (MODString ("MORE OPTIONS " ++ show n ++ "/" ++ show m)))
|
||||||
l = length allops
|
l = length allops
|
||||||
m = div (max 1 (l - 1)) (maxlines - 2) + 1
|
m = div (l - 1) (max 1 (maxlines - 2)) + 1
|
||||||
n = div (offset + 1) (maxlines - 2) + 1
|
n = div (offset + 1) (max 1 (maxlines - 2)) + 1
|
||||||
|
|
||||||
dummyMenuOption :: MenuOption
|
dummyMenuOption :: MenuOption
|
||||||
dummyMenuOption = Toggle id (const $ MODBlockedString "")
|
dummyMenuOption = Toggle id (const $ MODBlockedString "")
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ module Dodge.SelectionList where
|
|||||||
--import Dodge.WindowLayout
|
--import Dodge.WindowLayout
|
||||||
import Dodge.Data.Universe
|
import Dodge.Data.Universe
|
||||||
import LensHelp
|
import LensHelp
|
||||||
import Data.Maybe
|
--import Data.Maybe
|
||||||
|
|
||||||
getAvailableListLines :: ListDisplayParams -> Configuration -> Int
|
getAvailableListLines :: ListDisplayParams -> Configuration -> Int
|
||||||
getAvailableListLines ldps cfig = nlines
|
getAvailableListLines ldps cfig = nlines
|
||||||
|
|||||||
+7
-7
@@ -93,8 +93,8 @@ gotoTerminal w = case _uvScreenLayers w of
|
|||||||
(InputScreen{} : _) -> w
|
(InputScreen{} : _) -> w
|
||||||
_ -> w & uvScreenLayers .:~ InputScreen T.empty "Enter command"
|
_ -> w & uvScreenLayers .:~ InputScreen T.empty "Enter command"
|
||||||
|
|
||||||
mouseClickOptionsList :: [MenuOption] -> ScreenLayer -> Universe -> Universe
|
mouseClickOptionsList :: ScreenLayer -> Universe -> Universe
|
||||||
mouseClickOptionsList mos screen u = fromMaybe u $ do
|
mouseClickOptionsList screen u = fromMaybe u $ do
|
||||||
sl <- screen ^? scSelectionList
|
sl <- screen ^? scSelectionList
|
||||||
Just $ case u ^. uvWorld . input . mouseButtons . at ButtonLeft of
|
Just $ case u ^. uvWorld . input . mouseButtons . at ButtonLeft of
|
||||||
Just False -> fromMaybe u $ do
|
Just False -> fromMaybe u $ do
|
||||||
@@ -128,8 +128,8 @@ setSelectionListRestriction' cfig screen = fromMaybe screen $ do
|
|||||||
updateUseInput :: Universe -> Universe
|
updateUseInput :: Universe -> Universe
|
||||||
updateUseInput u = case u ^? uvScreenLayers . _head of
|
updateUseInput u = case u ^? uvScreenLayers . _head of
|
||||||
Just (InputScreen thetext _) -> doInputScreenInput thetext u
|
Just (InputScreen thetext _) -> doInputScreenInput thetext u
|
||||||
Just screen@OptionScreen{_scOptions = mos, _scPositionedMenuOption = mop, _scOptionFlag = flag, _scSelectionList = sellist, _scListDisplayParams = ldps}
|
Just screen@OptionScreen{_scPositionedMenuOption = mop, _scOptionFlag = flag, _scSelectionList = sellist, _scListDisplayParams = ldps}
|
||||||
-> optionScreenUpdate screen mos mop flag ldps sellist u
|
-> optionScreenUpdate screen mop flag ldps sellist u
|
||||||
-- Just ColumnsScreen{} -> u & uvScreenLayers %~ tail
|
-- Just ColumnsScreen{} -> u & uvScreenLayers %~ tail
|
||||||
_ -> case u ^? uvWorld . cWorld . lWorld . hud . hudElement . subInventory of
|
_ -> case u ^? uvWorld . cWorld . lWorld . hud . hudElement . subInventory of
|
||||||
Just (DisplayTerminal tmid) | inTermFocus (_uvWorld u) -> updateKeysInTerminal tmid u
|
Just (DisplayTerminal tmid) | inTermFocus (_uvWorld u) -> updateKeysInTerminal tmid u
|
||||||
@@ -137,14 +137,14 @@ updateUseInput u = case u ^? uvScreenLayers . _head of
|
|||||||
where
|
where
|
||||||
pkeys = u ^. uvWorld . input . pressedKeys
|
pkeys = u ^. uvWorld . input . pressedKeys
|
||||||
|
|
||||||
optionScreenUpdate :: ScreenLayer -> [MenuOption] -> PositionedMenuOption -> OptionScreenFlag
|
optionScreenUpdate :: ScreenLayer -> PositionedMenuOption -> OptionScreenFlag
|
||||||
-> ListDisplayParams
|
-> ListDisplayParams
|
||||||
-> SelectionList (Universe -> Universe)
|
-> SelectionList (Universe -> Universe)
|
||||||
-> Universe -> Universe
|
-> Universe -> Universe
|
||||||
optionScreenUpdate screen mos mop _ ldps sl u =
|
optionScreenUpdate screen mop _ ldps sl u =
|
||||||
refreshOptionsSelectionList
|
refreshOptionsSelectionList
|
||||||
. optionScreenDefEff mop
|
. optionScreenDefEff mop
|
||||||
. mouseClickOptionsList mos screen
|
. mouseClickOptionsList screen
|
||||||
. mouseOverSelectionList ldps sl
|
. mouseOverSelectionList ldps sl
|
||||||
. menuWheelEvents
|
. menuWheelEvents
|
||||||
. over (uvScreenLayers . _head) (setSelectionListRestriction' cfig)
|
. over (uvScreenLayers . _head) (setSelectionListRestriction' cfig)
|
||||||
|
|||||||
Reference in New Issue
Block a user