public static void LoadDependencyLookupForCaches(NodeDependencyLookupContext stateContext, ResolverUsageDefinitionList resolverUsageDefinitionList, ProgressBase progress, bool loadCache = true, bool updateCache = true, bool saveCache = true, string fileDirectory = DEFAULT_CACHE_SAVE_PATH) { stateContext.UpdateFromDefinition(resolverUsageDefinitionList); List <CreatedDependencyCache> caches = stateContext.GetCaches(); foreach (CreatedDependencyCache cacheUsage in caches) { if (cacheUsage.ResolverUsages.Count == 0) { continue; } IDependencyCache cache = cacheUsage.Cache; if (loadCache && !cacheUsage.IsLoaded) { cache.Load(fileDirectory); cacheUsage.IsLoaded = true; } if (updateCache && cache.NeedsUpdate(progress)) { if (cache.CanUpdate()) { cache.Update(progress); if (saveCache) { cache.Save(fileDirectory); } } else { Debug.LogErrorFormat("{0} could not be updated", cache.GetType().FullName); } } } RelationLookup.RelationsLookup lookup = new RelationLookup.RelationsLookup(); lookup.Build(caches); stateContext.RelationsLookup = lookup; }
private string GetPrefKey() { return(GetPrefKey(Cache.GetType())); }