Commit 55c10685 authored by Mart Lubbers's avatar Mart Lubbers

ShipAdventure compiles again\!

parent a494886f
Pipeline #12311 passed with stage
in 2 minutes and 49 seconds
......@@ -15,8 +15,11 @@ import C2.Apps.ShipAdventure.Images
import qualified Data.Map as DM
import qualified Data.IntMap.Strict as DIS
import qualified Data.Set as DS
from Graphics.Scalable import normalFontDef, above, class margin(..), instance margin (Span,Span), px
from Graphics.Scalable import :: ImageOffset, :: Host(..)
import Graphics.Scalable.Image => qualified grid
import Graphics.Scalable.Types
//from Graphics.Scalable import normalFontDef, above, class margin(..), instance margin (Span,Span), px
//from Graphics.Scalable import :: ImageOffset, :: Host(..)
derive JSEncode Map2D, Section, Maybe, Coord2D, Borders, Border, IntMap, Device, DeviceType, DeviceKind, CableType, Map
derive JSEncode Network, Cable, Object, ObjectType, MapAction, SectionStatus, Dir
......@@ -193,7 +196,8 @@ where
imageEditor = fromSVGEditor
{ initView = fst
, renderImage = \((_, act), ((inventoryMap, network), allDevices)) (ms2d, _) _ ->
above [] [] [margin (px 5.0, px zero) (editLayoutImage act allDevices network inventoryMap idx m2d) \\ m2d <- ms2d & idx <- [0..]] NoHost
//TODO above [] [] [margin (px 5.0, px zero) (editLayoutImage act allDevices network inventoryMap idx m2d) \\ m2d <- ms2d & idx <- [0..]] NoHost
above [] [] Nothing [] [margin (px 5.0, px zero) (editLayoutImage act allDevices network inventoryMap idx m2d) \\ m2d <- ms2d & idx <- [0..]] NoHost
, updView = \m v -> fst m
, updModel = \(_,data) newClSt -> (newClSt,data)
}
......@@ -209,10 +213,10 @@ editLayout
, OnAction (Action "Remove outer borders" ) (hasValue (uncurry (editOuterBorders Open)))
]
) @! ()
] <<@ ApplyLayout layout @! ()
] @! ()//TODO <<@ ApplyLayout layout @! ()
/*
where
layout = idLayout
/*
layout = sequenceLayouts
[ insertSubAt [1] (ui UIContainer) // Group the 'tool' tasks
, moveSubAt[2] [1,0]
......@@ -265,7 +269,7 @@ editSectionContents
[ChooseFromCheckGroup (\d -> d.Cable.description)]
(mapRead ('DIS'.elems o fst) (myCables |+< focusedShare)) focusedShare
)
] <<@ ApplyLayout layout @! ()
] @! () //TODO <<@ ApplyLayout layout @! ()
where
updateSectionEditor :: !String ![ChoiceOption a] (Shared [a]) (Shared [a]) -> Task [a] | iTask a
updateSectionEditor d updOpts listShare focusedShare
......@@ -279,8 +283,8 @@ editSectionContents
_ = viewInformation (Title "Please select section") [] "Please select section" @! ()
)
layout = idLayout
/*
layout = idLayout
layout = sequenceLayouts
[insertSubAt [1] (uia UIContainer (directionAttr Horizontal))
,moveSubAt [2] [1,0]
......@@ -497,7 +501,7 @@ initSection = {Section | sectionName = ""
, borders = initBorders
, hops = []
}
initBorders = {n=Open,e=Open,s=Open,w=Open}
initBorders = {Borders|n=Open,e=Open,s=Open,w=Open}
frigate_outline =: [(0.0,0.5)] ++ port ++ [(1.0,0.5)] ++ starboard
where
port = [(0.006,0.048),(0.107,0.01),(0.179,0.0),(0.684,0.0),(0.719,0.01),(0.752,0.029),(0.787,0.067),(0.829,0.106),(0.852,0.135),(0.898,0.212),(0.926,0.279),(0.999,0.462)]
......
......@@ -23,7 +23,13 @@ import C2.Apps.ShipAdventure.Editor
derive gLexOrd CableType, Capability
derive class iTask ObjectType, ActorStatus, Availability, ActorHealth, ActorEnergy, DeviceType, SectionStatus
derive class iTask Cable, Priority, Network, Device, CableType, DeviceKind, CommandAim, Set, Capability, CapabilityExpr
derive class iTask Cable, Priority, Network, Device, CableType, DeviceKind, CommandAim, Capability, CapabilityExpr
derive gEditor Set
derive gDefault Set
derive gText Set
derive JSONEncode Set
derive JSONDecode Set
derive JSEncode Map2D, Coord2D, Map, IntMap, Dir, User, Maybe, Section, Borders, Border, MapAction, Object, Actor
derive JSEncode ObjectType, ActorStatus, Availability, ActorHealth, ActorEnergy, DeviceType, SectionStatus
......@@ -286,7 +292,7 @@ deviceIdInNetworkSectionShare = sdsLens "deviceIdInNetworkSectionShare" (const (
write c3d network devIds = Ok (Just ({network & devices = 'DM'.put c3d devIds network.devices}))
notify :: !Coord3D !Network ![DeviceId] -> SDSNotifyPred Coord3D
notify c3d network devIds = \idx` -> c3d == idx`
notify c3d network devIds = \_ idx` -> c3d == idx`
devicesInSectionShare :: RWShared Coord3D [Device] [Device]
devicesInSectionShare
......@@ -360,8 +366,8 @@ cablesInSectionShare = sdsLens "cablesInSectionShare" (const ()) (SDSRead read)
in if inList network
{network & cableMapping = 'DIS'.put cable.cableId [(True, c3d) : coords] network.cableMapping}
) network cables))
notify :: !Coord3D !Network ![Cable] -> (Coord3D -> Bool)
notify c3d oldNetwork newCables = \c3d` -> c3d === c3d`
notify :: !Coord3D !Network ![Cable] -> SDSNotifyPred Coord3D
notify c3d oldNetwork newCables = \_ c3d` -> c3d === c3d`
cablesForSection :: !Coord3D !Network -> [Cable]
cablesForSection c3d { Network | cables, cableMapping }
......
......@@ -36,7 +36,7 @@ selectedContactShare = sdsLens "selectedContactShare" (const ()) (SDSRead read)
write _ st=:{selection, entities} e = Ok (Just {st & entities = 'DIS'.put selection e entities})
notify :: () MapState Entity -> SDSNotifyPred ()
notify _ _ _ = \_ -> False
notify _ _ _ = \_ _ -> False
userMapState :: User -> Shared MapState
userMapState u = sharedStore ("userMapState" +++ toString u) defSettings
......@@ -70,7 +70,7 @@ contactWithId = sdsLens "contactWithId" (const ()) (SDSRead read) (SDSWrite writ
write idx st=:{entities} e = Ok (Just {st & entities = 'DIS'.put idx e entities})
notify :: Int MapState Entity -> SDSNotifyPred Int
notify idx _ _ = \idx` -> idx == idx`
notify idx _ _ = \_ idx` -> idx == idx`
resetMapState :: Task ()
resetMapState = set defSettings mapState @! ()
......
......@@ -29,7 +29,7 @@ where
>>| allTasks (map (\f -> f me) (regEntities me))
>>~ \ents -> (allTasks (map (\f -> f me ents) (contBgTasks me)))
||-
whileAuthenticated me ents alwaysOnTasks tlist <<@ ApplyLayout (foldl1 sequenceLayouts [removeSubUIs (SelectByPath [0]),unwrapUI])
whileAuthenticated me ents alwaysOnTasks tlist <<@ ApplyLayout (sequenceLayouts [removeSubUIs (SelectByPath [0]),unwrapUI])
whileAuthenticated :: User [Entity]
(User -> [(String, User [Entity] -> Task ())])
......@@ -59,7 +59,7 @@ whileAuthenticated user ents alwaysOnTasks tlist
doOpen :: Workspace [(TaskId, WorklistRow)] -> Task ()
doOpen ws xs = sequence "openAssignedTasks" (map (\(taskId, _) -> appendOnce taskId (workOn taskId @! ()) ws) xs) @! ()
layout = foldl1 sequenceLayouts
layout = sequenceLayouts
[removeSubUIs (SelectByPath [1]) //Don't show the openAssignedTasks UI
,arrangeWithSideBar 0 RightSide 300 True
,layoutSubUIs (SelectByPath [0]) (arrangeWithTabs True)
......
......@@ -80,7 +80,7 @@ sharedGraph = sdsLens "sharedGraph" (const ()) (SDSRead read) (SDSWriteConst wri
write _ _ = Ok Nothing
notify _ _ = const True
notify _ _ = const (const True)
sectionUsersShare :: SectionUsersShare
sectionUsersShare = sharedStore "sectionUsersShare" 'DM'.newMap
......@@ -393,9 +393,9 @@ uiAbove refs = UIAbove refs
/*
modifyUI :: (TaskUITree -> TaskUILayout) -> Layout
modifyUI f = idLayout
/*
modifyUI f = \(uichange, json) -> case uichange of
ReplaceUI ui -> (ReplaceUI (toLayout ui (f (uiToRefs ui))), json)
_ -> (uichange, json)
......@@ -415,7 +415,7 @@ moveAround :: !(DrawMapForActor r o a) !User
moveAround viewDeck user inventoryForSectionShare
shipStatusShare userToActorShare inventoryForAllSectionsShare
= forever ( walkAround -||- changeDecks
-||- pickUpItems -||- dropItems) <<@ ApplyLayout (modifyUI moveAroundUI)
-||- pickUpItems -||- dropItems) //<<@ ApplyLayout (idLayout modifyUI moveAroundUI)
where
walkAround :: Task ()
walkAround
......@@ -526,7 +526,7 @@ sectionForSectionNumberShare = sdsLens "sectionForSectionNumberShare" (const ())
write (floorIdx, c2d) ms2d section = Ok (Just (updMap2D floorIdx (setSection c2d section) ms2d))
notify :: Coord3D Maps2D Section -> SDSNotifyPred Coord3D
notify c3d _ _ = \c3d` -> c3d == c3d`
notify c3d _ _ = \_ c3d` -> c3d == c3d`
pickupObject :: !Coord3D !(Object o) !User !(UserActorShare o a) !(FocusedSectionInventoryShare o)
-> Task () | iTask o & iTask a
......@@ -633,7 +633,7 @@ actorsInSectionShare userActorShare = sdsLens "actorsInSectionShare" (const ())
write c3d (sectionUsersMap, userActorMap) actors = Ok (Just ('DM'.put c3d (map (\a -> a.userName) actors) sectionUsersMap, 'DM'.fromList [(a.userName, a) \\ a <- actors]))
notify :: Coord3D (SectionUsersMap, UserActorMap o a) [Actor o a] -> SDSNotifyPred Coord3D
notify c3d _ _ = \c3d` -> c3d == c3d`
notify c3d _ _ = \_ c3d` -> c3d == c3d`
actorForUserShare :: (UserActorShare o a) -> FocusedUserActorShare o a | iTask o & iTask a
actorForUserShare userActorShare = mapMaybeLens "actorForUserShare" userActorShare
......
......@@ -53,7 +53,11 @@ damagePrediction
resetSections = set 'DS'.newSet disabledSections >>| damagePrediction
isDisabled c3d disSects = 'DS'.member c3d disSects
derive class iTask Set
derive gEditor Set
derive gDefault Set
derive gText Set
derive JSONEncode Set
derive JSONDecode Set
showCommandAims :: Task ()
showCommandAims = viewSharedInformation "Current Command Aims" [] commandAims @! ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment