Partially working change to selected items
This commit is contained in:
@@ -37,7 +37,8 @@ tryPutItemInInv cid flit w = case maybeInvSlot of
|
||||
|
||||
createAndSelectItem :: Item -> World -> World
|
||||
createAndSelectItem itm w = case createPutItem itm w of
|
||||
(Just i, w') -> w' & cWorld . lWorld . creatures . ix 0 . crInvSel .~ InvSel i NoInvSelAction
|
||||
(Just i, w') -> w'
|
||||
& cWorld . lWorld . creatures . ix 0 . crInvSel .~ InvSel (SelItem i NoInvSelAction)
|
||||
(Nothing, w') -> w'
|
||||
|
||||
createPutItem :: Item -> World -> (Maybe Int, World)
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
module Dodge.Inventory.SelectionList where
|
||||
module Dodge.Inventory.SelectionList
|
||||
( invSelectionItem
|
||||
, closeObjectToSelectionItem
|
||||
)
|
||||
where
|
||||
|
||||
import Dodge.Default.SelectionList
|
||||
--import Dodge.Default.SelectionList
|
||||
import Dodge.Inventory.Color
|
||||
import Dodge.Item.Display
|
||||
import Dodge.Inventory.ItemSpace
|
||||
@@ -12,11 +16,11 @@ import Dodge.Data.World
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import LensHelp
|
||||
|
||||
makeInventorySelectionList :: World -> SelectionList ()
|
||||
makeInventorySelectionList w = defaultSelectionList
|
||||
& slItems .~ inventorySelectionList w
|
||||
& slSelPos .~ inventoryCursorPos w
|
||||
|
||||
--makeInventorySelectionList :: World -> SelectionList ()
|
||||
--makeInventorySelectionList w = defaultSelectionList
|
||||
-- & 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 ()]
|
||||
@@ -29,12 +33,12 @@ inventorySelectionList w = map (invSelectionItem cr) (IM.toList inv)
|
||||
0 -> " INVENTORY FULL"
|
||||
1 -> " +1 FREE SLOT"
|
||||
x -> " +" ++ show x ++ " FREE SLOTS"
|
||||
|
||||
inventoryCursorPos :: World -> Maybe Int
|
||||
inventoryCursorPos w = case w ^? hud . hudElement . subInventory of
|
||||
Just CombineInventory{} -> Nothing
|
||||
_ -> Just $ yourInvSel w
|
||||
|
||||
--
|
||||
--inventoryCursorPos :: World -> Maybe Int
|
||||
--inventoryCursorPos w = case w ^? hud . hudElement . subInventory of
|
||||
-- Just CombineInventory{} -> Nothing
|
||||
-- _ -> Just $ yourInvSel w
|
||||
--
|
||||
invSelectionItem :: Creature -> (Int,Item) -> SelectionItem ()
|
||||
invSelectionItem cr (i,it) = SelectionItem
|
||||
{ _siPictures = pics
|
||||
@@ -49,9 +53,9 @@ invSelectionItem cr (i,it) = SelectionItem
|
||||
col = _itInvColor it
|
||||
pics = take (itSlotsTaken it) . (++ replicate 10 "*") $ case _itCurseStatus it of
|
||||
UndroppableIdentified -> itemDisplay it
|
||||
_ | crSel cr == i -> selectedItemDisplay cr it
|
||||
_ | cr ^? crInvSel . isel . ispItem == Just i -> selectedItemDisplay cr it
|
||||
_ -> itemDisplay it
|
||||
|
||||
--
|
||||
closeObjectToSelectionItem :: Int -> Either FloorItem Button -> SelectionItem ()
|
||||
closeObjectToSelectionItem n e = SelectionItem
|
||||
{ _siPictures = pics
|
||||
@@ -64,7 +68,7 @@ closeObjectToSelectionItem n e = SelectionItem
|
||||
}
|
||||
where
|
||||
(pics,col) = closeObjectToTextPictures' n e
|
||||
|
||||
--
|
||||
closeObjectToTextPictures' :: Int -> Either FloorItem Button -> ([String],Color)
|
||||
closeObjectToTextPictures' nfreeslots e = case e of
|
||||
Left flit -> let it = _flIt flit
|
||||
@@ -75,9 +79,9 @@ closeObjectToTextPictures' nfreeslots e = case e of
|
||||
thecol it
|
||||
| nfreeslots >= itSlotsTaken it = _itInvColor it
|
||||
| otherwise = invDimColor
|
||||
|
||||
--
|
||||
clObjIntIn :: Int
|
||||
clObjIntIn = 2
|
||||
|
||||
clObjFloatIn :: Float
|
||||
clObjFloatIn = fromIntegral clObjIntIn * 9
|
||||
--
|
||||
--clObjFloatIn :: Float
|
||||
--clObjFloatIn = fromIntegral clObjIntIn * 9
|
||||
|
||||
Reference in New Issue
Block a user