Пример #1
0
 public extern static ArtifactID ForceProduceArtifact(ArtifactKey artifactKey);
Пример #2
0
 public extern static OnDemandProgress GetOnDemandArtifactProgress(ArtifactKey artifactKey);
Пример #3
0
 public extern static ArtifactID ProduceArtifactAsync(ArtifactKey artifactKey);
Пример #4
0
 public static ArtifactID LookupArtifact(ArtifactKey artifactKey) => _LookupArtifact(artifactKey);
Пример #5
0
 private extern static ArtifactID _LookupArtifact(ArtifactKey artifactKey);
 public extern static ArtifactID LookupArtifact(ArtifactKey artifactKey);
Пример #7
0
        internal static void BuildCatalog()
        {
            using (new EditorPerformanceTracker(nameof(BuildCatalog)))
            {
                s_StyleCatalog = new StyleCatalog();

                bool          rebuildCatalog = true;
                List <string> paths          = new List <string>();
                string        catalogHash    = "";

                if (!EditorApplication.isBuildingAnyResources)
                {
                    paths = GetDefaultStyleCatalogPaths();

                    foreach (var editorUssPath in AssetDatabase.GetAllAssetPaths().Where(IsEditorStyleSheet))
                    {
                        var artifactKey = new ArtifactKey(new GUID(AssetDatabase.AssetPathToGUID(editorUssPath)));
                        var artifactID  = AssetDatabaseExperimental.LookupArtifact(artifactKey);

                        //Only add it to the list of paths it if has been imported, since later on
                        //the asset will be loaded, and if not imported it will fail.
                        if (artifactID.isValid)
                        {
                            paths.Add(editorUssPath);
                        }
                    }

                    var forceRebuild = s_RefreshGlobalStyleCatalog;
                    s_RefreshGlobalStyleCatalog = false;

                    catalogHash = ComputeCatalogHash(paths);
                    if (!forceRebuild && File.Exists(k_GlobalStyleCatalogCacheFilePath))
                    {
                        using (var cacheCatalogStream = new FileStream(k_GlobalStyleCatalogCacheFilePath, FileMode.Open,
                                                                       FileAccess.Read, FileShare.Read))
                        {
                            using (var ccReader = new BinaryReader(cacheCatalogStream))
                            {
                                string cacheHash = ccReader.ReadString();
                                if (cacheHash == catalogHash)
                                {
                                    rebuildCatalog = !styleCatalog.Load(ccReader);
                                }
                            }
                        }
                    }
                }

                if (rebuildCatalog)
                {
                    Console.WriteLine($"Loading style catalogs ({paths.Count})\r\n\t{String.Join("\r\n\t", paths.ToArray())}");

                    styleCatalog.Load(paths);

                    if (paths.Count != 0)
                    {
                        SaveCatalogToDisk(styleCatalog, catalogHash, k_GlobalStyleCatalogCacheFilePath);
                    }
                }
            }
        }