Beispiel #1
0
    public IEnumerator LoadAssetBundle(string abName)
    {
        //ab包依赖关系的建立
        if (!m_relationDict.ContainsKey(abName))
        {
            ABRelation tempRelation = new ABRelation(abName);
            m_relationDict.Add(abName, tempRelation);
        }
        ABRelation abRelation = m_relationDict[abName];

        //得到ab包所有的依赖关系(查询清单文件)
        string[] strDependenceArr = ABManifestLoader.Instance.GetAllDependices(abName);
        for (int i = 0; i < strDependenceArr.Length; i++)
        {
            //添加依赖项
            abRelation.AddDependence(strDependenceArr[i]);
            //添加引用项
            yield return(LoadReferenceAB(strDependenceArr[i], abName));
        }

        //加载ab包
        if (m_singleABDict.ContainsKey(abName))
        {
            yield return(m_singleABDict[abName].LoadAssetBundle());
        }
        else
        {
            m_currentSingleABLoader = new SingleABLoader(abName, CompleteLoadABCallBack);
            m_singleABDict.Add(abName, m_currentSingleABLoader);
            yield return(m_currentSingleABLoader.LoadAssetBundle());
        }
    }
Beispiel #2
0
    //加载AB包
    public IEnumerator LoadAssetBundle(string abName)
    {
        //AB包关系的建立
        if (!dicABRelation.ContainsKey(abName))
        {
            ABRelation aBRelationObj = new ABRelation(abName);
            dicABRelation.Add(abName, aBRelationObj);
        }
        ABRelation tmpABRelation = dicABRelation[abName];

        //得到所有的依赖关系
        string[] dependencearray = ABManifestLoader.GetInstance().RetrivalDependence(abName);
        foreach (string item_dependence in dependencearray)
        {
            //添加依赖
            tmpABRelation.AddDependence(item_dependence);
            //添加引用
            yield return(LoadRefence(item_dependence, abName));
        }
        //加载
        if (dicSingleABLoader.ContainsKey(abName))
        {
            yield return(dicSingleABLoader[abName].LoadAssetBundle());
        }
        else
        {
            curSingleABLoader = new SingleABLoader(abName, CompleteAB);
            dicSingleABLoader.Add(abName, curSingleABLoader);
            yield return(curSingleABLoader.LoadAssetBundle());
        }
        yield return(null);
    }