Пример #1
0
        public ShipHull Clone()
        {
            ShipHull result;

            ShipHull source = (ShipHull)this;
            List<PartCount> newParts = new List<PartCount>();
            foreach (PartCount oldPart in this._allowedParts)
            {
                newParts.Add(new PartCount(oldPart.PartType,oldPart.ActionMechanism,oldPart.CountOfParts));
            }
            result = new ShipHull(source.Name, source._hullPoints.Max, source.Mass, newParts, source.ImageURL);
            return result;
        }
Пример #2
0
 public static int HullComparer(ShipHull a, ShipHull b)
 {
     if (a.Mass > b.Mass)
         return 1;
     else if (b.Mass > a.Mass)
         return -1;
     else
         return 0;
 }
Пример #3
0
 private void btnLoadHull_Click(object sender, EventArgs e)
 {
     hull = (ShipHull)cbxExistingHulls.SelectedItem;
     PartCounts = hull.AllowedParts;
     ShowHull();
 }
Пример #4
0
        private void btnSaveHull_Click(object sender, EventArgs e)
        {
            string Name = tbxHullName.Text;
            int MaxHP = int.Parse(nudHullPointsMax.Value.ToString());
            double Mass = Convert.ToDouble(nudHullMass.Value);
            hull = new ShipHull(Name, MaxHP, Mass, PartCounts,string.Format("Ship{0}.png",Convert.ToInt32(nudImage.Value)));

            hull.GetObjectXML(hullsDoc);
            hullsDoc.Save("ShipHulls.xml");
            LoadHulls();
        }
Пример #5
0
 private void btnClear_Click(object sender, EventArgs e)
 {
     hull = new ShipHull();
     ShowHull();
     tbxHullName.Text = string.Empty;
 }