Ejemplo n.º 1
0
        /// <summary>
        /// 加载AssetBundle包
        /// </summary>
        /// <returns>The asset bundle.</returns>
        /// <param name="abName">加载AssetBundle包名称</param>
        public IEnumerator LoadAssetBundle(string abName)
        {
            if (!_DicABRelating.ContainsKey(abName))
            {
                ABRelating aBRelatingObj = new ABRelating(abName);
                _DicABRelating.Add(abName, aBRelatingObj);
            }

            ABRelating tmpABRelatingObj = _DicABRelating[abName];

            string[] strDependeceArrar = ABManifestLoader.Instance.RetrivalDependce(abName);
            foreach (string item_Dependece in strDependeceArrar)
            {
                //添加依赖项
                tmpABRelatingObj.AddDependence(item_Dependece);

                //添加引用项
                yield return(LoadReference(item_Dependece, abName));
            }

            if (_DicSingleABLoaderCache.ContainsKey(abName))
            {
                yield return(_DicSingleABLoaderCache[abName].LoadAssetBunlde());
            }
            else
            {
                _CurrentSingleABLoader = new SingleABLoader(abName, CompleteLoadAb);
                _DicSingleABLoaderCache.Add(abName, _CurrentSingleABLoader);
                yield return(_CurrentSingleABLoader.LoadAssetBunlde());
            }
        }
Ejemplo n.º 2
0
 private void LoadReference(string abName, string refABName)
 {
     if (m_DicABRelating.ContainsKey(abName))
     {
         ABRelating tmpABRelatingObj = m_DicABRelating[abName];
         tmpABRelatingObj.AddReference(refABName);
     }
     else
     {
         ABRelating tmpABRelatingObj = new ABRelating(abName);
         tmpABRelatingObj.AddReference(refABName);
         m_DicABRelating.Add(abName, tmpABRelatingObj);
         LoadAssetBunlde(abName);
     }
 }
Ejemplo n.º 3
0
 private IEnumerator LoadReferenceAsyn(string abName, string refABName)
 {
     if (m_DicABRelating.ContainsKey(abName))
     {
         ABRelating tmpABRelatingObj = m_DicABRelating[abName];
         tmpABRelatingObj.AddReference(refABName);
     }
     else
     {
         ABRelating tmpABRelatingObj = new ABRelating(abName);
         tmpABRelatingObj.AddReference(refABName);
         m_DicABRelating.Add(abName, tmpABRelatingObj);
         yield return(LoadAssetBunldeAsyn(abName));
     }
 }
Ejemplo n.º 4
0
        public void LoadAssetBunlde(string abName)
        {
            if (!m_DicABRelating.ContainsKey(abName))
            {
                ABRelating aBRelatingObj = new ABRelating(abName);
                m_DicABRelating.Add(abName, aBRelatingObj);
            }

            ABRelating tmpABRelatingObj = m_DicABRelating[abName];

            string[] strDependeceArrar = ABManifestLoader.Instance.RetrivalDependce(abName);
            foreach (string item_Dependece in strDependeceArrar)
            {
                tmpABRelatingObj.AddDependence(item_Dependece);
                LoadReference(item_Dependece, abName);
            }

            if (!m_DicSingleABLoaderCache.ContainsKey(abName))
            {
                m_CurrentSingleABLoader = new SingleABLoader(abName);
                m_DicSingleABLoaderCache.Add(abName, m_CurrentSingleABLoader);
                m_CurrentSingleABLoader.LoadAssetBunlde();
            }
        }