コード例 #1
0
 private void OnturretBarrelChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     if (Source != null)
     {
         if (Source.WriteAccess)
         {
             SetPropertyEdited("turretBarrel", true);
         }
         else
         {
             bool exists = false;
             _turretBarrel = new ObservableCollection <VD2DataStructure>(DataStructureParseHelpers.GetturretBarrelDataStructureListFromVD2Data(this, DataXMLDoc, out exists));
             _turretBarrel.CollectionChanged += OnturretBarrelChanged;
             if (Source.ShortName == "Base")
             {
                 SetPropertyExistsInBaseData("turretBarrel", exists);
             }
             else
             {
                 SetPropertyExistsInBaseData("turretBarrel", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "turretBarrel"));
             }
             SetPropertyExists("turretBarrel", exists);
         }
     }
 }
コード例 #2
0
        public override void LoadDataFromXML()
        {
            bool exists = false;

            if (DataXMLDoc != null)
            {
                _weaponID = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "weaponID", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("weaponID", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("weaponID", EditorUI.UI.Ships.DoesPropertyExistInBaseData(weaponID, "weaponID"));
                }
                SetPropertyExists("weaponID", 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);
                _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);
                _turretWeapon = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "turretWeapon", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("turretWeapon", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("turretWeapon", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "turretWeapon"));
                }
                SetPropertyExists("turretWeapon", exists);
                _hardpointID = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "hardpointID", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("hardpointID", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("hardpointID", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "hardpointID"));
                }
                SetPropertyExists("hardpointID", exists);
                _linkedMovingElement = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "linkedMovingElement", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("linkedMovingElement", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("linkedMovingElement", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "linkedMovingElement"));
                }
                SetPropertyExists("linkedMovingElement", 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);
                _turnSoundID = ParseHelpers.GetStringFromVD2Data(DataXMLDoc, "turnSoundID", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("turnSoundID", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("turnSoundID", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "turnSoundID"));
                }
                SetPropertyExists("turnSoundID", exists);

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

                _barrelDelay = ParseHelpers.GetFloatFromVD2Data(DataXMLDoc, "barrelDelay", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("barrelDelay", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("barrelDelay", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "barrelDelay"));
                }
                SetPropertyExists("barrelDelay", exists);
                _pitchMax = ParseHelpers.GetFloatFromVD2Data(DataXMLDoc, "pitchMax", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("pitchMax", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("pitchMax", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "pitchMax"));
                }
                SetPropertyExists("pitchMax", exists);
                _dMoveSpeed = ParseHelpers.GetFloatFromVD2Data(DataXMLDoc, "dMoveSpeed", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("dMoveSpeed", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("dMoveSpeed", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "dMoveSpeed"));
                }
                SetPropertyExists("dMoveSpeed", exists);

                _bAlwaysShowInTactical = ParseHelpers.GetBoolFromVD2Data(DataXMLDoc, "bAlwaysShowInTactical", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("bAlwaysShowInTactical", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("bAlwaysShowInTactical", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "bAlwaysShowInTactical"));
                }
                SetPropertyExists("bAlwaysShowInTactical", exists);
                _bPhysicalBody = ParseHelpers.GetBoolFromVD2Data(DataXMLDoc, "bPhysicalBody", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("bPhysicalBody", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("bPhysicalBody", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "bPhysicalBody"));
                }
                SetPropertyExists("bPhysicalBody", exists);
                _bInvisibleTurret = ParseHelpers.GetBoolFromVD2Data(DataXMLDoc, "bInvisibleTurret", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("bInvisibleTurret", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("bInvisibleTurret", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "bInvisibleTurret"));
                }
                SetPropertyExists("bInvisibleTurret", exists);
                _bOssilateTargetAimNodeOffset = ParseHelpers.GetBoolFromVD2Data(DataXMLDoc, "bOssilateTargetAimNodeOffset", out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("bOssilateTargetAimNodeOffset", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("bOssilateTargetAimNodeOffset", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "bOssilateTargetAimNodeOffset"));
                }
                SetPropertyExists("bOssilateTargetAimNodeOffset", exists);

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

                _weaponDirection = DataStructureParseHelpers.GetweaponDirectionDataStructureFromVD2Data(this, DataXMLDoc, out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("weaponDirection", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("weaponDirection", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "weaponDirection"));
                }
                SetPropertyExists("weaponDirection", exists);
                _targetPriorityList = DataStructureParseHelpers.GettargetPriorityListDataStructureFromVD2Data(this, DataXMLDoc, out exists);
                if (Source.ShortName == "Base")
                {
                    SetPropertyExistsInBaseData("targetPriorityList", exists);
                }
                else
                {
                    SetPropertyExistsInBaseData("targetPriorityList", EditorUI.UI.Ships.DoesPropertyExistInBaseData(GetObjectID(), "targetPriorityList"));
                }
                SetPropertyExists("targetPriorityList", exists);

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