Beispiel #1
0
        private void FillCustomObjectTypes(SuperSettingsImporter importer)
        {
            m_CustomObjectTypes = new List <CustomObjectType>();

            if (m_ObjectTypesXml != null)
            {
                XDocument xdoc = XDocument.Parse(m_ObjectTypesXml.text);

                if (xdoc.Root.Name != "objecttypes")
                {
                    importer.ReportError("'{0}' is not a valid object types xml file.", m_ObjectTypesXml.name);
                    return;
                }

                // Create a dependency on our Object Types xml file so that settings are automatically updated if it changes
                importer.AddAssetPathDependency(AssetDatabase.GetAssetPath(m_ObjectTypesXml));

                // Import the data from the objecttype elements
                foreach (var xObjectType in xdoc.Descendants("objecttype"))
                {
                    var cot = new CustomObjectType();
                    cot.m_Name             = xObjectType.GetAttributeAs("name", "NoName");
                    cot.m_Color            = xObjectType.GetAttributeAsColor("color", Color.gray);
                    cot.m_CustomProperties = CustomPropertyLoader.LoadCustomPropertyList(xObjectType);

                    m_CustomObjectTypes.Add(cot);
                }
            }
        }
Beispiel #2
0
 public void AssignSettings(SuperSettingsImporter importer)
 {
     m_Version         = importer.Version;
     m_PixelsPerUnit   = importer.PixelsPerUnit;
     m_EdgesPerEllipse = importer.EdgesPerEllipse;
     m_ObjectTypesXml  = importer.ObjectTypesXml;
     m_LayerColors     = importer.LayerColors;
     FillCustomObjectTypes(importer);
 }
 public void AssignSettings(SuperSettingsImporter importer)
 {
     m_Version            = importer.Version;
     m_PixelsPerUnit      = importer.PixelsPerUnit;
     m_EdgesPerEllipse    = importer.EdgesPerEllipse;
     m_ObjectTypesXml     = importer.ObjectTypesXml;
     m_AnimationFramerate = importer.AnimationFramerate;
     m_DefaultMaterial    = importer.DefaultMaterial;
     m_LayerColors        = importer.LayerColors;
     FillCustomObjectTypes(importer);
     AssignPrefabReplacements(importer);
 }
        public void AssignPrefabReplacements(SuperSettingsImporter importer)
        {
            // Clean up the importer settings
            // Remove any prefab replacements for types that don't exist anymore
            importer.PrefabReplacements.RemoveAll(r => !m_CustomObjectTypes.Any(t => r.m_TypeName == t.m_Name));

            // Add prefab replacements for missing object types
            foreach (var cot in m_CustomObjectTypes)
            {
                if (!importer.PrefabReplacements.Any(r => cot.m_Name == r.m_TypeName))
                {
                    var rep = new TypePrefabReplacement();
                    rep.m_TypeName = cot.m_Name;
                    importer.PrefabReplacements.Add(rep);
                }
            }

            // Assign our own list of prefab replacements
            m_PrefabReplacements = importer.PrefabReplacements;
        }