Reimplement dragging upwards with mouse
This commit is contained in:
@@ -51,7 +51,7 @@ updateUseInputInGame u = case u ^. uvWorld . hud . hudElement of
|
||||
_
|
||||
| inInvRegex (u ^. uvWorld) ->
|
||||
u & uvWorld . hud . hudElement %~ dodisplayregexinput (-1)
|
||||
-- . diSections %~ doRegexInput (u ^. uvWorld . input) (-1)
|
||||
-- . diSections %~ doRegexInput (u ^. uvWorld . input) (-1)
|
||||
& uvWorld . worldEventFlags . at InventoryChange ?~ ()
|
||||
& uvWorld %~ setInvPosFromSS
|
||||
_
|
||||
@@ -68,15 +68,17 @@ updateUseInputInGame u = case u ^. uvWorld . hud . hudElement of
|
||||
docombineregexinput ci = fromMaybe ci $ do
|
||||
sss <- ci ^? ciSections
|
||||
msel <- ci ^? ciSelection
|
||||
let (sss',msel') = doRegexInput (u ^. uvWorld . input) (-1) sss msel
|
||||
return $ ci & ciSections .~ sss'
|
||||
& ciSelection .~ msel'
|
||||
let (sss', msel') = doRegexInput (u ^. uvWorld . input) (-1) sss msel
|
||||
return $
|
||||
ci & ciSections .~ sss'
|
||||
& ciSelection .~ msel'
|
||||
dodisplayregexinput x di = fromMaybe di $ do
|
||||
sss <- di ^? diSections
|
||||
msel <- di ^? diSelection
|
||||
let (sss',msel') = doRegexInput (u ^. uvWorld . input) x sss msel
|
||||
return $ di & diSections .~ sss'
|
||||
& diSelection .~ msel'
|
||||
let (sss', msel') = doRegexInput (u ^. uvWorld . input) x sss msel
|
||||
return $
|
||||
di & diSections .~ sss'
|
||||
& diSelection .~ msel'
|
||||
|
||||
updatePressedButtonsCarte :: World -> World
|
||||
updatePressedButtonsCarte w = updatePressedButtonsCarte' (_mouseButtons (_input w)) w
|
||||
@@ -146,18 +148,25 @@ updateLongPressInGame uv sc = case sc of
|
||||
ScancodeSpace -> over uvWorld spaceAction uv
|
||||
_ -> uv
|
||||
|
||||
doRegexInput :: Input -> Int -> SelectionSections a -> Maybe (Int,Int)
|
||||
-> (SelectionSections a, Maybe (Int,Int))
|
||||
doRegexInput ::
|
||||
Input ->
|
||||
Int ->
|
||||
SelectionSections a ->
|
||||
Maybe (Int, Int) ->
|
||||
(SelectionSections a, Maybe (Int, Int))
|
||||
doRegexInput inp i sss msel
|
||||
| backspacetonothing || escapekey = endregex i 0
|
||||
| endkeys || endmouse = endregex (i + 1) (j -1)
|
||||
| otherwise = (sss & doTextInputOver inp (sssExtra . sssFilters . ix i . _Just)
|
||||
, msel)
|
||||
| otherwise =
|
||||
( sss & doTextInputOver inp (sssExtra . sssFilters . ix i . _Just)
|
||||
, msel
|
||||
)
|
||||
where
|
||||
endregex a b =
|
||||
(sss & sssExtra . sssFilters . ix i .~ Nothing
|
||||
( sss & sssExtra . sssFilters . ix i .~ Nothing
|
||||
& sssSections . ix i . ssItems .~ mempty
|
||||
, msel & ssSetCursor (ssLookupDown a b) sss)
|
||||
, msel & ssSetCursor (ssLookupDown a b) sss
|
||||
)
|
||||
j = fromMaybe 0 $ do
|
||||
itms <- sss ^? sssSections . ix (i + 1) . ssItems
|
||||
fst <$> IM.lookupMin itms
|
||||
@@ -247,9 +256,12 @@ spaceAction w = case w ^. hud . hudElement of
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
_ -> w
|
||||
DisplayInventory{_subInventory = DisplayTerminal{}} ->
|
||||
w & hud . hudElement . subInventory .~ NoSubInventory NoMouseSel Nothing
|
||||
w & hud . hudElement . subInventory
|
||||
.~ NoSubInventory MouseInvNothing Nothing
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
_ -> w & hud . hudElement . subInventory .~ NoSubInventory NoMouseSel Nothing
|
||||
_ ->
|
||||
w & hud . hudElement . subInventory
|
||||
.~ NoSubInventory MouseInvNothing Nothing
|
||||
where
|
||||
theLoc =
|
||||
doWorldPos
|
||||
@@ -261,22 +273,24 @@ toggleMap u = case u ^. uvWorld . hud . hudElement of
|
||||
DisplayCarte ->
|
||||
u & uvWorld . hud . hudElement
|
||||
.~ DisplayInventory
|
||||
{ _subInventory = NoSubInventory NoMouseSel Nothing
|
||||
{ _subInventory = NoSubInventory MouseInvNothing Nothing
|
||||
, _diSections = defaultInvSections
|
||||
, _diSelection = Nothing
|
||||
, _diSelectionExtra = 0
|
||||
}
|
||||
_ -> u & uvWorld . hud . hudElement .~ DisplayCarte
|
||||
|
||||
toggleTweakInv :: World -> World
|
||||
toggleTweakInv w = case w ^? hud . hudElement . subInventory of
|
||||
Just ExamineInventory{} -> w & thepointer .~ NoSubInventory NoMouseSel Nothing
|
||||
Just ExamineInventory{} -> w
|
||||
& thepointer .~ NoSubInventory MouseInvNothing Nothing
|
||||
_ -> w & thepointer .~ ExamineInventory -- mi
|
||||
where
|
||||
thepointer = hud . hudElement . subInventory
|
||||
|
||||
-- mi = 0 <$ (yourSelectedItem w >>= (^? itTweaks . tweakParams . ix 0))
|
||||
|
||||
tryCombine :: SelectionSections CombinableItem -> Maybe (Int,Int) -> World -> World
|
||||
tryCombine :: SelectionSections 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
|
||||
@@ -287,4 +301,5 @@ 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 NoMouseSel Nothing
|
||||
| otherwise = u & uvWorld . hud . hudElement . subInventory
|
||||
.~ NoSubInventory MouseInvNothing Nothing
|
||||
|
||||
Reference in New Issue
Block a user