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 }); }
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() }); }
public ClearLayoutCommand(PuzzleLayout layout) { _layout = layout; _currentConnections = layout.GetAllConnections(); }