Implement simple indenting in selection menu
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
module Dodge.Inventory.SelectionList (
|
||||
invSelectionItem,
|
||||
invSelectionItem',
|
||||
closeObjectToSelectionItem,
|
||||
) where
|
||||
|
||||
@@ -13,8 +14,8 @@ import Dodge.Item.InventoryColor
|
||||
import LensHelp
|
||||
import Picture.Base
|
||||
|
||||
invSelectionItem :: Creature -> Int -> Item -> SelectionItem ()
|
||||
invSelectionItem cr i it =
|
||||
invSelectionItem' :: Creature -> Int -> Item -> SelectionItem ()
|
||||
invSelectionItem' cr i it =
|
||||
SelectionItem
|
||||
{ _siPictures = pics & ix 0 %~ (++ anyequippos ++ anyhotkey)
|
||||
, _siHeight = itSlotsTaken it
|
||||
@@ -31,6 +32,24 @@ invSelectionItem cr i it =
|
||||
UndroppableIdentified -> itemDisplay cr it
|
||||
_ -> itemDisplay cr it
|
||||
|
||||
invSelectionItem :: Creature -> Int -> (Item,Int,a) -> SelectionItem ()
|
||||
invSelectionItem cr i (it,indent,_) =
|
||||
SelectionItem
|
||||
{ _siPictures = pics & ix 0 %~ (++ anyequippos ++ anyhotkey)
|
||||
, _siHeight = itSlotsTaken it
|
||||
, _siIsSelectable = True
|
||||
, _siColor = col
|
||||
, _siOffX = indent
|
||||
, _siPayload = ()
|
||||
}
|
||||
where
|
||||
anyhotkey = maybe [] ((' ':) .hotkeyToString) (cr ^? crInvHotkeys . ix i)
|
||||
anyequippos = maybe [] (rightPad 8 ' ' . (' ':) . eqPosText) (cr ^? crInvEquipped . ix i)
|
||||
col = itemInvColor it
|
||||
pics = case _itCurseStatus it of
|
||||
UndroppableIdentified -> itemDisplay cr it
|
||||
_ -> itemDisplay cr it
|
||||
|
||||
hotkeyToString :: Hotkey -> String
|
||||
hotkeyToString x = case x of
|
||||
HotkeyQ -> "[Q]"
|
||||
|
||||
Reference in New Issue
Block a user