public void Test4x4() { collection.Grids.Add(new TextureGrid { MatcherType = MatcherType.CardinalFlags, Name = "Grid-A" }); collection.Grids.Add(new TextureGrid { MatcherType = MatcherType.CardinalFlags, Name = "Grid-B" }); collection.Grids.Add(new TextureGrid { MatcherType = MatcherType.CardinalFlags, Name = "Grid-C" }); collection.Grids.Add(new TextureGrid { MatcherType = MatcherType.CardinalFlags, Name = "Grid-D" }); TextureTileGenerator.Regenerate(collection); TextureGridAutoLayout.ArrangeGrids(new GeneratorPreferences(), collection); collection.Grids[0].Position.Should().Be(new IntPoint()); collection.Grids[1].Position.Should().Be(new IntPoint(0, 128)); collection.Grids[2].Position.Should().Be(new IntPoint(0, 256)); collection.Grids[3].Position.Should().Be(new IntPoint(256, 0)); }
public void Corner_Generation() { var grid = new TextureGrid { CellSpacing = 5, MatcherType = MatcherType.Corner }; collection.Grids.Add(grid); TextureTileGenerator.Regenerate(collection); grid.Tiles.Count.Should().Be(32); }
void OnArrangeTiles() { var collections = selectedItem switch { TextureSetFile tf => tf.Collections.ToArray(), TileTextureCollection tc => new[] { tc }, TextureGrid gd => new[] { gd.Parent }, TextureTile t => new[] { t.Parent?.Parent }, _ => Array.Empty <TileTextureCollection>() }; foreach (var c in collections) { if (c != null) { TextureGridAutoLayout.ArrangeGrids(UserPreferences.Preferences, c); } } } void OnGenerateTiles() { var grids = selectedItem switch { TextureSetFile tf => tf.Collections.SelectMany(e => e.Grids), TileTextureCollection tc => tc.Grids, TextureGrid gd => Enumerable.Repeat(gd, 1), TextureTile t => Enumerable.Repeat(t.Parent, 1), _ => Array.Empty <TextureGrid>() }; foreach (var g in grids) { if (g != null) { TextureTileGenerator.Regenerate(g); } } }