public void setExit(DragEventArgs e, List <Cell> cells) { Point MouseOnCanvas = MouseUtilities.CorrectGetPosition(this.myMapController.view.pbxMap); int col = (Convert.ToInt32(MouseOnCanvas.X) - myMapController.myMap.boardXPos) / myMapController.myMap.myCellSize; int row = (Convert.ToInt32(MouseOnCanvas.Y) - myMapController.myMap.boardYPos) / myMapController.myMap.myCellSize; for (int i = 0; i < cells.Count; i++) { int[] mapData = myMapController.getMapData(i, cells); int startOfCol = mapData[0]; int endOfCol = mapData[1]; int startOfRow = mapData[2]; int endOfRow = mapData[3]; Cell cell = myMapController.myMap.myCells[i]; int index = cells.FindIndex(item => item.myColumn == col && item.myRow == row); if (index >= 0) { if (cell.myColumn == col && cell.myRow == row) { cell.isExit = true; } else { cell.isExit = false; } } } }
public void setTheseus(DragEventArgs e, List <Cell> cells) { Point MouseOnCanvas = MouseUtilities.CorrectGetPosition(this.myMapController.view.pbxMap); for (int i = 0; i < cells.Count; i++) { int[] mapData = myMapController.getMapData(i, cells); int startOfCol = mapData[0]; int endOfCol = mapData[1]; int startOfRow = mapData[2]; int endOfRow = mapData[3]; if (MouseOnCanvas.X > startOfCol && MouseOnCanvas.X < endOfCol && MouseOnCanvas.Y > startOfRow && MouseOnCanvas.Y < endOfRow) { myMapController.myMap.myCells[i].hasTheseus = true; } else { myMapController.myMap.myCells[i].hasTheseus = false; } } }