/// <summary>
 /// creates a TOTALAMOUNTOFSHIPS of THISTYPE and ADDS THEM TO THE RESULT
 /// </summary>
 private static void CreateShips(List <Ship> result, int totalAmountOfShips, Shiptype thisType)
 {
     for (int i = 0; i < totalAmountOfShips; i++)
     {
         result.Add(new Ship());
     }
 }
Example #2
0
        private void Ship_Checked(object sender, RoutedEventArgs e)
        {
            RadioButton rb = sender as RadioButton;

            if (rb != null)
            {
                string shipname = rb.Tag.ToString();
                switch (shipname)
                {
                case "Carrier":
                    slcShip = Shiptype.Carrier;
                    break;

                case "Cruiser":
                    slcShip = Shiptype.Cruiser;
                    break;

                case "Battleship":
                    slcShip = Shiptype.Battleship;
                    break;

                case "Submarine":
                    slcShip = Shiptype.Submarine;
                    break;

                case "Destroyer":
                    slcShip = Shiptype.Destroyer;
                    break;
                }
            }
        }
        private Ship CreateNewShip(Shiptype typeOfNewShip, Size renderSize)
        {
            Ship   result         = new Ship();
            double renderedWidth  = renderSize.Width / 11 * Grid.GetColumnSpan(result);
            double renderedHeight = renderSize.Height / 11 * Grid.GetRowSpan(result);

            result.Width  = renderedWidth;
            result.Height = renderedHeight;
            return(result);
        }
Example #4
0
 public UIShipType(Shiptype type, DateTime time, bool refresh) : base(UITypeEnum.ShipType, time, refresh)
 {
     ShipType = type;
 }
Example #5
0
 public UIShipType(Shiptype type, DateTime time) : base(UITypeEnum.ShipType, time)
 {
     ShipType = type;
 }
Example #6
0
 public UIShipType(Shiptype type, DateTime time, bool refresh) : this(time, refresh)
 {
     ShipType = type;
 }