Continue inventory work

This commit is contained in:
2023-02-17 18:37:55 +00:00
parent 90133fb54b
commit 90370e5487
4 changed files with 20 additions and 56 deletions
+7 -21
View File
@@ -5,8 +5,6 @@ module Dodge.Inventory.SelectionList
)
where
--import Dodge.Default.SelectionList
import Dodge.Inventory.Color
import Dodge.Item.Display
import Dodge.Inventory.ItemSpace
import Picture.Base
@@ -54,8 +52,8 @@ invSelectionItem cr (i,it) = SelectionItem
_ | cr ^? crManipulation . manObject . inInventory . ispItem == Just i -> selectedItemDisplay cr it
_ -> itemDisplay it
--
closeObjectToSelectionItem :: Int -> Either FloorItem Button -> SelectionItem ()
closeObjectToSelectionItem n e = SelectionItem
closeObjectToSelectionItem :: Either FloorItem Button -> SelectionItem ()
closeObjectToSelectionItem e = SelectionItem
{ _siPictures = pics
, _siHeight = length pics
, _siIsSelectable = True
@@ -65,21 +63,9 @@ closeObjectToSelectionItem n e = SelectionItem
, _siPayload = ()
}
where
(pics,col) = closeObjectToTextPictures' n e
(pics,col) = closeObjectToTextPictures e
--
closeObjectToTextPictures' :: Int -> Either FloorItem Button -> ([String],Color)
closeObjectToTextPictures' nfreeslots e = case e of
Left flit -> let it = _flIt flit
in (map textindent $ itemDisplay it, thecol it)
Right bt -> ([textindent $ _btText bt], yellow)
where
textindent = (replicate clObjIntIn ' ' ++)
thecol it
| nfreeslots >= itSlotsTaken it = _itInvColor it
| otherwise = invDimColor
--
clObjIntIn :: Int
clObjIntIn = 2
--
--clObjFloatIn :: Float
--clObjFloatIn = fromIntegral clObjIntIn * 9
closeObjectToTextPictures :: Either FloorItem Button -> ([String],Color)
closeObjectToTextPictures e = case e of
Left flit -> let it = _flIt flit in ( itemDisplay it, _itInvColor it)
Right bt -> ([_btText bt], yellow)