/// <summary> /// 加载资源 /// </summary> /// <param name="resName"></param> /// <param name="loadDone"></param> /// <param name="updateProgress"></param> public void LoadRes(string resName, ResourceLoader.LoadResDoneCallback loadDone = null) { IResLoader loader = null; #if ASSETBUNDLE AssetBundleLoader abLoader = null; // 如果已经加载过这个AssetBundle if (this.loadedAssetBundleLoaderDict.TryGetValue(resName, out abLoader)) { // 检查依赖及assetbundle解压 abLoader.CheckDependences(); this.loadedAssetBundleLoaderDict.Remove(resName); this.loadingResDict[resName] = abLoader; return; } #endif // 如果正在加载中,则将加载回调添加到已有的加载器 if (this.loadingResDict.TryGetValue(resName, out loader)) { //Debug.LogWarning(resName + " loading"); if (loadDone != null) { loader.LoadDoneCallback += loadDone; } return; } // 新建加载器开始加载 #if ASSETBUNDLE loader = new AssetBundleLoader(resName, loadDone); #else loader = new ResourceLoader(resName, loadDone); #endif // 添加至正在加载列表 AddLoadingLoader(loader); // 启动加载 Game.Instance().StartCoroutine(loader); }