Tweak inventory management
This commit is contained in:
+29
-29
@@ -13,7 +13,7 @@ import Picture
|
||||
import Geometry
|
||||
import Padding
|
||||
|
||||
import Data.Foldable
|
||||
--import Data.Foldable
|
||||
import Data.Maybe
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import qualified Data.Set as S
|
||||
@@ -174,36 +174,36 @@ mapWall cfig w wl =
|
||||
c = _wlColor wl
|
||||
|
||||
|
||||
selectedCloseObjectLink :: Configuration -> World -> Picture
|
||||
selectedCloseObjectLink cfig w = mempty
|
||||
--selectedCloseObjectLink :: Configuration -> World -> Picture
|
||||
--selectedCloseObjectLink cfig w = mempty
|
||||
|
||||
{- | Pictures of popup text for items close to your position.-}
|
||||
closeObjectTexts :: Configuration -> World -> Picture
|
||||
closeObjectTexts cfig w = pictures $
|
||||
renderListAt pushout (negate 20 * fromIntegral invPos) cfig (map colAndText $ _closeObjects w)
|
||||
: maybeToList maybeLine
|
||||
where
|
||||
colAndText (Left x) = ( _itName $ _flIt x, _itInvColor $ _flIt x)
|
||||
colAndText (Right x) = (_btText x,yellow)
|
||||
youSel = _crInvSel $ you w
|
||||
freeSlot = mayIt >>= \it -> checkInvSlotsYou (_flIt it) w
|
||||
invPos = fromMaybe youSel freeSlot
|
||||
mayObj = listToMaybe $ _closeObjects w
|
||||
mayIt = mayObj >>= maybeLeft
|
||||
maybeLeft (Left x) = Just x
|
||||
maybeLeft _ = Nothing
|
||||
pushout = 120
|
||||
objPos obj = case obj of
|
||||
Left flit -> _flItPos flit
|
||||
Right bt -> _btPos bt
|
||||
mayScreenPos = fmap (worldPosToScreen w . objPos) mayObj
|
||||
maybeLine = do
|
||||
itScreenPos <- mayScreenPos
|
||||
(theText,col) <- fmap colAndText mayObj
|
||||
let textWidth = 9 * fromIntegral (length theText)
|
||||
let p = V2 (textWidth + 15 + pushout - halfWidth cfig)
|
||||
( halfHeight cfig - 20* (fromIntegral invPos +1) + 2.5)
|
||||
return . winScale cfig . color col $ lConnect p itScreenPos
|
||||
--closeObjectTexts :: Configuration -> World -> Picture
|
||||
--closeObjectTexts cfig w = pictures $
|
||||
-- renderListAt pushout (negate 20 * fromIntegral invPos) cfig (map colAndText $ _closeObjects w)
|
||||
-- : maybeToList maybeLine
|
||||
-- where
|
||||
-- colAndText (Left x) = ( _itName $ _flIt x, _itInvColor $ _flIt x)
|
||||
-- colAndText (Right x) = (_btText x,yellow)
|
||||
-- youSel = _crInvSel $ you w
|
||||
-- freeSlot = mayIt >>= \it -> checkInvSlotsYou (_flIt it) w
|
||||
-- invPos = fromMaybe youSel freeSlot
|
||||
-- mayObj = listToMaybe $ _closeObjects w
|
||||
-- mayIt = mayObj >>= maybeLeft
|
||||
-- maybeLeft (Left x) = Just x
|
||||
-- maybeLeft _ = Nothing
|
||||
-- pushout = 120
|
||||
-- objPos obj = case obj of
|
||||
-- Left flit -> _flItPos flit
|
||||
-- Right bt -> _btPos bt
|
||||
-- mayScreenPos = fmap (worldPosToScreen w . objPos) mayObj
|
||||
-- maybeLine = do
|
||||
-- itScreenPos <- mayScreenPos
|
||||
-- (theText,col) <- fmap colAndText mayObj
|
||||
-- let textWidth = 9 * fromIntegral (length theText)
|
||||
-- let p = V2 (textWidth + 15 + pushout - halfWidth cfig)
|
||||
-- ( halfHeight cfig - 20* (fromIntegral invPos +1) + 2.5)
|
||||
-- return . winScale cfig . color col $ lConnect p itScreenPos
|
||||
|
||||
mainListCursor :: Color -> Int -> Configuration -> Picture
|
||||
mainListCursor c = openCursorAt 120 c 5 0
|
||||
|
||||
Reference in New Issue
Block a user