Move combine list over to SelectionSections -- more todo

This commit is contained in:
2023-02-18 10:59:59 +00:00
parent 36b9b5445c
commit 6eca3bab38
10 changed files with 119 additions and 160 deletions
+21 -21
View File
@@ -52,14 +52,14 @@ backspaceInputted u = case u ^. uvWorld . input . pressedKeys . at ScancodeBacks
doSubInvRegexInput :: Universe -> Universe
doSubInvRegexInput u
| backspacetonothing =
u & uvWorld . hud . hudElement . subInventory . subInvMap . smRegex .~ Nothing
& uvWorld . hud . hudElement . subInventory . subInvMap %~ initialSelPos
& uvWorld . hud . hudElement . subInventory . subInvMap %~ setShownIntMap
| endkeys || endmouse =
u & uvWorld . hud . hudElement . subInventory . subInvMap %~ initialSelPos
u & uvWorld . hud . hudElement . subInventory . ciRegex .~ Nothing
-- & uvWorld . hud . hudElement . subInventory . subInvMap %~ initialSelPos
-- & uvWorld . hud . hudElement . subInventory . subInvMap %~ setShownIntMap
| endkeys || endmouse = u
-- u & uvWorld . hud . hudElement . subInventory . subInvMap %~ initialSelPos
| otherwise =
u & doTextInputOver (uvWorld . hud . hudElement . subInventory . subInvMap . smRegex . _Just)
& uvWorld . hud . hudElement . subInventory . subInvMap %~ setShownIntMap
u & doTextInputOver (uvWorld . hud . hudElement . subInventory . ciRegex . _Just)
-- & uvWorld . hud . hudElement . subInventory . subInvMap %~ setShownIntMap
where
endkeys =
any
@@ -67,7 +67,7 @@ doSubInvRegexInput u
[ScancodeReturn, ScancodeEscape, ScancodeSlash]
endmouse = Just True == (u ^? uvWorld . input . mouseButtons . ix ButtonLeft)
backspacetonothing =
u ^? uvWorld . hud . hudElement . subInventory . subInvMap . smRegex . _Just == Just ""
u ^? uvWorld . hud . hudElement . subInventory . ciRegex . _Just == Just ""
&& ScancodeBackspace `M.lookup` pkeys == Just InitialPress
pkeys = u ^. uvWorld . input . pressedKeys
@@ -158,7 +158,7 @@ updateInitialPressInGame uv sc = case sc of
ScancodeR -> over (uvWorld . cWorld . lWorld . creatures . ix 0) crToggleReloading uv
ScancodeT -> over uvWorld testEvent uv
ScancodeX -> uv & uvWorld %~ toggleTweakInv
ScancodeC -> over uvWorld toggleCombineInv uv
ScancodeC -> toggleCombineInv uv
-- the following should be put in a more sensible place
ScancodeSlash -> uv & uvWorld %~ updateEnterRegex
ScancodeBackspace -> uv & uvWorld %~ updateBackspaceRegex
@@ -174,12 +174,12 @@ updateBackspaceRegex :: World -> World
updateBackspaceRegex w = case di ^? subInventory of
Just NoSubInventory | secfocus (-1) 0 -> w & cWorld . lWorld . creatures . ix 0 . crManipulation %~ trybackspace
Just NoSubInventory | secfocus 2 3 -> w & cWorld . lWorld . creatures . ix 0 . crManipulation %~ trybackspaceclose
Just CombineInventory{} ->
w & hud . hudElement . subInventory . subInvMap
%~ ( (smRegex %~ enternonzeroregex)
. (smSelPos ?~ 0)
. setShownIntMap
)
-- Just CombineInventory{} ->
-- w & hud . hudElement . subInventory . subInvMap
-- %~ ( (smRegex %~ enternonzeroregex)
-- . (smSelPos ?~ 0)
-- . setShownIntMap
-- )
_ -> w
where
secfocus a b = fromMaybe False $ do
@@ -215,12 +215,12 @@ updateEnterRegex w = case w ^? hud . hudElement . subInventory of
%~ ( (closeRegex %~ enterregex)
. (manObject .~ InNearby SortNearby)
)
Just CombineInventory{} ->
w & hud . hudElement . subInventory . subInvMap
%~ ( setShownIntMap
. (smSelPos ?~ 0)
. (smRegex %~ enterregex)
)
Just CombineInventory{} -> w
-- w & hud . hudElement . subInventory . subInvMap
-- %~ ( setShownIntMap
-- . (smSelPos ?~ 0)
-- . (smRegex %~ enterregex)
-- )
_ -> w
where
di = w ^. hud . hudElement