private void PlaceShip(int x, int y) { ShipInstance shipinst = new ShipInstance { pos = new Position { x = x, y = y }, rotation = rotation, shipId = shipId }; try { bships.AddShip(playerId, shipinst); //if we're here, success :D ColourShip(playerButtons, shipinst); shipId++; //NEXT! if (shipId < shipTypes.Length) { PlaceShipMsg(); } else { DonePlacing(); // :D } } catch (FaultException e) { AddChatMessage("Error", e.Reason.ToString()); } }
private void ColourShip(GridEntry[,] buttons, ShipInstance inst) { Position pos = inst.pos; for (int i = 0; i < shipTypes[inst.shipId].length; i++) { buttons[pos.x, pos.y].Ship = inst; //on the client side, the mathy helpers no-longer exist in Position :( if (inst.rotation == BShipService.Rotation.RIGHT) { pos.x++; } else { pos.y++; } } }
private void PlaceShip(int x, int y) { ShipInstance shipinst = new ShipInstance { pos = new Position { x = x, y = y}, rotation = rotation, shipId = shipId }; try { bships.AddShip(playerId, shipinst); //if we're here, success :D ColourShip(playerButtons, shipinst); shipId++; //NEXT! if (shipId < shipTypes.Length) { PlaceShipMsg(); } else { DonePlacing(); // :D } } catch (FaultException e) { AddChatMessage("Error", e.Reason.ToString()); } }