private void LoadBrushes() { var path = GetBrushFilePath(); if (!System.IO.File.Exists(path)) return; using (var stream = new System.IO.StreamReader(path)) { while (!stream.EndOfStream) { string line = stream.ReadLine(); if (line == null) break; string[] info = line.Split(' '); var brush = new MultiTileBrush(int.Parse(info[0]), int.Parse(info[1])); int x = 0; int y = 0; for (int i = 2; i < info.Length; i++) { int id = int.Parse(info[i]); if (id >= 0) brush.AddTile(Tileset[id], x, y); y++; if (y >= brush.Height) { y = 0; x++; } } _brushes.Add(brush); } } }
private void CreateSelectionBrush(object obj) { if (_selection == null) return; var s = _selection.Value; var brush = new MultiTileBrush(s.Width, s.Height); for (var x = 0; x < s.Width; x++) { for (var y = 0; y < s.Height; y++) { brush.AddTile(_selectionScreen.TileAt(x + s.X, y + s.Y), x, y); } } _tileset.AddBrush(brush); _observedBrushes.Add(brush); }