Beispiel #1
0
        public static void AddDeps(string assetPath, string[] deps)
        {
            if (!s_Inited)
            {
                Debug.LogWarning("CacheManager don't init. please call CacheManager.Open()");
                return;
            }

            Hash128      hash128 = AssetDatabase.GetAssetDependencyHash(assetPath);
            DepCacheData data;

            if (!s_ABDepCacheMap.TryGetValue(assetPath, out data))
            {
                data           = new DepCacheData();
                data.assetPath = assetPath;
                data.hash128   = hash128;
                data.depsPath  = deps;
                s_ABDepCacheMap.Add(assetPath, data);
                s_Dirty = true;
            }
            else
            {
                //更新hash128以及依赖deps;
                data.hash128  = hash128;
                data.depsPath = deps;
            }
        }
Beispiel #2
0
        public static bool TryGetDeps(string assetPath, out string[] deps)
        {
            deps = null;
            if (!s_Inited)
            {
                Debug.LogWarning("CacheManager don't init. please call CacheManager.Open()");
                return(false);
            }

            //计算资源的hash128
            Hash128 hash128 = AssetDatabase.GetAssetDependencyHash(assetPath);

            DepCacheData data = null;

            if (s_ABDepCacheMap.TryGetValue(assetPath, out data) &&
                data.hash128 == hash128)
            {
                deps = data.depsPath;
                return(true);
            }
            return(false);
        }