Start adding filters to selection lists
This commit is contained in:
@@ -19,7 +19,7 @@ makeInventorySelectionList w = defaultSelectionList
|
||||
|
||||
inventorySelectionList :: World -> [SelectionItem ()]
|
||||
inventorySelectionList w = map (invSelectionItem cr) (IM.toList inv)
|
||||
++ [SelectionItem displayFreeSlots 1 True (length thetext) invDimColor 2 ()]
|
||||
++ [SelectionItem [thetext] 1 True (length thetext) invDimColor 2 ()]
|
||||
++ map (closeObjectToSelectionItem nfreeslots) (w ^. hud . closeObjects)
|
||||
where
|
||||
cr = you w
|
||||
@@ -29,7 +29,6 @@ inventorySelectionList w = map (invSelectionItem cr) (IM.toList inv)
|
||||
0 -> " INVENTORY FULL"
|
||||
1 -> " +1 FREE SLOT"
|
||||
x -> " +" ++ show x ++ " FREE SLOTS"
|
||||
displayFreeSlots = [color invDimColor $ text thetext]
|
||||
|
||||
inventoryCursorPos :: World -> Maybe Int
|
||||
inventoryCursorPos w = case w ^? hud . hudElement . subInventory of
|
||||
@@ -48,10 +47,10 @@ invSelectionItem cr (i,it) = SelectionItem
|
||||
}
|
||||
where
|
||||
col = _itInvColor it
|
||||
pics = take (itSlotsTaken it) . (++ replicate 10 (color col $ text "*")) $ case _itCurseStatus it of
|
||||
UndroppableIdentified -> map (color yellow . text) (itemDisplay it)
|
||||
_ | crSel cr == i -> map (color col . text) (selectedItemDisplay cr it)
|
||||
_ -> map (color col . text) (itemDisplay it)
|
||||
pics = take (itSlotsTaken it) . (++ replicate 10 "*") $ case _itCurseStatus it of
|
||||
UndroppableIdentified -> itemDisplay it
|
||||
_ | crSel cr == i -> selectedItemDisplay cr it
|
||||
_ -> itemDisplay it
|
||||
|
||||
closeObjectToSelectionItem :: Int -> Either FloorItem Button -> SelectionItem ()
|
||||
closeObjectToSelectionItem n e = SelectionItem
|
||||
@@ -66,16 +65,13 @@ closeObjectToSelectionItem n e = SelectionItem
|
||||
where
|
||||
(pics,col) = closeObjectToTextPictures' n e
|
||||
|
||||
closeObjectToTextPictures' :: Int -> Either FloorItem Button -> ([Picture],Color)
|
||||
closeObjectToTextPictures' :: Int -> Either FloorItem Button -> ([String],Color)
|
||||
closeObjectToTextPictures' nfreeslots e = case e of
|
||||
Left flit -> let it = _flIt flit
|
||||
in (map (applycolor it . textindent) $ itemDisplay it, thecol it)
|
||||
Right bt -> ([color yellow $ textindent $ _btText bt], yellow)
|
||||
in (map textindent $ itemDisplay it, thecol it)
|
||||
Right bt -> ([textindent $ _btText bt], yellow)
|
||||
where
|
||||
textindent = text . (replicate clObjIntIn ' ' ++)
|
||||
applycolor it
|
||||
| nfreeslots >= itSlotsTaken it = color $ _itInvColor it
|
||||
| otherwise = color invDimColor
|
||||
textindent = (replicate clObjIntIn ' ' ++)
|
||||
thecol it
|
||||
| nfreeslots >= itSlotsTaken it = _itInvColor it
|
||||
| otherwise = invDimColor
|
||||
|
||||
Reference in New Issue
Block a user