Simplify updating selection sections

This commit is contained in:
2023-02-18 15:46:03 +00:00
parent 6eca3bab38
commit 41851ba24d
5 changed files with 230 additions and 87 deletions
+47 -1
View File
@@ -1,5 +1,6 @@
module Dodge.Default.World where
import Control.Lens
import Dodge.Data.SelectionList
import Data.Graph.Inductive.Graph hiding ((&))
import qualified Data.Map as M
@@ -151,7 +152,7 @@ defaultDisplaySections = SelectionSections
defaultHUD :: HUD
defaultHUD =
HUD
{ _hudElement = DisplayInventory {_subInventory =NoSubInventory, _diSections = defaultDisplaySections}
{ _hudElement = DisplayInventory {_subInventory =NoSubInventory, _diSections = defaultInvSections}
, _carteCenter = V2 0 0
, _carteZoom = 0.5
, _carteRot = 0
@@ -170,3 +171,48 @@ defaultHUD =
-- }
-- where
-- f (V2 x y) = V3 x y 100
defaultInvSections :: SelectionSections ()
defaultInvSections = SelectionSections
{ _sssSections = IM.fromDistinctAscList $ zip [-1..]
[ defaultFiltSection
, defaultInvSection
, defaultYouSection
, defaultFiltSection
, defaultCOSection
]
, _sssSelPos = Nothing
}
defaultSS :: SelectionSection a
defaultSS = SelectionSection
{ _ssItems = mempty
, _ssCursor = Nothing
, _ssMinSize = 10
, _ssOffset = 0
, _ssShownItems = []
, _ssIndent = 0
, _ssDescriptor = ""
}
defaultCOSection :: SelectionSection ()
defaultCOSection = defaultSS
& ssIndent .~ 2
& ssDescriptor .~ "CLOSE OBJECTS"
defaultFiltSection :: SelectionSection a
defaultFiltSection = defaultSS
& ssIndent .~ 0
& ssDescriptor .~ "INV"
& ssMinSize .~ 0
defaultInvSection :: SelectionSection ()
defaultInvSection = defaultSS
& ssDescriptor .~ "INVENTORY ITEMS"
defaultYouSection :: SelectionSection ()
defaultYouSection = defaultSS
-- & ssRegex .~ UnavailableRegex
& ssIndent .~ 2
& ssMinSize .~ 1
& ssDescriptor .~ "YOUR STATUS"