Example #1
0
        protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container)
        {
            if (IsModificationsFormat(container.Version))
            {
                YAMLMappingNode node = ExportYAMLRootObject(container);
                node.AddSerializedVersion(ToSerializedVersion(container.ExportVersion));
                bool hasRootGameObject     = IsRootGameObjectRelevant(container.ExportFlags);
                bool isRootGameObjectFirst = IsRootGameObjectFirst(container.ExportVersion);
                if (hasRootGameObject && isRootGameObjectFirst)
                {
                    node.Add(RootGameObjectName, RootGameObject.ExportYAML(container));
                }

                node.Add(ModificationName, Modification.ExportYAML(container));
                node.Add(GetSourcePrefabName(container.ExportVersion), SourcePrefab.ExportYAML(container));
                if (hasRootGameObject && !isRootGameObjectFirst)
                {
                    node.Add(RootGameObjectName, RootGameObject.ExportYAML(container));
                }
                if (IsPrefabAssetRelevant(container.ExportVersion))
                {
                    node.Add(GetIsPrefabAssetName(container.ExportVersion), IsPrefabAsset);
                }
                if (IsExplodedRelevant(container.ExportVersion))
                {
                    node.Add(IsExplodedName, IsExploded);
                }
                return(node);
            }
            else
            {
                YAMLMappingNode node = new YAMLMappingNode();
                node.Add(LastMergeIdentifierName, LastMergeIdentifier.ExportYAML(container));
                if (HasLastTemplateIdentifier(container.ExportVersion))
                {
                    node.Add(LastTemplateIdentifierName, LastTemplateIdentifier.ExportYAML(container));
                }
                node.Add(ObjectsName, Objects.ExportYAML(container));
                node.Add(FatherName, Father.ExportYAML(container));
                node.Add(IsDataTemplateName, IsDataTemplate);

                YAMLMappingNode baseNode = base.ExportYAMLRoot(container);
                node.Append(baseNode);
                return(node);
            }
        }
Example #2
0
        protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container)
        {
            YAMLMappingNode node = base.ExportYAMLRoot(container);

            node.Add(EditorHideFlagsName, (uint)GetEditorHideFlags(container.Version, container.Flags));
            if (HasGeneratorAsset(container.ExportVersion, container.ExportFlags))
            {
                node.Add(GeneratorAssetName, GetGeneratorAsset(container.Version, container.Flags).ExportYAML(container));
            }
            node.Add(ScriptName, Script.ExportYAML(container));
            node.Add(NameName, Name);
            node.Add(EditorClassIdentifierName, GetEditorClassIdentifier(container.Version, container.Flags));
            if (Structure != null)
            {
                YAMLMappingNode structureNode = (YAMLMappingNode)Structure.ExportYAML(container);
                node.Append(structureNode);
            }
            return(node);
        }
Example #3
0
        protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container)
        {
            YAMLMappingNode     node   = base.ExportYAMLRoot(container);
            MonoBehaviourLayout layout = container.ExportLayout.MonoBehaviour;

            node.Add(layout.EditorHideFlagsName, (uint)GetEditorHideFlags(container));
            if (layout.HasGeneratorAsset)
            {
                node.Add(layout.GeneratorAssetName, GetGeneratorAsset(container).ExportYAML(container));
            }
            node.Add(layout.ScriptName, Script.ExportYAML(container));
            node.Add(layout.NameName, Name);
            node.Add(layout.EditorClassIdentifierName, GetEditorClassIdentifier(container));
            if (Structure != null)
            {
                YAMLMappingNode structureNode = (YAMLMappingNode)Structure.ExportYAML(container);
                node.Append(structureNode);
            }
            return(node);
        }