Ejemplo n.º 1
0
        public IEnumerator LoadAB(string abName)
        {
            ABRelation abRel;

            //AB包关系建立
            if (!abRelation.ContainsKey(abName))
            {
                abRel = new ABRelation(abName);
                abRelation.Add(abName, abRel);
            }
            abRel = abRelation[abName];
            //得到指定AB包所有依赖关系(查询Manifest清单文件)
            string[] strDependeceArray = ABManifestLoader.Instance.RetrivalDependce(abName);

            foreach (var item in strDependeceArray)
            {
                //添加依赖项
                abRel.AddDependence(item);
                //加载引用项(递归调用)
                yield return(LoadReference(item, abName));
            }

            //加载AB包
            if (singleABLoaderCache.ContainsKey(abName))
            {
                yield return(singleABLoaderCache[abName].LoadAB());
            }
            else
            {
                currentSingleABLoader = new SingleAssetLoader(abName, CompleteLoadAB);
                singleABLoaderCache.Add(abName, currentSingleABLoader);
                yield return(currentSingleABLoader.LoadAB());
            }
            yield return(null);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 加载引用AB包
        /// </summary>
        /// <param name="abName">ab包名称</param>
        /// <param name="refName">被引用AB包名称</param>
        /// <returns></returns>
        IEnumerator LoadReference(string abName, string refName)
        {
            ABRelation tmpABRelation;

            if (abRelation.ContainsKey(abName))
            {
                tmpABRelation = abRelation[abName];
                //添加AB包引用关系(被依赖)
                tmpABRelation.AddReference(refName);
            }
            else
            {
                tmpABRelation = new ABRelation(abName);
                tmpABRelation.AddReference(refName);
                abRelation.Add(abName, tmpABRelation);

                //开始加载依赖包(递归)
                yield return(LoadAB(abName));
            }

            yield return(null);
        }