/// <summary> /// Load: initializing Constructor from an xml node. /// </summary> /// <param name="node">A "ShipDesign" node Nova save file (xml document).</param> public ShipDesign(XmlNode node) : base(node) { XmlNode mainNode = node.FirstChild; while (mainNode != null) { try { switch (mainNode.Name.ToLower()) { case "component": Blueprint = new Component(mainNode); break; case "icon": string iconSource = mainNode.FirstChild.Value; Icon = AllShipIcons.Data.GetIconBySource(iconSource); break; } } catch (Exception e) { Report.Error("Error loading Ship Design : " + e.Message); } mainNode = mainNode.NextSibling; } }
/// <Summary> /// Draw the seleced hull design by filling in the hull grid and the populating /// the costs and characteristics fields on the form. /// </Summary> /// <remarks> /// ??? (priority 5) We don't seem to have a ShipDesign at this stage, just a Hull component /// with attached modules? This makes determining Summary information difficult /// as that is what the ShipDesign is for. Need to decide if using a ShipDesign /// from the start would be better. /// </remarks> private void UpdateHullFields() { Hull hullProperties = selectedHull.Properties["Hull"] as Hull; HullGrid.ActiveModules = hullProperties.Modules; shipIcon = AllShipIcons.Data.GetIconBySource(selectedHull.ImageFile); HullImage.Image = shipIcon.Image; Description.Text = selectedHull.Description; if (hullProperties.IsStarbase) { CapacityType.Text = "Dock Capacity"; CapacityUnits.Text = "kT"; MaxCapacity.Text = hullProperties.DockCapacity.ToString(System.Globalization.CultureInfo.InvariantCulture); } else { CapacityType.Text = "Fuel Capacity"; CapacityUnits.Text = "mg"; MaxCapacity.Text = hullProperties.FuelCapacity.ToString(System.Globalization.CultureInfo.InvariantCulture); } UpdateDesignParameters(); }
/// <summary> /// Copy Constructor. /// </summary> /// <param name="copy">ShipDesign to copy.</param> public ShipDesign(ShipDesign copy) : base(copy) { Icon = (ShipIcon)copy.Icon.Clone(); Blueprint = new Component(copy.Blueprint); Update(); }
private void UpdateShips() { while (shipGrid.transform.childCount > 0) { Destroy(shipGrid.transform.GetChild(0).gameObject); shipGrid.transform.GetChild(0).SetParent(null); } //recuperer tous les vaisseaux dans ce hangar foreach (int i in _hangar.Ships) { ShipIcon icon = Instantiate(shipIconPrefab); Ship s = LocalDataManager.instance.GetShipInfo(i); icon.SetShip(s); icon.transform.SetParent(shipGrid.transform); } }