Inventory: allow selection and dropping by dragging while filtering
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
|||||||
All good (594 modules, at 17:18:47)
|
All good (594 modules, at 19:56:08)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ combineList = map f . combineItemListYouX
|
|||||||
, _siIsSelectable = True
|
, _siIsSelectable = True
|
||||||
, _siColor = itemInvColor . pciToCI $ basePCI itm
|
, _siColor = itemInvColor . pciToCI $ basePCI itm
|
||||||
, _siOffX = 0
|
, _siOffX = 0
|
||||||
, _siPayload = CombinableItem is itm []
|
, _siPayload = CombinableItem is itm
|
||||||
}
|
}
|
||||||
|
|
||||||
combineItemListYouX :: World -> [([Int], Item)]
|
combineItemListYouX :: World -> [([Int], Item)]
|
||||||
|
|||||||
@@ -5,6 +5,5 @@ import Dodge.Data.Item
|
|||||||
data CombinableItem = CombinableItem
|
data CombinableItem = CombinableItem
|
||||||
{ _ciInvIDs :: [Int]
|
{ _ciInvIDs :: [Int]
|
||||||
, _ciItem :: Item
|
, _ciItem :: Item
|
||||||
, _ciInfo :: [String]
|
|
||||||
}
|
}
|
||||||
makeLenses ''CombinableItem
|
makeLenses ''CombinableItem
|
||||||
|
|||||||
@@ -341,22 +341,11 @@ combineInventoryExtra ::
|
|||||||
Picture
|
Picture
|
||||||
combineInventoryExtra sss msel cfig w = fromMaybe mempty $ do
|
combineInventoryExtra sss msel cfig w = fromMaybe mempty $ do
|
||||||
(i, j) <- msel
|
(i, j) <- msel
|
||||||
cpos <- selSecYint i j sss
|
|
||||||
si <- sss ^? ix i . ssItems . ix j
|
si <- sss ^? ix i . ssItems . ix j
|
||||||
let col = _siColor si
|
let col = _siColor si
|
||||||
mconcat
|
|
||||||
[ do
|
|
||||||
strs <- si ^? siPayload . ciInfo
|
|
||||||
return
|
|
||||||
. translate 160 0
|
|
||||||
-- it would be better to get the width of the selection list from elsewhere
|
|
||||||
. translateScreenPos cfig (secondColumnParams ^. ldpPos)
|
|
||||||
$ drawListYoff cpos $ map (color red . text) strs
|
|
||||||
, do
|
|
||||||
lnks <- si ^? siPayload . ciInvIDs
|
lnks <- si ^? siPayload . ciInvIDs
|
||||||
return (lnkMidPosInvSelsCol cfig w j col lnks)
|
return (lnkMidPosInvSelsCol cfig w j col lnks)
|
||||||
<> foldMap invcursor lnks
|
<> foldMap invcursor lnks
|
||||||
]
|
|
||||||
where
|
where
|
||||||
invcursor i = do
|
invcursor i = do
|
||||||
sss' <- w ^? hud . hudElement . diSections
|
sss' <- w ^? hud . hudElement . diSections
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ module Dodge.Update.Input.InGame (
|
|||||||
updateMouseInGame,
|
updateMouseInGame,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Data.Foldable
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import qualified Data.IntMap.Strict as IM
|
import qualified Data.IntMap.Strict as IM
|
||||||
@@ -127,9 +128,15 @@ updateMouseReleaseInGame w = case w ^. input . mouseContext of
|
|||||||
OverInvDragSelect ssel (Just esel) ->
|
OverInvDragSelect ssel (Just esel) ->
|
||||||
w & input . mouseContext .~ MouseInGame
|
w & input . mouseContext .~ MouseInGame
|
||||||
& hud . hudElement . diSelectionExtra
|
& hud . hudElement . diSelectionExtra
|
||||||
.~ IS.fromAscList [min (snd ssel) (snd esel) + 1 .. max (snd ssel) (snd esel)]
|
.~ h (snd ssel) (snd esel)-- IM.keysSet [min (snd ssel) (snd esel) + 1 .. max (snd ssel) (snd esel)]
|
||||||
& augInvDirectSelect (min ssel esel)
|
& augInvDirectSelect (min ssel esel)
|
||||||
_ -> w
|
_ -> w
|
||||||
|
where
|
||||||
|
h i j = fold $ do
|
||||||
|
sss <- w ^? hud . hudElement . diSections . ix 0 . ssItems
|
||||||
|
let (_,xss) = IM.split ((min i j)-1) sss
|
||||||
|
(yss,_) = IM.split ((max i j)+1) xss
|
||||||
|
return . IM.keysSet $ yss
|
||||||
|
|
||||||
updateMouseClickInGame :: Configuration -> World -> World
|
updateMouseClickInGame :: Configuration -> World -> World
|
||||||
updateMouseClickInGame cfig w = case w ^. input . mouseContext of
|
updateMouseClickInGame cfig w = case w ^. input . mouseContext of
|
||||||
@@ -483,7 +490,7 @@ tryCombine ::
|
|||||||
World
|
World
|
||||||
tryCombine (i, j) w = fromMaybe w $ do
|
tryCombine (i, j) w = fromMaybe w $ do
|
||||||
sss <- w ^? hud . hudElement . subInventory . ciSections
|
sss <- w ^? hud . hudElement . subInventory . ciSections
|
||||||
CombinableItem is it _ <- sss ^? ix i . ssItems . ix j . siPayload
|
CombinableItem is it <- sss ^? ix i . ssItems . ix j . siPayload
|
||||||
p <- w ^? cWorld . lWorld . creatures . ix 0 . crPos
|
p <- w ^? cWorld . lWorld . creatures . ix 0 . crPos
|
||||||
return $
|
return $
|
||||||
snd (createItemYou it (foldr (destroyInvItem 0) w (sort is)))
|
snd (createItemYou it (foldr (destroyInvItem 0) w (sort is)))
|
||||||
|
|||||||
Reference in New Issue
Block a user