示例#1
0
        public void SavedConnectionAddsConnectionToLayout()
        {
            var connection = new NodeConnection(new TilePos(0, 0), new TilePos(1, 0));

            _savedLayout.Connections.Add(connection);
            var gameLayout = new PuzzleLayout();

            _sut.LoadFromFlatLayout(_savedLayout, gameLayout);

            gameLayout.GetAllConnections().ShouldAllBeEquivalentTo(new[] { connection });
        }
示例#2
0
 public FlatLayout SaveToFlatLayout(PuzzleLayout layoutToSave)
 {
     return(new FlatLayout
     {
         Connections = layoutToSave.GetAllConnections(),
         Objects = layoutToSave.GetAllObjects()
                   .Select(puzzleObject => new FlatLayout.PuzzleObject
         {
             Type = puzzleObject.Type,
             Position = puzzleObject.Position,
             Properties = puzzleObject.Properties.Values.Select(x => new FlatLayout.PuzzleObject.Property()
             {
                 Key = x.Key,
                 Value = x.Value.ToString(),
                 Type = x.Type.ToString()
             }).ToList()
         })
                   .ToList()
     });
 }
示例#3
0
 public ClearLayoutCommand(PuzzleLayout layout)
 {
     _layout             = layout;
     _currentConnections = layout.GetAllConnections();
 }