public void RemoveTile() { TileGridLayer layer = new MultiTileGridLayer("tiles", 16, 16, 10, 10); layer.AddTile(2, 4, _tile1); layer.AddTile(6, 7, _tile2); AttachEvents(layer); layer.TileRemoved += (s, e) => { Assert.AreEqual(2, e.X); Assert.AreEqual(4, e.Y); Assert.AreSame(_tile1, e.Tile); Assert.AreEqual(1, layer.Tiles.Count()); Assert.AreEqual(0, layer.TilesAt(new TileCoord(2, 4)).Count()); }; layer.RemoveTile(2, 4, _tile1); Assert.AreEqual(EventFlags.TileRemoved | EventFlags.Modified, _eventsFired); }
private void SyncTilePoolListHandler(object sender, EventArgs e) { InitializeTileSizeList(); if (_layer != null) { List <LocatedTile> removeQueue = new List <LocatedTile>(); foreach (LocatedTile tile in _layer.Tiles) { if (_tileController.TilePoolManager.PoolFromItemKey(tile.Tile.Uid) == null) { removeQueue.Add(tile); } } foreach (LocatedTile tile in removeQueue) { _layer.RemoveTile(tile.X, tile.Y, tile.Tile); RemoveTileFromBrush(_brush, tile.Tile); } } }