private void OnlaunchTubeChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { if (Source != null) { if (Source.WriteAccess) { SetPropertyEdited("launchTube", true); } else { bool exists = false; _launchTube = new ObservableCollection <VD2DataStructure>(DataStructureParseHelpers.GetlaunchTubeDataStructureListFromVD2Data(this, DataXMLDoc, out exists)); _launchTube.CollectionChanged += OnlaunchTubeChanged; if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("launchTube", exists); } else { SetPropertyExistsInBaseData("launchTube", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "launchTube")); } SetPropertyExists("launchTube", exists); } } }
public override void LoadDataFromXML() { bool exists = false; if (DataXMLDoc != null) { _hangarID = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "hangarID", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("hangarID", exists); } else { SetPropertyExistsInBaseData("hangarID", EditorUI.UI.Ships.DoesPropertyExistInBaseData(hangarID, "hangarID")); } SetPropertyExists("hangarID", exists); _weaponType = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "weaponType", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("weaponType", exists); } else { SetPropertyExistsInBaseData("weaponType", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "weaponType")); } SetPropertyExists("weaponType", exists); _fighterShipID = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "fighterShipID", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("fighterShipID", exists); } else { SetPropertyExistsInBaseData("fighterShipID", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "fighterShipID")); } SetPropertyExists("fighterShipID", exists); _name = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "name", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("name", exists); } else { SetPropertyExistsInBaseData("name", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "name")); } SetPropertyExists("name", exists); _maxFighters = ParseHelpers.GetInt32FromVD2Data(DataXMLDoc, "maxFighters", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("maxFighters", exists); } else { SetPropertyExistsInBaseData("maxFighters", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "maxFighters")); } SetPropertyExists("maxFighters", exists); _launchRange = ParseHelpers.GetInt32FromVD2Data(DataXMLDoc, "launchRange", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("launchRange", exists); } else { SetPropertyExistsInBaseData("launchRange", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "launchRange")); } SetPropertyExists("launchRange", exists); _launchSpeedMultiplier = ParseHelpers.GetFloatFromVD2Data(DataXMLDoc, "launchSpeedMultiplier", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("launchSpeedMultiplier", exists); } else { SetPropertyExistsInBaseData("launchSpeedMultiplier", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "launchSpeedMultiplier")); } SetPropertyExists("launchSpeedMultiplier", exists); _bPrimary = ParseHelpers.GetBoolFromVD2Data(DataXMLDoc, "bPrimary", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("bPrimary", exists); } else { SetPropertyExistsInBaseData("bPrimary", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "bPrimary")); } SetPropertyExists("bPrimary", exists); _bRepairHangar = ParseHelpers.GetBoolFromVD2Data(DataXMLDoc, "bRepairHangar", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("bRepairHangar", exists); } else { SetPropertyExistsInBaseData("bRepairHangar", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "bRepairHangar")); } SetPropertyExists("bRepairHangar", exists); _bForceSearchAndDestroy = ParseHelpers.GetBoolFromVD2Data(DataXMLDoc, "bForceSearchAndDestroy", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("bForceSearchAndDestroy", exists); } else { SetPropertyExistsInBaseData("bForceSearchAndDestroy", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "bForceSearchAndDestroy")); } SetPropertyExists("bForceSearchAndDestroy", exists); _bIndependent = ParseHelpers.GetBoolFromVD2Data(DataXMLDoc, "bIndependent", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("bIndependent", exists); } else { SetPropertyExistsInBaseData("bIndependent", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "bIndependent")); } SetPropertyExists("bIndependent", exists); _bSecondaryFire = ParseHelpers.GetBoolFromVD2Data(DataXMLDoc, "bSecondaryFire", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("bSecondaryFire", exists); } else { SetPropertyExistsInBaseData("bSecondaryFire", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "bSecondaryFire")); } SetPropertyExists("bSecondaryFire", exists); _launchTube = new ObservableCollection <VD2DataStructure>(DataStructureParseHelpers.GetlaunchTubeDataStructureListFromVD2Data(this, DataXMLDoc, out exists)); _launchTube.CollectionChanged += OnlaunchTubeChanged; if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("launchTube", exists); } else { SetPropertyExistsInBaseData("launchTube", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "launchTube")); } SetPropertyExists("launchTube", exists); base.LoadDataFromXML(); } }