Exemplo n.º 1
0
    public IEnumerator CommonLoad()
    {
        commomLoader = new WWW(commomBundlePath);
        while (!commomLoader.isDone)
        {
            commonResourceLoaderProcess = commomLoader.progress;
            if (loadProgress != null)
            {
                loadProgress(bundleName, commonResourceLoaderProcess);
            }
            yield return(commomLoader.progress);
        }

        if (commomLoader.progress >= 1.0)
        {
            abloader = new IABResourcesLoader(commomLoader.assetBundle);
            // abloader.DebugAllResources();
            if (loadProgress != null)
            {
                loadProgress(bundleName, commomLoader.progress);
            }

            if (loadFinish != null)
            {
                loadFinish(bundleName);
            }
        }
        else
        {
            Debug.LogError("load bundle error");
        }
        commomLoader = null;
    }
Exemplo n.º 2
0
 public void Dispose()
 {
     if (abloader != null)
     {
         abloader.Dispose();
         abloader = null;
     }
 }
Exemplo n.º 3
0
 public IABLoader(string _commomBundlePath, string _commomBundleFilePath, string _bundleName, LoaderProgrecess loadProgress = null, LoadFinish loadFinish = null)
 {
     bundleName                  = _bundleName;
     commomBundlePath            = _commomBundlePath;
     commomBundleFilePath        = _commomBundleFilePath;
     commonResourceLoaderProcess = 0;
     this.loadProgress           = loadProgress;
     this.loadFinish             = loadFinish;
     abloader = null;
 }
Exemplo n.º 4
0
    /// <summary>
    /// 直接读取文件的方式加载AB包
    /// </summary>
    public void AssetBundleLoad()
    {
        AssetBundle assetBundle = AssetBundle.LoadFromFile(commomBundleFilePath);

        abloader = new IABResourcesLoader(assetBundle);
        if (loadFinish != null)
        {
            loadFinish(bundleName);
        }

        if (loadProgress != null)
        {
            loadProgress(bundleName, 1);
        }
    }