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; }
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; }
private void btnLoadHull_Click(object sender, EventArgs e) { hull = (ShipHull)cbxExistingHulls.SelectedItem; PartCounts = hull.AllowedParts; ShowHull(); }
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(); }
private void btnClear_Click(object sender, EventArgs e) { hull = new ShipHull(); ShowHull(); tbxHullName.Text = string.Empty; }