Simplify menu display
This commit is contained in:
+8
-13
@@ -7,6 +7,7 @@ Description : Simulation update
|
||||
-}
|
||||
module Dodge.Update (updateUniverse) where
|
||||
|
||||
import Dodge.ListDisplayParams
|
||||
import Color
|
||||
import Control.Applicative
|
||||
import Control.Monad
|
||||
@@ -339,9 +340,8 @@ updateMouseContextGame cfig u = case u ^. uvWorld . input . mouseContext of
|
||||
sss <- w ^? hud . hudElement . diSections
|
||||
selpos@(i, j) <- inverseSelNumPos cfig invDP sss mpos
|
||||
case w ^? hud . hudElement . subInventory . ciSelection of
|
||||
Just _ -> do
|
||||
guard (i == 0)
|
||||
return $ OverCombFiltInv selpos
|
||||
Just _ | i == 0 -> return $ OverCombFiltInv selpos
|
||||
Just _ -> Nothing
|
||||
_ -> do
|
||||
guard $ ButtonRight `M.notMember` (w ^. input . mouseButtons)
|
||||
guard =<< sss ^? ix i . ssItems . ix j . siIsSelectable
|
||||
@@ -371,22 +371,17 @@ getMenuMouseContext :: ScreenLayer -> Universe -> MouseContext
|
||||
getMenuMouseContext screen u = case screen ^. scOptions of
|
||||
[] -> NoMouseContext
|
||||
_ -> fromMaybe MouseMenuCursor $ do
|
||||
ldps <- screen ^? scListDisplayParams
|
||||
-- ldps <- screen ^? scListDisplayParams
|
||||
let ymax = maybe 0 length $ screen ^? scSelectionList
|
||||
yi <-
|
||||
ldpVerticalSelection
|
||||
(u ^. uvConfig)
|
||||
ldps
|
||||
optionListDisplayParams
|
||||
(u ^. uvWorld . input . mousePos)
|
||||
guard (yi >= 0 && yi < ymax)
|
||||
return $
|
||||
if isselectable yi
|
||||
then MouseMenuClick yi
|
||||
else NoMouseContext
|
||||
where
|
||||
isselectable yi =
|
||||
fromMaybe False $
|
||||
u ^? uvScreenLayers . _head . scSelectionList . ix yi . siIsSelectable
|
||||
return $ case u ^? uvScreenLayers . _head . scSelectionList . ix yi . siIsSelectable of
|
||||
Just True -> MouseMenuClick yi
|
||||
_ -> NoMouseContext
|
||||
|
||||
isOverTerminalScreen :: Configuration -> Terminal -> Point2 -> Bool
|
||||
isOverTerminalScreen cfig tm (V2 x y) =
|
||||
|
||||
Reference in New Issue
Block a user