private void StoreCopyOfSelectedTiles() { int layer = TileGridEditor.Instance.SelectedLayer; if (_selectedTiles.Count > 0) { _clipboardTiles.Clear(); Point topLeft = new Point(TileGrid.TileCols - 1, TileGrid.TileRows - 1); // locate the top left most coords of the group for (int i = 0; i < _selectedTiles.Count; i++) { topLeft.X = IceMath.Min(topLeft.X, _selectedTiles[i].X); topLeft.Y = IceMath.Min(topLeft.Y, _selectedTiles[i].Y); } Console.WriteLine("TopLeft: " + topLeft); for (int i = 0; i < _selectedTiles.Count; i++) { TileCopy tileCopy = new TileCopy(); tileCopy.Tile = TileGrid.TileLayers[layer] .Tiles[_selectedTiles[i].X][_selectedTiles[i].Y]; Point disp = new Point(); disp.X = _selectedTiles[i].X - topLeft.X; disp.Y = _selectedTiles[i].Y - topLeft.Y; tileCopy.Displacement = disp; _clipboardTiles.Add(tileCopy); } Console.WriteLine("======== CLIPBOARD ========"); for (int i = 0; i < _clipboardTiles.Count; i++) { Console.WriteLine(i + "] " + _clipboardTiles[i].Tile + ", Disp: " + _clipboardTiles[i].Displacement); } TileGridEditor.Instance.SetEnableStatePasteIcon(true); } }
private void StoreCopyOfSelectedTiles() { int layer = TileGridEditor.Instance.SelectedLayer; if (_selectedTiles.Count > 0) { _clipboardTiles.Clear(); Point topLeft = new Point(TileGrid.TileCols - 1, TileGrid.TileRows - 1); // locate the top left most coords of the group for (int i = 0; i < _selectedTiles.Count; i++) { topLeft.X = IceMath.Min(topLeft.X, _selectedTiles[i].X); topLeft.Y = IceMath.Min(topLeft.Y, _selectedTiles[i].Y); } Console.WriteLine("TopLeft: " + topLeft); for (int i = 0; i < _selectedTiles.Count; i++) { TileCopy tileCopy = new TileCopy(); tileCopy.Tile = TileGrid.TileLayers[layer] .Tiles[_selectedTiles[i].X][_selectedTiles[i].Y]; Point disp = new Point(); disp.X = _selectedTiles[i].X - topLeft.X; disp.Y = _selectedTiles[i].Y - topLeft.Y; tileCopy.Displacement = disp; _clipboardTiles.Add(tileCopy); } Console.WriteLine("======== CLIPBOARD ========"); for (int i = 0; i < _clipboardTiles.Count; i++) { Console.WriteLine(i + "] " + _clipboardTiles[i].Tile + ", Disp: " + _clipboardTiles[i].Displacement); } TileGridEditor.Instance.SetEnableStatePasteIcon(true); } }