rusza się

This commit is contained in:
Michał Dulski 2019-03-26 23:25:01 +01:00
parent 653e7cc3b7
commit d20cdcd6f9

View File

@ -18,7 +18,7 @@ namespace CzokoŚmieciarka.WPF.Models
static int _rows = 9;
static int _columns = 9;
List<Tile> _tiles = new List<Tile>();
private GarbageCollectorWPF garbageCollectorWPF = new GarbageCollectorWPF(_columns, new Coords(1,1), AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\garbageCollector.png");
private GarbageCollectorWPF garbageCollectorWPF = new GarbageCollectorWPF(_columns, new Coords(0,0), AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\garbageCollector.png");
public Board(List<AObject> objects, GarbageCollector garbageCollector)
{
@ -38,23 +38,17 @@ namespace CzokoŚmieciarka.WPF.Models
public void BoardRefresh(List<AObject> objects, GarbageCollector garbageCollector)
{
List<Tile> tiles = new List<Tile>();
foreach (var item in objects)
{
Tile tile = new Tile()
{
Data = item.Data,
Object = item
};
tiles.Add(tile);
_tiles[item.Location.X + item.Location.Y].Object = item;
_tiles[item.Location.X + item.Location.Y].Object.RefreshImage();
}
garbageCollectorWPF.Move(_columns, garbageCollector);
tiles[garbageCollectorWPF.Location.X + garbageCollectorWPF.Location.Y].Object.Image = MergedBitmaps(
new Bitmap(tiles[garbageCollectorWPF.Location.X + garbageCollectorWPF.Location.Y].Object.ImagePath),
_tiles[garbageCollectorWPF.Location.X + garbageCollectorWPF.Location.Y].Object.Image = MergedBitmaps(
new Bitmap(_tiles[garbageCollectorWPF.Location.X + garbageCollectorWPF.Location.Y].Object.ImagePath),
new Bitmap(garbageCollectorWPF.ImagePath));
_tiles = tiles;
}
public int Rows