Allow for selection of equipment position
This commit is contained in:
+38
-5
@@ -62,8 +62,9 @@ subInventoryDisplay subinv cfig w = case subinv of
|
||||
NoSubInventory -> pictures
|
||||
[ selcursor
|
||||
, closeobjectcursor
|
||||
, equipcursor
|
||||
, equipcursors
|
||||
, equipcursor -- the order is important, this should go on top of the other equipcursors
|
||||
, rboptions
|
||||
]
|
||||
TweakInventory -> pictures
|
||||
--[ mCurs it cfig w
|
||||
@@ -126,11 +127,43 @@ subInventoryDisplay subinv cfig w = case subinv of
|
||||
curpos = invSelPos w
|
||||
cury = fromMaybe 1 $ augmentedInvSizes w IM.!? _crInvSel (you w)
|
||||
equipcursor = case _crLeftInvSel cr of
|
||||
Nothing -> mempty
|
||||
Just invid -> f' cyan invid
|
||||
Just invid | _crInvSel cr /= invid || not (ButtonRight `S.member` _mouseButtons w)
|
||||
-> f cyan invid (_crInvEquipped cr IM.! invid)
|
||||
_ -> mempty
|
||||
equipcursors = IM.foldMapWithKey (f yellow) (_crInvEquipped cr)
|
||||
f' col invid = listTextPictureAt 144 0 cfig (selNumPos invid w) . color col $ text "EQUIPPED"
|
||||
f col invid epos = listTextPictureAt 144 0 cfig (selNumPos invid w) . color col $ text $ eqPosText epos
|
||||
f col invid epos
|
||||
| _crInvSel cr /= invid || not (ButtonRight `S.member` _mouseButtons w)
|
||||
= listTextPictureAt 144 0 cfig (selNumPos invid w) . color col $ text $ eqPosText epos
|
||||
| otherwise = mempty
|
||||
--rboptions = listTextPicturesAtOffset 200 0 cfig (selNumPos invid w) ["TEST","ME"]
|
||||
rboptions = drawRBOptions cfig w (_rbOptions w)
|
||||
|
||||
drawRBOptions :: Configuration -> World -> RightButtonOptions -> Picture
|
||||
drawRBOptions cfig w EquipOptions{_opEquip = es,_opSel=i, _opAllocateEquipment=ae} =
|
||||
listTextPicturesAtOffset 252 0 cfig (curpos-i) (map (text . eqPosText) es)
|
||||
<> case ae of
|
||||
DoNotMoveEquipment -> mempty
|
||||
PutOnEquipment {}
|
||||
-> putontext
|
||||
MoveEquipment {_allocOldPos = oldp }
|
||||
-> putontext <> extratext ("MOVES FROM "++eqPosText oldp)
|
||||
SwapEquipment { _allocOldPos = oldp, _allocSwapID = sid }
|
||||
-> putontext <> extratext ("SWAPS "++otheritem sid ++ " ONTO " ++eqPosText oldp)
|
||||
ReplaceEquipment { _allocRemoveID = rid }
|
||||
-> putontext <> extratext ("REMOVES " ++ otheritem rid)
|
||||
RemoveEquipment { }
|
||||
-> takeofftext
|
||||
where
|
||||
takeofftext = listTextPictureAt 144 0 cfig curpos (text " TAKE OFF")
|
||||
putontext = listTextPictureAt 144 0 cfig curpos (text " PUT ONTO")
|
||||
extratext str = listTextPictureAt 350 0 cfig curpos (text (str ++ deactivatetext))
|
||||
deactivatetext = case w ^? rbOptions . opActivateEquipment . deactivateEquipment of
|
||||
Just k -> " DEACTIVATES " ++ _itName (_crInv (you w) IM.! k)
|
||||
Nothing -> ""
|
||||
curpos = invSelPos w
|
||||
otheritem j = _itName (_crInv (you w) IM.! j)
|
||||
drawRBOptions _ _ _ = mempty
|
||||
|
||||
|
||||
eqPosText :: EquipPosition -> String
|
||||
eqPosText ep = case ep of
|
||||
|
||||
Reference in New Issue
Block a user