public override void LoadDataFromXML() { bool exists = false; if (DataXMLDoc != null) { _objectID = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "objectID", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("objectID", exists); } else { SetPropertyExistsInBaseData("objectID", EditorUI.UI.Ships.DoesPropertyExistInBaseData(objectID, "objectID")); } SetPropertyExists("objectID", exists); _objectType = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "objectType", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("objectType", exists); } else { SetPropertyExistsInBaseData("objectType", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "objectType")); } SetPropertyExists("objectType", exists); _sunType = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "sunType", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("sunType", exists); } else { SetPropertyExistsInBaseData("sunType", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "sunType")); } SetPropertyExists("sunType", 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); _materialName = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "materialName", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("materialName", exists); } else { SetPropertyExistsInBaseData("materialName", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "materialName")); } SetPropertyExists("materialName", exists); _billboardFlareMaterial = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "billboardFlareMaterial", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("billboardFlareMaterial", exists); } else { SetPropertyExistsInBaseData("billboardFlareMaterial", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "billboardFlareMaterial")); } SetPropertyExists("billboardFlareMaterial", exists); _faction = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "faction", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("faction", exists); } else { SetPropertyExistsInBaseData("faction", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "faction")); } SetPropertyExists("faction", exists); _meshName = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "meshName", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("meshName", exists); } else { SetPropertyExistsInBaseData("meshName", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "meshName")); } SetPropertyExists("meshName", exists); _wireframeMaterial = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "wireframeMaterial", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("wireframeMaterial", exists); } else { SetPropertyExistsInBaseData("wireframeMaterial", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "wireframeMaterial")); } SetPropertyExists("wireframeMaterial", exists); _sunFlareParticleSystem = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "sunFlareParticleSystem", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("sunFlareParticleSystem", exists); } else { SetPropertyExistsInBaseData("sunFlareParticleSystem", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "sunFlareParticleSystem")); } SetPropertyExists("sunFlareParticleSystem", exists); _collisionShape = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "collisionShape", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("collisionShape", exists); } else { SetPropertyExistsInBaseData("collisionShape", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "collisionShape")); } SetPropertyExists("collisionShape", exists); _additionalObjectMesh = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "additionalObjectMesh", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("additionalObjectMesh", exists); } else { SetPropertyExistsInBaseData("additionalObjectMesh", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "additionalObjectMesh")); } SetPropertyExists("additionalObjectMesh", exists); _flareSize = ParseHelpers.GetInt32FromVD2Data(DataXMLDoc, "flareSize", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("flareSize", exists); } else { SetPropertyExistsInBaseData("flareSize", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "flareSize")); } SetPropertyExists("flareSize", exists); _scale = ParseHelpers.GetInt32FromVD2Data(DataXMLDoc, "scale", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("scale", exists); } else { SetPropertyExistsInBaseData("scale", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "scale")); } SetPropertyExists("scale", exists); _overworldScale = ParseHelpers.GetInt32FromVD2Data(DataXMLDoc, "overworldScale", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("overworldScale", exists); } else { SetPropertyExistsInBaseData("overworldScale", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "overworldScale")); } SetPropertyExists("overworldScale", exists); _rotateSpeed = ParseHelpers.GetInt32FromVD2Data(DataXMLDoc, "rotateSpeed", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("rotateSpeed", exists); } else { SetPropertyExistsInBaseData("rotateSpeed", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "rotateSpeed")); } SetPropertyExists("rotateSpeed", exists); _collisionShapeScale = ParseHelpers.GetInt32FromVD2Data(DataXMLDoc, "collisionShapeScale", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("collisionShapeScale", exists); } else { SetPropertyExistsInBaseData("collisionShapeScale", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "collisionShapeScale")); } SetPropertyExists("collisionShapeScale", exists); _isMassInfinite = ParseHelpers.GetBoolFromVD2Data(DataXMLDoc, "isMassInfinite", out exists); if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("isMassInfinite", exists); } else { SetPropertyExistsInBaseData("isMassInfinite", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "isMassInfinite")); } SetPropertyExists("isMassInfinite", exists); _specularColor = ParseHelpers.GetColorFromVD2Data(DataXMLDoc, "specularColor", out exists); _specularColor.OnElementChanged += specularColor_OnElementChanged; if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("specularColor", exists); } else { SetPropertyExistsInBaseData("specularColor", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "specularColor")); } SetPropertyExists("specularColor", exists); _diffuseColor = ParseHelpers.GetColorFromVD2Data(DataXMLDoc, "diffuseColor", out exists); _diffuseColor.OnElementChanged += diffuseColor_OnElementChanged; if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("diffuseColor", exists); } else { SetPropertyExistsInBaseData("diffuseColor", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "diffuseColor")); } SetPropertyExists("diffuseColor", exists); _damageCollisionField = new ObservableCollection <VD2DataStructure>(DataStructureParseHelpers.GetdamageCollisionFieldDataStructureListFromVD2Data(this, DataXMLDoc, out exists)); _damageCollisionField.CollectionChanged += OndamageCollisionFieldChanged; if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("damageCollisionField", exists); } else { SetPropertyExistsInBaseData("damageCollisionField", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "damageCollisionField")); } SetPropertyExists("damageCollisionField", exists); base.LoadDataFromXML(); } }
private void OndamageCollisionFieldChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { if (Source != null) { if (Source.WriteAccess) { SetPropertyEdited("damageCollisionField", true); } else { bool exists = false; _damageCollisionField = new ObservableCollection <VD2DataStructure>(DataStructureParseHelpers.GetdamageCollisionFieldDataStructureListFromVD2Data(this, DataXMLDoc, out exists)); _damageCollisionField.CollectionChanged += OndamageCollisionFieldChanged; if (Source.ShortName == "Base") { SetPropertyExistsInBaseData("damageCollisionField", exists); } else { SetPropertyExistsInBaseData("damageCollisionField", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "damageCollisionField")); } SetPropertyExists("damageCollisionField", exists); } } }