/// <summary> /// 加载资源 /// </summary> /// <param name="assetName">资源名</param> /// <param name="assetType">资源类型</param> /// <param name="listener">回调</param> public void Load(string assetName, Type assetType, IResourceListener listener) { //如果已经加载 就直接返回 if (nameAssetDict.ContainsKey(assetName)) { listener.OnLoaded(assetName, nameAssetDict[assetName]); return; } else //没有 开始异步加载 { LoadAsync(assetName, assetType, listener); } }
/// <summary> /// 加载资源 /// </summary> /// <param name="assetPath">资源路径</param> /// <param name="assetType">资源类型</param> /// <param name="listener">回调</param> public void Load(string assetPath, Type assetType, IResourceListener listener) { //如果已经加载则返回 if (loadedAssets.ContainsKey(assetPath)) { listener.OnLoaded(assetPath, loadedAssets[assetPath]); } else { //没有就开始异步加载 LoadAsync(assetPath, assetType, listener); } }
/// <summary> /// 加载资源 /// </summary> /// <param name="assetName">资源名</param> /// <param name="type">资源类型</param> /// <param name="listener">回掉</param> /// <param name="assetType">自定义的资源类型</param> public void Load(string assetName, Type type, IResourceListener listener = null) { // 资源已存在 直接完成回掉 if (m_AssetDict.ContainsKey(assetName)) { if (listener != null) { listener.OnLoaded(assetName, m_AssetDict[assetName]); } } // 进行异步加载 else { LoadAsync(assetName, type, listener); } }