private IEnumerator doLoadAssetBundleAsyn(string assetBundleName, Action <LYAssetBundle> callback)
        {
            string[] dependencies = GetDependencies(assetBundleName);
            if (dependencies.Length > 0)
            {
                int index = 0;
                while (index < dependencies.Length)
                {
                    LYAssetAsynLoader dependLoader = new LYAssetAsynLoader(dependencies[index]);
                    dependLoader.LoadAsyn();
                    while (dependLoader.IsLoaded == false)
                    {
                        yield return(null);
                    }
                    index++;
                }
            }
            yield return(null);

            LYAssetAsynLoader loader = new LYAssetAsynLoader(assetBundleName);

            loader.LoadAsyn();
            while (loader.IsLoaded == false)
            {
                yield return(null);
            }
            if (callback != null)
            {
                callback(LYAssetCache.GetBundleCache(assetBundleName));
            }
        }
        public LYAssetBundle LoadAssetBundle(string assetBundleName)
        {
            LYAssetBundle bundle = LYAssetCache.GetBundleCache(assetBundleName);

            if (bundle != null)
            {
                return(bundle);
            }
            LoadDependencies(assetBundleName);
            return(doLoadAssetBundle(assetBundleName));
        }
        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));
        }
        public void LoadAsyn()
        {
            if (m_state != State.None)
            {
                return;
            }
            var bundle = LYAssetCache.GetBundleCache(m_assertName);

            if (bundle != null)
            {
                //保留一次
                bundle.Retain();
                m_state = State.Loaded;
                return;
            }
            m_state = State.Loading;
            LYAssetManager.Instance.StartCoroutine(doAsynLoad());
        }
        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);
        }