Remove SelectionSections
This commit is contained in:
@@ -70,7 +70,7 @@ updateUseInputInGame u = case u ^. uvWorld . hud . hudElement of
|
||||
sss <- ci ^? ciSections
|
||||
msel <- ci ^? ciSelection
|
||||
filts <- ci ^? ciFilters
|
||||
let (sss', msel',filts') = doRegexInput (u ^. uvWorld . input) (-1) sss msel filts
|
||||
let (sss', msel', filts') = doRegexInput (u ^. uvWorld . input) (-1) sss msel filts
|
||||
return $
|
||||
ci & ciSections .~ sss'
|
||||
& ciSelection .~ msel'
|
||||
@@ -79,7 +79,7 @@ updateUseInputInGame u = case u ^. uvWorld . hud . hudElement of
|
||||
sss <- di ^? diSections
|
||||
msel <- di ^? diSelection
|
||||
filts <- di ^? diFilters
|
||||
let (sss', msel',filts') = doRegexInput (u ^. uvWorld . input) x sss msel filts
|
||||
let (sss', msel', filts') = doRegexInput (u ^. uvWorld . input) x sss msel filts
|
||||
return $
|
||||
di & diSections .~ sss'
|
||||
& diSelection .~ msel'
|
||||
@@ -156,10 +156,10 @@ updateLongPressInGame uv sc = case sc of
|
||||
doRegexInput ::
|
||||
Input ->
|
||||
Int ->
|
||||
SelectionSections a ->
|
||||
IM.IntMap (SelectionSection a) ->
|
||||
Maybe (Int, Int) ->
|
||||
IM.IntMap (Maybe String) ->
|
||||
(SelectionSections a, Maybe (Int, Int), IM.IntMap (Maybe String))
|
||||
(IM.IntMap (SelectionSection a), Maybe (Int, Int), IM.IntMap (Maybe String))
|
||||
doRegexInput inp i sss msel filts
|
||||
| backspacetonothing || escapekey = endregex i 0
|
||||
| endkeys || endmouse = endregex (i + 1) (j -1)
|
||||
@@ -170,13 +170,12 @@ doRegexInput inp i sss msel filts
|
||||
)
|
||||
where
|
||||
endregex a b =
|
||||
( sss
|
||||
& sssSections . ix i . ssItems .~ mempty
|
||||
( sss & ix i . ssItems .~ mempty
|
||||
, msel & ssSetCursor (ssLookupDown a b) sss
|
||||
, filts & ix i .~ Nothing
|
||||
)
|
||||
j = fromMaybe 0 $ do
|
||||
itms <- sss ^? sssSections . ix (i + 1) . ssItems
|
||||
itms <- sss ^? ix (i + 1) . ssItems
|
||||
fst <$> IM.lookupMin itms
|
||||
escapekey = ScancodeEscape `M.lookup` pkeys == Just InitialPress
|
||||
endkeys =
|
||||
@@ -208,7 +207,6 @@ updateBackspaceRegex w = case di ^? subInventory of
|
||||
i <- di ^? diSelection . _Just . _1
|
||||
return $ i == a || i == b
|
||||
trybackspace x he = fromMaybe he $ do
|
||||
sss <- he ^? diSections
|
||||
str <- he ^? diFilters . ix x . _Just
|
||||
return $ case str of
|
||||
(_ : _) ->
|
||||
@@ -216,7 +214,6 @@ updateBackspaceRegex w = case di ^? subInventory of
|
||||
& diSelection ?~ (x, 0)
|
||||
[] -> he & diFilters . ix x .~ Nothing
|
||||
trybackspace' x ci = fromMaybe ci $ do
|
||||
sss <- ci ^? ciSections
|
||||
str <- ci ^? ciFilters . ix x . _Just
|
||||
return $ case str of
|
||||
(_ : _) ->
|
||||
@@ -288,7 +285,8 @@ toggleMap u = case u ^. uvWorld . hud . hudElement of
|
||||
|
||||
toggleTweakInv :: World -> World
|
||||
toggleTweakInv w = case w ^? hud . hudElement . subInventory of
|
||||
Just ExamineInventory{} -> w
|
||||
Just ExamineInventory{} ->
|
||||
w
|
||||
& thepointer .~ NoSubInventory MouseInvNothing Nothing
|
||||
_ -> w & thepointer .~ ExamineInventory -- mi
|
||||
where
|
||||
@@ -296,10 +294,14 @@ toggleTweakInv w = case w ^? hud . hudElement . subInventory of
|
||||
|
||||
-- mi = 0 <$ (yourSelectedItem w >>= (^? itTweaks . tweakParams . ix 0))
|
||||
|
||||
tryCombine :: SelectionSections CombinableItem -> Maybe (Int, Int) -> World -> World
|
||||
tryCombine ::
|
||||
IM.IntMap (SelectionSection CombinableItem) ->
|
||||
Maybe (Int, Int) ->
|
||||
World ->
|
||||
World
|
||||
tryCombine sss msel w = fromMaybe w $ do
|
||||
(i, j) <- msel
|
||||
CombinableItem is it _ <- sss ^? sssSections . ix i . ssItems . ix j . siPayload
|
||||
CombinableItem is it _ <- sss ^? ix i . ssItems . ix j . siPayload
|
||||
return $
|
||||
snd (createItemYou it (foldr (destroyInvItem 0) w (sort is)))
|
||||
& cWorld . lWorld . creatures . ix 0 . crHammerPosition .~ HammerDown
|
||||
@@ -307,5 +309,6 @@ tryCombine sss msel w = fromMaybe w $ do
|
||||
maybeExitCombine :: Universe -> Universe
|
||||
maybeExitCombine u
|
||||
| ButtonRight `M.member` (u ^. uvWorld . input . mouseButtons) = u
|
||||
| otherwise = u & uvWorld . hud . hudElement . subInventory
|
||||
.~ NoSubInventory MouseInvNothing Nothing
|
||||
| otherwise =
|
||||
u & uvWorld . hud . hudElement . subInventory
|
||||
.~ NoSubInventory MouseInvNothing Nothing
|
||||
|
||||
Reference in New Issue
Block a user