Continue shuffle
This commit is contained in:
@@ -2,6 +2,8 @@ module Dodge.Update.Input (
|
||||
updateUseInput,
|
||||
) where
|
||||
|
||||
import Dodge.Data.Combine
|
||||
import Geometry
|
||||
import Dodge.SelectionList
|
||||
import Dodge.Base.Window
|
||||
import Dodge.Menu.Option
|
||||
@@ -43,16 +45,28 @@ updateUseInputOnScreen sl = case sl of
|
||||
|
||||
updateUseInputInGame :: HUDElement -> Universe -> Universe
|
||||
updateUseInputInGame h u = case h of
|
||||
DisplayCarte -> u
|
||||
DisplayCarte -> over uvWorld updatePressedButtonsCarte u
|
||||
DisplayInventory si _ -> case si of
|
||||
DisplayTerminal tmid | inTermFocus (_uvWorld u) -> updateKeysInTerminal tmid u
|
||||
CombineInventory _ _ _
|
||||
DisplayTerminal tmid
|
||||
| lbinitialpress && inTermFocus w ->
|
||||
over uvWorld (doTerminalEffectLB (w ^?! cWorld . lWorld . terminals . ix tmid)) u
|
||||
| inTermFocus (_uvWorld u) -> updateKeysInTerminal tmid u
|
||||
| lbinitialpress ->
|
||||
u & uvWorld . cWorld . lWorld . terminals . ix tmid . tmInput . tiFocus %~ const True
|
||||
CombineInventory _ _ sss
|
||||
| inSubInvRegex (u ^. uvWorld) -> doSubInvRegexInput u
|
||||
| lbinitialpress -> tryCombine sss u -- maybeexitcombine (maybe id doCombine mi w)
|
||||
_ | inInvRegex (u ^. uvWorld) -> doRegexInput (-1) invRegex invRegex u
|
||||
_ | inCloseRegex (u ^. uvWorld) -> doRegexInput 2 closeRegex closeRegex u
|
||||
_ -> M.foldlWithKey' updateKeyInGame u pkeys
|
||||
where
|
||||
w = u ^. uvWorld
|
||||
pkeys = u ^. uvWorld . input . pressedKeys
|
||||
pmb = u ^. uvWorld . input . mouseButtons
|
||||
lbinitialpress = pmb ^? ix ButtonLeft == Just False
|
||||
|
||||
tryCombine :: SelectionSections CombinableItem -> Universe -> Universe
|
||||
tryCombine sss w = w
|
||||
|
||||
doTextInputOver :: ASetter' Universe String -> Universe -> Universe
|
||||
doTextInputOver p u =
|
||||
@@ -374,3 +388,24 @@ setSelectionListRestriction :: Configuration -> ScreenLayer -> ScreenLayer
|
||||
setSelectionListRestriction cfig screen = fromMaybe screen $ do
|
||||
ldps <- screen ^? scListDisplayParams
|
||||
return $ screen & scAvailableLines %~ const (getAvailableListLines ldps cfig)
|
||||
|
||||
updatePressedButtonsCarte w = updatePressedButtonsCarte' (_mouseButtons (_input w)) w
|
||||
|
||||
updatePressedButtonsCarte' :: M.Map MouseButton Bool -> World -> World
|
||||
updatePressedButtonsCarte' pkeys w
|
||||
| isDown ButtonRight =
|
||||
w
|
||||
& input . clickMousePos .~ _mousePos (_input w)
|
||||
& hud . carteCenter %~ (-.- trans)
|
||||
| isDown ButtonLeft =
|
||||
w
|
||||
& input . clickMousePos .~ _mousePos (_input w)
|
||||
& hud . carteRot -~ rot
|
||||
& hud . carteZoom *~ czoom
|
||||
| otherwise = w
|
||||
where
|
||||
isDown but = but `M.member` pkeys
|
||||
rot = angleBetween (_mousePos (_input w)) (_clickMousePos (_input w))
|
||||
czoom = magV (_mousePos (_input w)) / magV (_clickMousePos (_input w))
|
||||
trans = rotateV (w ^. hud . carteRot)
|
||||
$ 1 / (w ^. hud . carteZoom) *.* (_mousePos (_input w) -.- _clickMousePos (_input w))
|
||||
|
||||
Reference in New Issue
Block a user