Implement telescoping inventory selection

This commit is contained in:
2023-02-10 10:57:00 +00:00
parent c354949ca9
commit a8e00ac025
10 changed files with 172 additions and 64 deletions
-15
View File
@@ -9,11 +9,8 @@ import Dodge.Inventory.Color
import Dodge.Item.Display
import Dodge.Inventory.ItemSpace
import Picture.Base
import Dodge.Inventory.CheckSlots
import Dodge.Base.You
import Dodge.Data.SelectionList
import Dodge.Data.World
import qualified Data.IntMap.Strict as IM
import LensHelp
--makeInventorySelectionList :: World -> SelectionList ()
@@ -21,18 +18,6 @@ import LensHelp
-- & slItems .~ inventorySelectionList w
-- & slSelPos .~ inventoryCursorPos w
--
inventorySelectionList :: World -> [SelectionItem ()]
inventorySelectionList w = map (invSelectionItem cr) (IM.toList inv)
++ [SelectionItem [thetext] 1 True (length thetext) invDimColor 2 ()]
++ map (closeObjectToSelectionItem nfreeslots) (w ^. hud . closeObjects)
where
cr = you w
inv = _crInv cr
nfreeslots = crNumFreeSlots cr
thetext = case nfreeslots of
0 -> " INVENTORY FULL"
1 -> " +1 FREE SLOT"
x -> " +" ++ show x ++ " FREE SLOTS"
--
--inventoryCursorPos :: World -> Maybe Int
--inventoryCursorPos w = case w ^? hud . hudElement . subInventory of