Beispiel #1
0
        /// <summary>
        /// 加载AssetBundle,必须先加载Manifest
        /// </summary>
        public IEnumerator AsyncLoadAssetBundle(string bundleName)
        {
            while (!ABManifestLoader.Instance.IsLoadFinish())
            {
                yield return(null);
            }
            ABRelationManager abLoader = abDict[bundleName];

            string[] dependence = ABManifestLoader.Instance.GetDependence(bundleName);
            abLoader.SetDependence(dependence);
            for (int i = 0; i < dependence.Length; ++i)
            {
                yield return(AsyncLoadAssetBundleDependences(dependence[i], bundleName, abLoader.GetLoadFinish()));
            }
            yield return(abLoader.AsyncLoadAssetBundle());
        }
Beispiel #2
0
        public void SyncLoadAssetBundle(string bundleName)
        {
            if (abDict.ContainsKey(bundleName))
            {
                return;
            }
            ABRelationManager abLoader = new ABRelationManager(bundleName, null);

            abDict.Add(bundleName, abLoader);
            string[] dependence = ABManifestLoader.Instance.GetDependence(bundleName);
            abLoader.SetDependence(dependence);
            for (int i = 0; i < dependence.Length; ++i)
            {
                SyncLoadAssetBundleDependences(dependence[i], bundleName);
            }
            abLoader.SyncLoadAssetBundle();
        }