예제 #1
0
        public IEnumerator LoadABReference(string abName, string refABName)
        {
            if (string.IsNullOrEmpty(abName) || string.IsNullOrEmpty(refABName))
            {
                Debug.LogError(GetType() + "/LoadABReference()/参数abName或refABName不能为空,请检查!");
                yield break;
            }
            if (m_DicABRelation.ContainsKey(abName))
            {
                ABRelation tmpABRelation = m_DicABRelation[abName];
                tmpABRelation.AddABReference(refABName);
            }
            else
            {
                ABRelation tmpABRelation = new ABRelation(abName);
                tmpABRelation.AddABReference(refABName);
                m_DicABRelation.Add(abName, tmpABRelation);

                yield return(LoadAssetbundle(abName));
            }
        }
예제 #2
0
        public IEnumerator LoadAssetbundle(string abName)
        {
            if (string.IsNullOrEmpty(abName))
            {
                Debug.LogError(GetType() + "/LoadAssetbundle()/参数abName不能为空,请检查!");
                yield break;
            }
            if (m_DicSingleABLoaderCache.ContainsKey(abName))
            {
                Debug.LogWarning(GetType() + "/LoadAssetbundle()/该ab包已经加载!");
                if (this.m_DelAllABLoadComplete != null)
                {
                    this.m_DelAllABLoadComplete(abName);
                }
                yield break;
            }

            if (!m_DicABRelation.ContainsKey(abName))
            {
                ABRelation tmpABRelation = new ABRelation(abName);
                m_DicABRelation.Add(abName, tmpABRelation);
            }
            ABRelation m_ABRelation = m_DicABRelation[abName];

            string[] ABDependences = ABManifestLoader.GetInstance().RetervalABDependen(abName);
            foreach (string ABDependence in ABDependences)
            {
                m_ABRelation.AddABDependence(ABDependence);
                yield return(LoadABReference(ABDependence, abName));
            }

            if (!m_DicSingleABLoaderCache.ContainsKey(abName))
            {
                SingleABLoader tmpSingleABLoader = new SingleABLoader(abName, OnLoadAllABComplete);
                m_DicSingleABLoaderCache.Add(abName, tmpSingleABLoader);
            }
            SingleABLoader m_SingleABLoader = m_DicSingleABLoaderCache[abName];

            yield return(m_SingleABLoader.LoadSingleAB());
        }