Exemple #1
0
 private void CacheLocations(IEnumerable <IResourceLocation> locations)
 {
     foreach (var location in locations)
     {
         var path = location.PrimaryKey.GetAfterFirst("/"); // Remove the addressables prefix.
         LocationsCache.Add(new CachedResourceLocation(path, location.ResourceType));
     }
 }
Exemple #2
0
        public ProjectResourceProvider(string rootPath = null)
        {
            RootPath         = rootPath;
            projectResources = GetProjectResources();
            redirectors      = new Dictionary <Type, TypeRedirector>();
            foreach (var kv in projectResources)
            {
                LocationsCache.Add(new CachedResourceLocation(kv.Key, kv.Value));
            }

            IReadOnlyDictionary <string, Type> GetProjectResources()
            {
                var filter = string.IsNullOrEmpty(RootPath) ? null : $"{RootPath}/";

                return(ProjectResources.Get().GetAllResources(filter));
            }
        }
Exemple #3
0
 public void RemoveResourceGuid(string path)
 {
     pathToGuidMap.Remove(path);
     LocationsCache.RemoveAll(r => r.Path.EqualsFast(path));
 }
Exemple #4
0
 public void AddResourceGuid(string path, string guid)
 {
     pathToGuidMap[path] = guid;
     LocationsCache.Add(new CachedResourceLocation(path, typeof(UnityEngine.Object)));
 }