private void TryOpenCell(object sender, AdapterView.ItemClickEventArgs args) { var cell = mineField.GetCell(args.Position); if (cell.IsFlagged || cell.IsOpened) { return; } var coords = mineField.ConvertCoords(args.Position); mineField.TryOpenCell(coords[0], coords[1]); if (!(cell is FusedCell)) { return; } timer.Stop(); state = GameState.Lose; }
public static ICell GetCell(this IField field, int num) { var converted = field.ConvertCoords(num); return(field.GetCell(converted[0], converted[1])); }