From df11cfbdc5b5382cc010397e5755188ee12ffeff Mon Sep 17 00:00:00 2001 From: justin Date: Sun, 19 Feb 2023 12:08:34 +0000 Subject: [PATCH] Continue shuffle --- src/Dodge/Update/Input.hs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/Dodge/Update/Input.hs b/src/Dodge/Update/Input.hs index 8f24a42a6..b5b0452d8 100644 --- a/src/Dodge/Update/Input.hs +++ b/src/Dodge/Update/Input.hs @@ -1,9 +1,4 @@ module Dodge.Update.Input ( - updateKeyInGame, - updateKeysInTerminal, - doInputScreenInput, - doSubInvRegexInput, - doRegexInput, updateUseInput, ) where @@ -37,14 +32,22 @@ import SDL updateUseInput :: Universe -> Universe updateUseInput u = case u ^? uvScreenLayers . _head of - Just (InputScreen thetext _) -> doInputScreenInput thetext u - Just screen@OptionScreen{_scPositionedMenuOption = mop, _scOptionFlag = flag, _scSelectionList = sellist, _scListDisplayParams = ldps} -> - optionScreenUpdate screen mop flag ldps sellist u - _ -> case u ^? uvWorld . hud . hudElement . subInventory of - Just (DisplayTerminal tmid) | inTermFocus (_uvWorld u) -> updateKeysInTerminal tmid u - Just (CombineInventory _ _ _) + Just sl -> updateUseInputOnScreen sl u + Nothing -> updateUseInputInGame (u ^. uvWorld . hud . hudElement) u + +updateUseInputOnScreen :: ScreenLayer -> Universe -> Universe +updateUseInputOnScreen sl = case sl of + InputScreen thetext _-> doInputScreenInput thetext + screen@OptionScreen{_scPositionedMenuOption = mop, _scOptionFlag = flag, _scSelectionList = sellist, _scListDisplayParams = ldps} -> + optionScreenUpdate screen mop flag ldps sellist + +updateUseInputInGame :: HUDElement -> Universe -> Universe +updateUseInputInGame h u = case h of + DisplayCarte -> u + DisplayInventory si _ -> case si of + DisplayTerminal tmid | inTermFocus (_uvWorld u) -> updateKeysInTerminal tmid u + CombineInventory _ _ _ | inSubInvRegex (u ^. uvWorld) -> doSubInvRegexInput u - -- _ | inInvRegex (u ^. uvWorld) -> doInvRegexInput u _ | inInvRegex (u ^. uvWorld) -> doRegexInput (-1) invRegex invRegex u _ | inCloseRegex (u ^. uvWorld) -> doRegexInput 2 closeRegex closeRegex u _ -> M.foldlWithKey' updateKeyInGame u pkeys