Exemplo n.º 1
0
 private void OnbabyChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     if (Source != null)
     {
         if (Source.WriteAccess)
         {
             SetPropertyEdited("baby", true);
         }
         else
         {
             bool exists = false;
             _baby = new ObservableCollection <VD2DataStructure>(DataStructureParseHelpers.GetbabyDataStructureListFromVD2Data(this, DataXMLDoc, out exists));
             _baby.CollectionChanged += OnbabyChanged;
             if (Source.ShortName == "Base")
             {
                 SetPropertyExistsInBaseData("baby", exists);
             }
             else
             {
                 SetPropertyExistsInBaseData("baby", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "baby"));
             }
             SetPropertyExists("baby", exists);
         }
     }
 }
Exemplo n.º 2
0
        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);
                _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);
                _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);
                _tacticalExplosionID = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "tacticalExplosionID", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("tacticalExplosionID", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("tacticalExplosionID", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "tacticalExplosionID"));
                }
                SetPropertyExists("tacticalExplosionID", exists);
                _babyExplosionID = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "babyExplosionID", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("babyExplosionID", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("babyExplosionID", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "babyExplosionID"));
                }
                SetPropertyExists("babyExplosionID", exists);
                _explosionID = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "explosionID", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("explosionID", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("explosionID", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "explosionID"));
                }
                SetPropertyExists("explosionID", exists);
                _asteroidSize = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "asteroidSize", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("asteroidSize", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("asteroidSize", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "asteroidSize"));
                }
                SetPropertyExists("asteroidSize", exists);
                _displayName = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "displayName", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("displayName", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("displayName", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "displayName"));
                }
                SetPropertyExists("displayName", exists);
                _asteroidType = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "asteroidType", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("asteroidType", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("asteroidType", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "asteroidType"));
                }
                SetPropertyExists("asteroidType", exists);

                _descriptionText = new ObservableCollection <string>(ParseHelpers.GetStringListFromVD2Data(DataXMLDoc, "descriptionText", out exists));
                _descriptionText.CollectionChanged += OndescriptionTextChanged;
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("descriptionText", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("descriptionText", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "descriptionText"));
                }
                SetPropertyExists("descriptionText", exists);
                _collisionShape = new ObservableCollection <string>(ParseHelpers.GetStringListFromVD2Data(DataXMLDoc, "collisionShape", out exists));
                _collisionShape.CollectionChanged += OncollisionShapeChanged;
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("collisionShape", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("collisionShape", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "collisionShape"));
                }
                SetPropertyExists("collisionShape", exists);

                _babySpawnDamage = ParseHelpers.GetInt32FromVD2Data(DataXMLDoc, "babySpawnDamage", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("babySpawnDamage", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("babySpawnDamage", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "babySpawnDamage"));
                }
                SetPropertyExists("babySpawnDamage", exists);

                _health = ParseHelpers.GetFloatFromVD2Data(DataXMLDoc, "health", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("health", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("health", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "health"));
                }
                SetPropertyExists("health", exists);

                _bShowInTactical = ParseHelpers.GetBoolFromVD2Data(DataXMLDoc, "bShowInTactical", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("bShowInTactical", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("bShowInTactical", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "bShowInTactical"));
                }
                SetPropertyExists("bShowInTactical", 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);
                _bCanAddViaBattleEditorSlider = ParseHelpers.GetBoolFromVD2Data(DataXMLDoc, "bCanAddViaBattleEditorSlider", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("bCanAddViaBattleEditorSlider", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("bCanAddViaBattleEditorSlider", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "bCanAddViaBattleEditorSlider"));
                }
                SetPropertyExists("bCanAddViaBattleEditorSlider", exists);

                _deathLinearVelocity = ParseHelpers.GetVector3DFromVD2Data(DataXMLDoc, "deathLinearVelocity", out exists);
                _deathLinearVelocity.OnElementChanged += deathLinearVelocity_OnElementChanged;
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("deathLinearVelocity", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("deathLinearVelocity", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "deathLinearVelocity"));
                }
                SetPropertyExists("deathLinearVelocity", exists);

                _deathSpawn = DataStructureParseHelpers.GetdeathSpawnDataStructureFromVD2Data(this, DataXMLDoc, out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("deathSpawn", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("deathSpawn", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "deathSpawn"));
                }
                SetPropertyExists("deathSpawn", exists);

                _baby = new ObservableCollection <VD2DataStructure>(DataStructureParseHelpers.GetbabyDataStructureListFromVD2Data(this, DataXMLDoc, out exists));
                _baby.CollectionChanged += OnbabyChanged;
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("baby", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("baby", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "baby"));
                }
                SetPropertyExists("baby", exists);
                base.LoadDataFromXML();
            }
        }