/// <summary> /// Referesh the data classes /// </summary> protected void RefreshVesselData() { if (vessel == null || vessel.Parts == null) { return; } electricalData = new VesselElectricalData(vessel.Parts); heatData = new VesselThermalData(vessel.Parts); dataReady = true; if (Settings.DebugMode) { Utils.Log(String.Format("Dumping electrical database: \n{0}", electricalData.ToString())); Utils.Log(String.Format("Dumping thermal database: \n{0}", heatData.ToString())); } }
protected void InitializeEditorConstruct(ShipConstruct ship, bool forceReset) { dataReady = false; if (ship != null) { if (electricalData == null || forceReset) { electricalData = new VesselElectricalData(ship.Parts); } else { electricalData.RefreshData(false, ship.Parts); } if (heatData == null || forceReset) { heatData = new VesselThermalData(ship.Parts); } else { heatData.RefreshData(false, ship.Parts); } if (Settings.DebugMode) { Utils.Log(String.Format("Dumping electrical database: \n{0}", electricalData.ToString())); Utils.Log(String.Format("Dumping thermal database: \n{0}", heatData.ToString())); } dataReady = true; } else { if (Settings.DebugMode) { Utils.Log(String.Format("Ship is null")); } electricalData = new VesselElectricalData(new List <Part>()); heatData = new VesselThermalData(new List <Part>()); } }