示例#1
0
		public ReflectionController (ModuleDefinition module)
		{
			m_reader = new AggressiveReflectionReader (module);
			m_writer = new ReflectionWriter (module);
			m_helper = new ReflectionHelper (module);
			m_importer = new DefaultImporter (module);
		}
        public override bool Export(ProjectAssetContainer container, string dirPath)
        {
            string folderPath = Path.Combine(dirPath, OcclusionCullingSettings.SceneExportFolder);
            string fileName   = $"{Name}.unity";
            string filePath   = Path.Combine(folderPath, fileName);

            if (!Directory.Exists(folderPath))
            {
                Directory.CreateDirectory(folderPath);
            }

            AssetExporter.Export(container, Components, filePath);
            DefaultImporter sceneImporter = new DefaultImporter(false);
            Meta            meta          = new Meta(sceneImporter, GUID);

            ExportMeta(container, meta, filePath);

            string subFolderPath = Path.Combine(folderPath, Name);

            if (OcclusionCullingData != null)
            {
                ExportAsset(container, OcclusionCullingData, subFolderPath);
            }
            if (LightingDataAsset != null)
            {
                ExportAsset(container, OcclusionCullingData, subFolderPath);
            }
            if (m_navMeshData != null)
            {
                ExportAsset(container, m_navMeshData, subFolderPath);
            }

            return(true);
        }
 public ReflectionController(ModuleDefinition module)
 {
     m_reader   = new AggressiveReflectionReader(module);
     m_writer   = new ReflectionWriter(module);
     m_helper   = new ReflectionHelper(module);
     m_importer = new DefaultImporter(module);
 }
        public override bool Export(ProjectAssetContainer container, string dirPath)
        {
            string folderPath   = Path.Combine(dirPath, Object.AssetsKeyword, OcclusionCullingSettings.SceneKeyword);
            string sceneSubPath = GetSceneName(container);
            string fileName     = $"{sceneSubPath}.unity";
            string filePath     = Path.Combine(folderPath, fileName);

            if (IsDuplicate(container))
            {
                if (FileUtils.Exists(filePath))
                {
                    Logger.Log(LogType.Warning, LogCategory.Export, $"Duplicate scene '{sceneSubPath}' has been found. Skipping");
                    return(false);
                }
            }

            folderPath = Path.GetDirectoryName(filePath);
            if (!DirectoryUtils.Exists(folderPath))
            {
                DirectoryUtils.CreateVirtualDirectory(folderPath);
            }

            AssetExporter.Export(container, Components.Select(t => t.Convert(container)), filePath);
            DefaultImporter sceneImporter = new DefaultImporter(container.ExportLayout);
            Meta            meta          = new Meta(GUID, sceneImporter);

            ExportMeta(container, meta, filePath);

            string sceneName     = Path.GetFileName(sceneSubPath);
            string subFolderPath = Path.Combine(folderPath, sceneName);

            if (OcclusionCullingData != null)
            {
                OcclusionCullingData.Initialize(container, m_occlusionCullingSettings);
                ExportAsset(container, OcclusionCullingData, subFolderPath);
            }

            return(true);
        }