Cleanup
This commit is contained in:
+17
-24
@@ -53,20 +53,19 @@ drawHUD cfig w = case w ^. hud . hudElement of
|
||||
|
||||
drawInventory :: IM.IntMap (SelectionSection ()) -> World -> Configuration -> Picture
|
||||
drawInventory sss w cfig =
|
||||
drawSelectionSections sss ldp cfig
|
||||
<> drawSSCursor sss (f $ w ^? hud . hudElement . diSelection . _Just) ldp curs cfig
|
||||
<> drawRootCursor w sss (f $ w ^? hud . hudElement . diSelection . _Just) ldp cfig
|
||||
drawSelectionSections sss invDP cfig
|
||||
<> drawSSCursor sss (f $ w ^? hud . hudElement . diSelection . _Just) invDP curs cfig
|
||||
<> drawRootCursor w sss (f $ w ^? hud . hudElement . diSelection . _Just) invDP cfig
|
||||
<> itemconnections
|
||||
<> drawMouseOver cfig w
|
||||
where
|
||||
f = fmap (\(x, y, _) -> (x, y))
|
||||
ldp = invDisplayParams w
|
||||
curs = invCursorParams w
|
||||
itemconnections = fromMaybe mempty $ do
|
||||
inv <- w ^? cWorld . lWorld . creatures . ix 0 . crInv
|
||||
case w ^? hud . hudElement . diInvFilter . _Just of
|
||||
Just (_ : _) -> Nothing
|
||||
_ -> return . drawItemConnections sss cfig w $ invAdj inv
|
||||
_ -> return . drawItemConnections sss cfig $ invAdj inv
|
||||
|
||||
drawRootCursor ::
|
||||
World ->
|
||||
@@ -113,11 +112,10 @@ drawMouseOver cfig w =
|
||||
w ^? input . mouseContext . mcoInvSelect
|
||||
<|> w ^? input . mouseContext . mcoInvFilt
|
||||
sss <- w ^? hud . hudElement . diSections
|
||||
let idp = invDisplayParams w
|
||||
return . translateScreenPos cfig (invDisplayParams w ^. ldpPos)
|
||||
return . translateScreenPos cfig (invDP ^. ldpPos)
|
||||
. color (withAlpha 0.1 white)
|
||||
-- . color white
|
||||
$ selSecDrawCursorAt idp curs sss (j, i)
|
||||
$ selSecDrawCursorAt invDP curs sss (j, i)
|
||||
-- curs = BoundaryCursor [West]
|
||||
curs = BackdropCursor
|
||||
combinvsel = do
|
||||
@@ -141,9 +139,8 @@ drawDragSelected cfig w = do
|
||||
)
|
||||
(i, _, _) <- w ^? hud . hudElement . diSelection . _Just
|
||||
sss <- w ^? hud . hudElement . diSections
|
||||
let idp = invDisplayParams w
|
||||
let f x = (selSecDrawCursorAt idp BackdropCursor sss (i, x) <>)
|
||||
return . translateScreenPos cfig (invDisplayParams w ^. ldpPos)
|
||||
let f x = (selSecDrawCursorAt invDP BackdropCursor sss (i, x) <>)
|
||||
return . translateScreenPos cfig (invDP ^. ldpPos)
|
||||
. color (withAlpha 0.2 white)
|
||||
. IS.foldr f mempty
|
||||
$ ys
|
||||
@@ -153,9 +150,8 @@ drawDragSelecting cfig w = do
|
||||
OverInvDragSelect (i, j) mselend <- w ^? input . mouseContext
|
||||
b <- mselend
|
||||
sss <- w ^? hud . hudElement . diSections
|
||||
let idp = invDisplayParams w
|
||||
let f x = selSecDrawCursorAt idp BackdropCursor sss (i, x)
|
||||
return . translateScreenPos cfig (invDisplayParams w ^. ldpPos)
|
||||
let f x = selSecDrawCursorAt invDP BackdropCursor sss (i, x)
|
||||
return . translateScreenPos cfig (invDP ^. ldpPos)
|
||||
. color (withAlpha 0.2 white)
|
||||
. foldMap f
|
||||
$ [min j b .. max j b]
|
||||
@@ -308,27 +304,25 @@ equipAllocString = \case
|
||||
drawItemConnections ::
|
||||
IM.IntMap (SelectionSection ()) ->
|
||||
Configuration ->
|
||||
World ->
|
||||
IM.IntMap (Maybe (Int, Int), [Int], [Int]) ->
|
||||
Picture
|
||||
drawItemConnections sss cfig w =
|
||||
drawItemConnections sss cfig =
|
||||
translate (negate 5) 0
|
||||
. IM.foldMapWithKey (drawItemChildrenConnect sss cfig w)
|
||||
. IM.foldMapWithKey (drawItemChildrenConnect sss cfig)
|
||||
. fmap (\(_, a, b) -> a <> b)
|
||||
|
||||
drawItemChildrenConnect ::
|
||||
IM.IntMap (SelectionSection ()) ->
|
||||
Configuration ->
|
||||
World ->
|
||||
Int ->
|
||||
[Int] ->
|
||||
Picture
|
||||
drawItemChildrenConnect sss cfig w i is = fromMaybe mempty $ do
|
||||
drawItemChildrenConnect sss cfig i is = fromMaybe mempty $ do
|
||||
p <- snum i
|
||||
let ps = mapMaybe snum is
|
||||
return $ color white $ lConnectMulti ps p
|
||||
where
|
||||
snum = selNumPos cfig (invDisplayParams w) sss 0
|
||||
snum = selNumPos cfig invDP sss 0
|
||||
|
||||
combineInventoryExtra ::
|
||||
IM.IntMap (SelectionSection CombinableItem) ->
|
||||
@@ -346,11 +340,10 @@ combineInventoryExtra sss msel cfig w = fromMaybe mempty $ do
|
||||
where
|
||||
invcursor i = do
|
||||
sss' <- w ^? hud . hudElement . diSections
|
||||
let idp = invDisplayParams w
|
||||
return $
|
||||
translateScreenPos cfig (idp ^. ldpPos) $
|
||||
translateScreenPos cfig (invDP ^. ldpPos) $
|
||||
selSecDrawCursor
|
||||
idp
|
||||
invDP
|
||||
(BoundaryCursor [North, South, East, West])
|
||||
sss'
|
||||
(Just (0, i))
|
||||
@@ -390,7 +383,7 @@ lnkMidPosInvSelsCol cfig w i col = fromMaybe mempty . foldMap f
|
||||
f j = do
|
||||
sss <- w ^? hud . hudElement . diSections
|
||||
combinesss <- w ^? hud . hudElement . subInventory . ciSections
|
||||
lp <- selNumPos cfig (invDisplayParams w) sss 0 j
|
||||
lp <- selNumPos cfig invDP sss 0 j
|
||||
rp <- selNumPos cfig secondColumnParams combinesss 0 i
|
||||
invcol <- selSecSelCol 0 j sss
|
||||
return $ zConnectColMidX (rp - V2 5 0) (lp + V2 155 0) (rp ^. _1 - 20) col col col invcol
|
||||
|
||||
Reference in New Issue
Block a user