From d20cdcd6f9d42af16a6a212bf8aa54edbb8b23f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dulski?= Date: Tue, 26 Mar 2019 23:25:01 +0100 Subject: [PATCH] =?UTF-8?q?rusza=20si=C4=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CzokoŚmieciarka.WPF/Models/Board.cs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Trunk/Interface/CzokoŚmieciarka.WPF/Models/Board.cs b/Trunk/Interface/CzokoŚmieciarka.WPF/Models/Board.cs index 73fe780..487ca84 100644 --- a/Trunk/Interface/CzokoŚmieciarka.WPF/Models/Board.cs +++ b/Trunk/Interface/CzokoŚmieciarka.WPF/Models/Board.cs @@ -18,7 +18,7 @@ namespace CzokoŚmieciarka.WPF.Models static int _rows = 9; static int _columns = 9; List _tiles = new List(); - 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 objects, GarbageCollector garbageCollector) { @@ -38,23 +38,17 @@ namespace CzokoŚmieciarka.WPF.Models public void BoardRefresh(List objects, GarbageCollector garbageCollector) { - List tiles = new List(); - 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