Пример #1
0
        public LYAssetBundle LoadAssetBundle(string assetBundleName)
        {
            LYAssetBundle bundle = LYAssetCache.GetBundleCache(assetBundleName);

            if (bundle != null)
            {
                return(bundle);
            }
            LoadDependencies(assetBundleName);
            return(doLoadAssetBundle(assetBundleName));
        }
Пример #2
0
        public void LoadAssetBundleAsyn(string assetBundleName, Action <LYAssetBundle> callback)
        {
            LYAssetBundle bundle = LYAssetCache.GetBundleCache(assetBundleName);

            if (bundle != null)
            {
                if (callback != null)
                {
                    callback(bundle);
                }
                return;
            }
            StartCoroutine(doLoadAssetBundleAsyn(assetBundleName, callback));
        }
Пример #3
0
        private LYAssetBundle doLoadAssetBundle(string assetBundleName)
        {
            LYAssetBundle ly_bundle = LYAssetCache.GetBundleCache(assetBundleName);

            if (ly_bundle != null)
            {
                //保留一次
                ly_bundle.Retain();
                return(ly_bundle);
            }
            AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(FolderPath, assetBundleName));

            if (bundle == null)
            {
                Debug.LogError("AssetBundleName file not exist:" + Path.Combine(FolderPath, assetBundleName));
                return(null);
            }
            ly_bundle = new LYAssetBundle(bundle, assetBundleName);
            LYAssetCache.SetBundleCache(assetBundleName, ly_bundle);
            return(ly_bundle);
        }
Пример #4
0
 internal static void SetBundleCache(string key, LYAssetBundle value)
 {
     LYAssetCache.BundleCache.Add(key, value);
 }