Exemple #1
0
        public ProjectAssetContainer(ProjectExporter exporter, VirtualSerializedFile file, IEnumerable <Object> assets,
                                     IReadOnlyList <IExportCollection> collections, ExportOptions options)
        {
            if (exporter == null)
            {
                throw new ArgumentNullException(nameof(exporter));
            }
            if (file == null)
            {
                throw new ArgumentNullException(nameof(file));
            }
            if (collections == null)
            {
                throw new ArgumentNullException(nameof(collections));
            }
            m_exporter  = exporter;
            VirtualFile = file;

            ExportVersion  = options.Version;
            ExportPlatform = options.Platform;
            m_exportFlags  = options.Flags;

            foreach (Object asset in assets)
            {
                switch (asset.ClassID)
                {
                case ClassIDType.BuildSettings:
                    m_buildSettings = (BuildSettings)asset;
                    break;

                case ClassIDType.TagManager:
                    m_tagManager = (TagManager)asset;
                    break;

                case ClassIDType.ResourceManager:
                    AddResources((ResourceManager)asset);
                    break;
                }
            }

            List <SceneExportCollection> scenes = new List <SceneExportCollection>();

            foreach (IExportCollection collection in collections)
            {
                foreach (Object asset in collection.Assets)
                {
#warning TODO: unique asset:collection (m_assetCollections.Add)
                    m_assetCollections[asset.AssetInfo] = collection;
                }
                if (collection is SceneExportCollection scene)
                {
                    scenes.Add(scene);
                }
            }
            m_scenes = scenes.ToArray();
        }
        public ProjectAssetContainer(ProjectExporter exporter, VirtualSerializedFile file, IEnumerable <Object> assets,
                                     IReadOnlyList <IExportCollection> collections)
        {
            m_exporter   = exporter ?? throw new ArgumentNullException(nameof(exporter));
            VirtualFile  = file ?? throw new ArgumentNullException(nameof(file));
            ExportLayout = file.Layout;

            foreach (Object asset in assets)
            {
                switch (asset.ClassID)
                {
                case ClassIDType.BuildSettings:
                    m_buildSettings = (BuildSettings)asset;
                    break;

                case ClassIDType.TagManager:
                    m_tagManager = (TagManager)asset;
                    break;

                case ClassIDType.ResourceManager:
                    AddResources((ResourceManager)asset);
                    break;

                case ClassIDType.AssetBundle:
                    AddBundleAssets((AssetBundle)asset);
                    break;
                }
            }

            List <SceneExportCollection> scenes = new List <SceneExportCollection>();

            foreach (IExportCollection collection in collections)
            {
                foreach (Object asset in collection.Assets)
                {
#warning TODO: unique asset:collection (m_assetCollections.Add)
                    m_assetCollections[asset.AssetInfo] = collection;
                }
                if (collection is SceneExportCollection scene)
                {
                    scenes.Add(scene);
                }
            }
            m_scenes = scenes.ToArray();
        }