private void PlaceShips(PlayerDto inDto) { int a = Enum.GetNames(typeof(ShipType)).Length; for (int i = 0; i < a; i++) { bool isPlacementOk = false; while (!isPlacementOk) { string shipType = ((ShipType)i).ToString(); var coordGetter = new CoordGetter(); var shipPointer = new ShipPointer(); PlaceShipRequest request = new PlaceShipRequest() { Coordinate = coordGetter.GetCoord((i + 1).ToString() + ". " + "Enter coordinate for your " + shipType.ToString() + ": "), Direction = shipPointer.PointShip(" Ship direction: (L-left, R-right, U-up, D-down): "), ShipType = (ShipType)i }; var responce = inDto.Board.PlaceShip(request); string r = responce.ToString(); if (r == ShipPlacement.Ok.ToString()) { isPlacementOk = true; Console.WriteLine(" Ship placement status: {0}", r); } else { Console.WriteLine(" Ship NOT PLACED! : {0}", r); } } } }
private void PlaceShips(PlayerDto inDto) { int a = Enum.GetNames(typeof(ShipType)).Length; for (int i = 0; i < a; i++) { bool isPlacementOk = false; while (!isPlacementOk) { string shipType = ((ShipType)i).ToString(); var coordGetter = new CoordGetter(); var shipPointer = new ShipPointer(); PlaceShipRequest request = new PlaceShipRequest() { Coordinate = coordGetter.GetCoord((i + 1).ToString() + ". " + "Enter coordinate for your " + shipType.ToString() + ": "), Direction = shipPointer.PointShip(" Ship direction: (L-left, R-right, U-up, D-down): "), ShipType = (ShipType)i }; var responce = inDto.Board.PlaceShip(request); string r = responce.ToString(); if (r == ShipPlacement.Ok.ToString()) { isPlacementOk = true; Console.WriteLine(" Ship placement status: {0}", r); } else Console.WriteLine(" Ship NOT PLACED! : {0}", r); } } }