using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Core.AssetLoadTool.Asset;
using Core.Utility;
using Fort23.Core;
using Fort23.UTool;
using UnityEngine;
using Utility;

public class LocalBundleLoadTask : BundleLoadBasic
{
    protected override void StartLoad()
    {
        LoadBudnel();
    }

    private void LoadBudnel()
    {
        string url = AssetBundleLoadManager.Instance.RootPersistentBundleURL + bundleName;
        bool isOk = true;
        if (!File.Exists(url))
        {
            url = AssetBundleLoadManager.Instance.RootStreamingBundleURL + bundleName;
            isOk = false;
            /*1.0 iOS的代码，先注释了*/
            // url=  Application.streamingAssetsPath + "/Bundle/" + bundleName;
        }

        this.url = url;

        AssetBundleCreateRequest bundleReq = AssetBundle.LoadFromFileAsync(url);

        bundleReq.completed += delegate(AsyncOperation operation)
        {
            if (bundleReq.assetBundle == null)
            {
                LogTool.Error(isOk+" budnle空的" + url + "__" + bundleName);
            }

            LoadFinish(bundleReq.assetBundle);
        };
    }
}