예제 #1
0
 protected void AddDependChild(AssetBundleLoader info)
 {
     if (info.isLoadComplete)
     {
         return;
     }
     dependCount++;
     info.Retain();
     info.AddLoadComplete(DependLoadComplete);
 }
예제 #2
0
    /// <summary>
    /// 开始加载文件
    /// </summary>
    /// <param name="url"></param>
    /// <param name="type"></param>
    /// <param name="prority"></param>
    /// <param name="Complete"></param>
    public void Load(string url, EnResourceType type, EnLoadPrority prority, CreateGameObjectDelegate Complete)
    {
        string            abPath = PathUtil.GetAbUrl(url, type);
        AssetBundleLoader loader = GetLoader(abPath);

        //已经在加载
        if (loader != null && loader.isInit)
        {
            //加载完毕
            if (loader.isLoadComplete)
            {
                //是否需要创建
                if (loader.isCreateComplete)
                {
                    CreateAsset(loader);
                }
                else
                {
                    LoadAsset(loader);
                }
            }
        }
        //没有加载过
        else
        {
            if (!assetBundleDataMaps.ContainsKey(abPath))
            {
                Loger.Error(abPath);
                return;
            }
            loader = CreateLoader(assetBundleDataMaps[abPath], prority);
        }
        loader.AddCreateComplete(Complete);
        loader.AddLoadComplete(LoadAsset);
        loader.prority = prority;
        if (!loader.isLoadComplete)
        {
            isSortWaitLoadFile = true;
        }
    }