Cleanup, tweak selection sections positioning

This commit is contained in:
2023-02-23 16:13:40 +00:00
parent c5bfa36bde
commit 86943f4170
8 changed files with 79 additions and 120 deletions
+2 -26
View File
@@ -1,6 +1,5 @@
module Dodge.Inventory.SelectionList
( invSelectionItem
, invSelectionItem'
, closeObjectToSelectionItem
)
where
@@ -12,14 +11,8 @@ import Dodge.Data.SelectionList
import Dodge.Data.World
import LensHelp
--makeInventorySelectionList :: World -> SelectionList ()
--makeInventorySelectionList w = defaultSelectionList
-- & slItems .~ inventorySelectionList w
-- & slSelPos .~ inventoryCursorPos w
--
--
invSelectionItem' :: Creature -> Int -> Item -> SelectionItem ()
invSelectionItem' cr i it = SelectionItem
invSelectionItem :: Creature -> Int -> Item -> SelectionItem ()
invSelectionItem cr i it = SelectionItem
{ _siPictures = pics
, _siHeight = length pics
, _siIsSelectable = True
@@ -35,23 +28,6 @@ invSelectionItem' cr i it = SelectionItem
_ | cr ^? crManipulation . manObject . inInventory . ispItem == Just i -> selectedItemDisplay cr it
_ -> itemDisplay it
invSelectionItem :: Creature -> (Int,Item) -> SelectionItem ()
invSelectionItem cr (i,it) = SelectionItem
{ _siPictures = pics
, _siHeight = length pics
, _siIsSelectable = True
--, _siWidth = 15
, _siColor = col
, _siOffX = 0
, _siPayload = ()
}
where
col = _itInvColor it
pics = take (itSlotsTaken it) . (++ replicate 10 "*") $ case _itCurseStatus it of
UndroppableIdentified -> itemDisplay it
_ | cr ^? crManipulation . manObject . inInventory . ispItem == Just i -> selectedItemDisplay cr it
_ -> itemDisplay it
--
closeObjectToSelectionItem :: Either FloorItem Button -> SelectionItem ()
closeObjectToSelectionItem e = SelectionItem
{ _siPictures = pics