public MDATilePart(int column, int row, int tileWidth, int tileHeight, MDATile mainTile) : base(column, row, tileWidth, tileHeight) { clickableColor = Brushes.Purple; unclickableColour = Brushes.MediumPurple; imgpath = "../../Resources/Mda.png"; img = loadImage(imgpath, img, this.tileWidth, this.tileHeight); fillBrush = Brushes.Purple; this._mainTile = mainTile; }
//my changes public bool DrawAComponent(GridTile component, GridTile selectedTile) { GridTile replace; if (selectedTile is EmptyTile) { if (component is MDATile) { MDATile m = (MDATile)component; //replace empty tile with mda // 2 row for (int i = selectedTile.Row; i <= selectedTile.Row + 1; i++) { // 17 column if (selectedTile.Column != 0) { selectedTile.Column = 0; } for (int j = selectedTile.Column; j < selectedTile.Column + 17; j++) { replace = FindTileInRowColumnCoordinates(j, i); if (replace is EmptyTile) { this.gridTiles.Remove(replace); MDATilePart p = new MDATilePart(j, i, tileWidth, tileHeight, m); m.AddTilePart(p); this.gridTiles.Add(p); } } } } else { if (component is CheckInTile) { if (!this.HideAllRowsButOne(component, 0)) { return(false); } } else if (component is DropOffTile) { if (!this.HideAllRowsButOne(component, 11)) { return(false); } } else { if (component.Row == 0 || component.Row == bottomRow) { return(false); } } this.gridTiles.Remove(selectedTile); this.gridTiles.Add(component); } if (component is CheckInTile) { // send this list to the back-end, reason for sending only the checkins since it is the root so from that the back-end // can retrieve all the node that connected to this check in and create nodes in the back-end accordingly => not necessary to send all the nodes(except the checkins) _simulationSettings.FrontNodes.Add(component); } return(true); } return(false); }