public void AutoGenerateChunks(Classes.Scene.EditorLayer LayerA, Classes.Scene.EditorLayer LayerB) { Methods.Internal.UserInterface.ShowWaitingBox(); System.Threading.Thread thread = new System.Threading.Thread(() => { int width = (LayerA.Width > LayerB.Width ? LayerA.Width : LayerB.Width); int height = (LayerA.Height > LayerB.Height ? LayerA.Height : LayerB.Height); int ChunkWidth = width / 8; int ChunkHeight = height / 8; for (int i = 0; i < ChunkHeight; ++i) { for (int j = 0; j < ChunkWidth; ++j) { int tileX = j * 8; int tileY = i * 8; int x1 = j * 8; int x2 = x1 + 8; int y1 = i * 8; int y2 = y1 + 8; ushort[][] ChunkMapA = new ushort[8][]; ushort[][] ChunkMapB = new ushort[8][]; for (int x = 0; x < 8; x++) { ChunkMapA[x] = new ushort[8]; ChunkMapB[x] = new ushort[8]; for (int y = 0; y < 8; y++) { ChunkMapA[x][y] = LayerA.GetTileAt(tileX + x, tileY + y); ChunkMapB[x][y] = LayerB.GetTileAt(tileX + x, tileY + y); } } var newChunk = new TexturedStamps.TexturedTileChunk(ChunkMapA, ChunkMapB, 8); var duplicate = StageStamps.StampList.Exists(x => x.TileMapCodeA == newChunk.TileMapCodeA && x.TileMapCodeB == newChunk.TileMapCodeB); if (duplicate == false) { AddChunk(newChunk); } } } Methods.Internal.UserInterface.CloseWaitingBox(); }) { IsBackground = true }; thread.Start(); }
public void AddChunk(TexturedStamps.TexturedTileChunk Stamp) { StageStamps.TexturedStampList.Add(Stamp); }